1 /* Copyright (C) 2010 Red Hat, Inc.
3 This program is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 3 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 #if !defined(_STATE_DEFS_H)
20 #include <microhttpd.h>
24 #define MAX_FIELD_LEN 64
26 /* Avoid circular (my_state->provider->backend->my_state) include. */
35 * This structure is used for pthread_create targets that take a void*
36 * argument, so that they can find the state_def and provider_t that they
37 * need regardless of whether they were invoked from main-line request
38 * code (using the thunk embedded here) or the replica code (using a thunk
39 * embedded in the repl_item).
42 struct _my_state
*parent
;
43 struct _provider
*prov
;
46 typedef struct _my_state
{
50 MHD_AccessHandlerCallback handler
;
54 char bucket
[MAX_FIELD_LEN
];
55 char key
[MAX_FIELD_LEN
];
56 char attr
[MAX_FIELD_LEN
];
61 /* for proxy puts and queries */
62 struct MHD_Connection
*conn
;
63 /* for proxy queries */
64 struct MHD_PostProcessor
*post
;
65 void *query
; /* object query */
66 void *aquery
; /* attribute query */
67 /* for bucket-level puts */
69 /* for new producer/consumer model */
74 /* for bucket/object/provider list generators */
76 GHashTableIter prov_iter
;
77 /* for back-end functions */
78 backend_thunk_t thunk
;
82 #define CLEANUP_CURL 0x01 /* no longer needed */
83 #define CLEANUP_BUF_PTR 0x02
84 #define CLEANUP_POST 0x04
85 #define CLEANUP_DICT 0x08
86 #define CLEANUP_QUERY 0x10
87 #define CLEANUP_TMPL 0x20
88 #define CLEANUP_URL 0x40
89 #define CLEANUP_AQUERY 0x80
91 #define BACKEND_GET_SIZE 0x01 /* used in put_child_func */
93 void free_ms (my_state
*ms
);