Extra infra.
[adns] / src / adns-internal.h
CommitLineData
5db99a2e 1/**/
2
3#ifndef ADNS_INTERNAL_H_INCLUDED
4#define ADNS_INTERNAL_H_INCLUDED
5
e7afa27f 6#include <sys/time.h>
7
5db99a2e 8#include "adns.h"
9
10#define MAXSERVERS 5
11#define MAXUDPRETRIES 10
12#define UDPRETRYMS 2000
13#define TCPMS 20000
14
15struct adns__query {
16 adns_query next, back;
17 adns_query parent, child;
18 adns_rrtype type;
5617a135 19 adns_answer *answer;
59258c2d 20 int id, flags, udpretries, nextserver;
21 unsigned long sentudp, senttcp; /* bitmaps indexed by server */
5db99a2e 22 struct timeval timeout;
23 void *context;
24 char owner[1];
59258c2d 25 /* Possible states:
26 * Queue child answer nextserver sentudp senttcp
27 * input null null 0 all bits zero all bits zero
28 * timew null null any at least 1 bit set any
29 * childw set partial any any any
30 * output null set any any any
31 */
5db99a2e 32};
33
34struct adns__state {
e7afa27f 35 adns_initflags iflags;
36 struct { adns_query head, tail; } input, timew, childw, output;
59258c2d 37 int nextid, udpsocket;
5db99a2e 38 int qbufavail, tcpbufavail, tcpbufused, tcpbufdone;
39 char *qbuf, *tcpbuf;
40 int nservers;
59258c2d 41 struct server {
5db99a2e 42 struct in_addr addr;
59258c2d 43 enum { server_disc, server_connecting, server_ok } state;
5db99a2e 44 int tcpsocket;
45 struct timeval timeout;
e7afa27f 46 struct { adns_query head, tail; } connw;
5db99a2e 47 } servers[MAXSERVERS];
48};
49
50#endif