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