:pserver:anonymous@cvs.middle-man.sourceforge.net:/cvsroot/middle-man middleman
[middleman.git] / include / cookies.h
1 #ifndef COOKIES_H
2 #define COOKIES_H
3
4 #define COOKIE_LL_NEW(x) { \
5    if (x == NULL) \
6       x = xmalloc(sizeof(struct COOKIE_LIST_LIST)); \
7    else { \
8       while (x->next != NULL) x = x->next; \
9       x->next = xmalloc(sizeof(struct COOKIE_LIST_LIST)); \
10       x = x->next; \
11    } \
12    x->he = NULL; \
13    x->host = NULL; \
14    x->direction = COOKIE_BOTH; \
15    x->next = NULL; \
16 };
17
18 #define COOKIE_LL_INSERT(x, a, b) { \
19    if (a != NULL) { \
20       if (!strcasecmp(a, "in")) \
21          x->direction = COOKIE_IN; \
22       else if (!strcasecmp(a, "out")) \
23          x->direction = COOKIE_OUT; \
24       else if (!strcasecmp(a, "both")) \
25          x->direction = COOKIE_BOTH; \
26    } \
27    if (b != NULL && x->he == NULL) { \
28       x->he = reg_compile(b, REGFLAGS | REG_NOSUB); \
29       x->host = xstrdup(b); \
30    } \
31 };
32
33 #endif                          /* COOKIES_H */