More const changes.
[iwhd.git] / state_defs.h
blob6f865fcfc3b548291fb424378df9d0454746ab41
1 /* Copyright (C) 2010 Free Software Foundation, 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)
17 #define _STATE_DEFS_H
19 #include "mpipe.h"
20 #include "template.h"
22 #define MAX_FIELD_LEN 64
24 typedef enum {
25 MS_NEW,
26 MS_NORMAL,
27 } ms_state;
29 typedef struct {
30 int cleanup;
31 /* for everyone */
32 MHD_AccessHandlerCallback handler;
33 ms_state state;
34 /* for local ops */
35 int fd;
36 /* for proxy ops */
37 char *url;
38 char bucket[MAX_FIELD_LEN];
39 char key[MAX_FIELD_LEN];
40 char attr[MAX_FIELD_LEN];
41 /* for proxy gets */
42 CURL *curl;
43 long rc;
44 /* for proxy puts */
45 size_t size;
46 /* for proxy puts and queries */
47 struct MHD_Connection *conn;
48 /* for proxy queries */
49 struct MHD_PostProcessor *post;
50 void *query;
51 /* for bucket-level puts */
52 GHashTable *dict;
53 /* for new producer/consumer model */
54 pipe_shared pipe;
55 int from_master;
56 pthread_t backend_th;
57 pthread_t cache_th;
58 /* for bucket/object/provider list generators */
59 tmpl_ctx_t *gen_ctx;
60 } my_state;
62 #define CLEANUP_CURL 0x01
63 #define CLEANUP_BUF_PTR 0x02
64 #define CLEANUP_POST 0x04
65 #define CLEANUP_DICT 0x08
66 #define CLEANUP_QUERY 0x10
67 #define CLEANUP_TMPL 0x20
68 #define CLEANUP_URL 0x40
71 void free_ms (my_state *ms);
73 #endif