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