+Missing <time.h> include
[middleman.git] / include / types.h
1 #ifndef TYPES_H
2 #define TYPES_H
3
4 #include <time.h>
5
6 typedef struct {
7         int fd, frozen;
8         int inbuf_len, outbuf_len;
9         int inbuf_reallen, outbuf_reallen;
10         void *inbuf, *outbuf;
11 } SOCKET;
12
13 struct url_command_t {
14         char *command;
15         char *options;
16 };
17
18 typedef struct {
19         pcre *pattern;
20         pcre_extra *extra;
21 } regex_sub_t;
22
23 typedef struct {
24         int rm_so, rm_eo, subcount;
25         const char **substrings;
26 } regmatch_sub_t;
27
28 typedef struct XML_LIST_T {
29         struct XML_LIST_T *prev, *next;
30         int type;
31         char *item;
32 } XML_LIST;
33
34 typedef struct STACK_T {
35         struct STACK_T *next, *prev;
36         char *data;
37 } STACK;
38
39 struct HTTP_HEADER_LIST {
40         struct HTTP_HEADER_LIST *next, *prev;
41         char *type;
42         char *value;
43 };
44
45 struct LOGBUFFER_LIST {
46         struct LOGBUFFER_LIST *next, *prev;
47         char *msg;
48 };
49
50 typedef struct {
51         pthread_rwlock_t lock;
52         int entries, size;
53         struct LOGBUFFER_LIST *head, *tail;
54 } LOGBUFFER;    
55
56 typedef struct {
57         int type;
58         int version;
59         int port;
60         int code;
61         int content_length;
62         int chunked;
63         int keepalive;
64         int proxy_keepalive;
65         char *method;
66         char *proto;
67         char *host;
68         char *file;
69         char *referer;
70         char *location;
71         char *content_type;
72         char *content_encoding;
73         char *accept_encoding;
74         char *proxy_authenticate;
75         char *proxy_authorization;
76         char *host_header;
77         struct url_command_t **url_command;
78         struct HTTP_HEADER_LIST *header;
79         struct HTTP_HEADER_LIST *header_filtered;
80 } HEADER;
81
82 typedef struct {
83         int status;
84         int fd;
85         int port;
86         char *ip;
87 } SOCKLIST;
88
89 typedef struct {
90         int thread;
91         int buffer;
92         SOCKET *client, *server;
93         int port;
94         char *ip;
95         char *site_host;
96         int site_port;
97         int request;
98         int keepalive_client;
99         int keepalive_server;
100         int authenticate;
101         char *proxy_auth;
102         char *proxy_host;
103         int proxy_port;
104         int proxy_type;
105         char *proxy_username;
106         char *proxy_password;
107         char *proxy_domain;
108         int access;
109         int bypass, obypass;
110         HEADER *header, *rheader;
111 } CONNECTION;
112
113 typedef struct {
114         int code;
115         char *type;
116         unsigned int size, realsize;
117         char *data;
118 } FILEBUF;
119
120 struct COOKIE_LIST_LIST {
121         struct COOKIE_LIST_LIST *prev, *next;
122         int id, enabled;
123         int direction;
124         char *host, *comment;
125         regex_t *he;
126 };
127
128 typedef struct {
129         pthread_rwlock_t lock;
130         int id, enabled;
131         int policy;
132         struct COOKIE_LIST_LIST *allow, *deny;
133 } COOKIE_LIST;
134
135 struct FILTER_LIST_LIST {
136         struct FILTER_LIST_LIST *prev, *next;
137         int id, enabled;
138         char *comment, *template, *host, *file;
139         regex_t *he, *fe;
140 };
141
142 typedef struct {
143         pthread_rwlock_t lock;
144         int id, enabled;
145         int policy;
146         char *dtemplate;
147         struct FILTER_LIST_LIST *allow, *deny, *empty;
148 } FILTER_LIST;
149
150 struct KEYWORD_LIST_LIST {
151         struct KEYWORD_LIST_LIST *prev, *next;
152         int id, enabled;
153         int score;
154         char *comment, *host, *file, *mime, *keyword;
155         regex_t *he, *fe, *me, *ke;
156 };
157
158 typedef struct {
159         pthread_rwlock_t lock;
160         int id, enabled;
161         int threshold;
162         char *template;
163         struct KEYWORD_LIST_LIST *keyword_list;
164 } KEYWORD_LIST;
165
166 struct REDIRECT_LIST_LIST {
167         struct REDIRECT_LIST_LIST *prev, *next;
168         int id, enabled;
169         int which, port, send302, options;
170         regex_sub_t *up;
171         char *comment, *redirect, *url;
172 };
173
174 typedef struct {
175         pthread_rwlock_t lock;
176         int id, enabled;
177         struct REDIRECT_LIST_LIST *redirect_list;
178 } REDIRECT_LIST;
179
180 struct FORWARD_LIST_LIST {
181         struct FORWARD_LIST_LIST *prev, *next;
182         int id, enabled;
183         int which, port, type;
184         regex_t *he, *fe;
185         char *comment, *host, *file, *proxy, *username, *password, *domain;
186 };
187
188 typedef struct {
189         pthread_rwlock_t lock;
190         int id, enabled;
191         struct FORWARD_LIST_LIST *forward_list;
192 } FORWARD_LIST;
193
194 struct MIME_LIST_LIST {
195         struct MIME_LIST_LIST *prev, *next;
196         int id, enabled;
197         char *comment, *template, *mime, *host, *file;
198         regex_t *me, *he, *fe;
199 };
200
201 typedef struct {
202         pthread_rwlock_t lock;
203         int id, enabled;
204         int policy;
205         char *dtemplate;
206         struct MIME_LIST_LIST *allow, *deny, *empty;
207 } MIME_LIST;
208
209 struct HEADER_LIST_LIST {
210         struct HEADER_LIST_LIST *prev, *next;
211         int id, enabled;
212         char *comment, *type, *value, *host;
213         regex_t *te, *ve, *he;
214 };
215
216 typedef struct {
217         pthread_rwlock_t lock;
218         int id, enabled;
219         int policy;
220         struct HEADER_LIST_LIST *allow, *deny, *insert;
221 } HEADER_LIST;
222
223 struct ACCESS_LIST_LIST {
224         struct ACCESS_LIST_LIST *prev, *next;
225         int id, enabled;
226         int access, bypass;
227         char *comment, *ip, *username, *password;
228         regex_t *ie;
229 };
230
231 typedef struct {
232         pthread_rwlock_t lock;
233         int id;
234         int policy;
235         struct ACCESS_LIST_LIST *allow, *deny;
236 } ACCESS_LIST;
237
238 typedef struct {
239         pthread_rwlock_t lock;
240         int id;
241         struct LISTEN_LIST *listen_list;
242 } NETWORK;
243
244 struct LISTEN_LIST {
245         struct LISTEN_LIST *prev, *next;
246         int id;
247         int port;
248         char *ip;
249         char *proxy;
250         int proxytype;
251 };
252
253 struct TEMPLATE_LIST {
254         struct TEMPLATE_LIST *prev, *next;
255         int id, enabled;
256         int type, code;
257         char *comment, *name, *file, *mime;
258 };
259
260 typedef struct {
261         pthread_rwlock_t lock;
262         int id;
263         char *path;
264         struct TEMPLATE_LIST *template_list;
265 } TEMPLATES;
266
267 struct EXTERNAL_LIST_LIST {
268         struct EXTERNAL_LIST_LIST *prev, *next;
269         int id, enabled;
270         regex_t *me, *fe, *he;
271         int type;
272         char *comment, *exec, *newmime, *host, *file, *mime;
273 };
274
275 typedef struct {
276         pthread_rwlock_t lock;
277         int id, enabled;
278         struct EXTERNAL_LIST_LIST *external_list;
279 } EXTERNAL;
280
281 struct REWRITE_LIST_LIST {
282         struct REWRITE_LIST_LIST *prev, *next;
283         int id, enabled;
284         int which;
285         regex_t *he, *fe, *me;
286         regex_sub_t *pe;
287         char *comment, *pattern, *replace, *host, *file, *mime;
288 };
289
290 typedef struct {
291         pthread_rwlock_t lock;
292         int id, enabled;
293         struct REWRITE_LIST_LIST *rewrite;
294 } REWRITE_LIST;
295
296 typedef struct {
297         struct in_addr *addr;
298         int len;
299 } HOSTENT;
300
301 struct HASH_LIST {
302         struct HASH_LIST *next;
303         time_t age;
304         char *ref;
305         void *data;
306 };
307
308 typedef struct {
309         int hit;
310         int miss;
311         int size;
312         struct HASH_LIST **hash_list;
313 } HASH_TABLE;
314
315 typedef struct {
316         pthread_mutex_t lock;
317         int flags, pid;
318         int requests;
319         char *ip, *host, *file, *method;
320         int port;
321 } THREADLIST;
322         
323 struct cgi_args_t {
324         struct cgi_args_t *next;
325         char *name;
326         char *value;
327 };
328  
329 #endif                          /* TYPES_H */