+Missing <time.h> include
[middleman.git] / include / network.h
1 #ifndef NETWORK_H
2 #define NETWORK_H
3
4 #define LISTEN_LIST_NEW(x) { \
5    if (x == NULL) \
6       x = xmalloc(sizeof(struct LISTEN_LIST)); \
7    else { \
8       while (x->next != NULL) x = x->next; \
9       x->next = xmalloc(sizeof(struct LISTEN_LIST)); \
10       x = x->next; \
11    } \
12    x->port = -1; \
13    x->ip = NULL; \
14    x->next = NULL; \
15    x->proxy = NULL; \
16    x->proxytype = PROXY_DIRECT; \
17 };
18
19 #define LISTEN_LIST_INSERT(x, a, b, c, d) { \
20    if (a != NULL && x->ip == NULL) \
21       x->ip = xstrdup(a); \
22    if (b != -1) \
23       x->port = b; \
24    if (c != NULL && x->proxy == NULL) \
25       x->proxy = xstrdup(c); \
26    if (d != NULL) { \
27       if (!strcasecmp(d, "normal")) \
28          x->proxytype = PROXY_NORMAL; \
29       else if (!strcasecmp(d, "socks4")) \
30          x->proxytype = PROXY_SOCKS4; \
31       else \
32          x->proxytype = PROXY_DIRECT; \
33    } \
34 };
35
36 #endif                          /* NETWORK_H */