| 1 | #ifndef __res_state_defined |
| 2 | #define __res_state_defined 1 |
| 3 | |
| 4 | #include <sys/types.h> |
| 5 | #include <netinet/in.h> |
| 6 | |
| 7 | /* res_state: the global state used by the resolver stub. */ |
| 8 | #define MAXNS 3 /* max # name servers we'll track */ |
| 9 | #define MAXDFLSRCH 3 /* # default domain levels to try */ |
| 10 | #define MAXDNSRCH 6 /* max # domains in search path */ |
| 11 | #define MAXRESOLVSORT 10 /* number of net to sort on */ |
| 12 | |
| 13 | struct __res_state { |
| 14 | int retrans; /* retransmission time interval */ |
| 15 | int retry; /* number of times to retransmit */ |
| 16 | unsigned long options; /* option flags - see below. */ |
| 17 | int nscount; /* number of name servers */ |
| 18 | struct sockaddr_in |
| 19 | nsaddr_list[MAXNS]; /* address of name server */ |
| 20 | unsigned short id; /* current message id */ |
| 21 | /* 2 byte hole here. */ |
| 22 | char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ |
| 23 | char defdname[256]; /* default domain (deprecated) */ |
| 24 | unsigned long pfcode; /* RES_PRF_ flags - see below. */ |
| 25 | unsigned ndots:4; /* threshold for initial abs. query */ |
| 26 | unsigned nsort:4; /* number of elements in sort_list[] */ |
| 27 | unsigned ipv6_unavail:1; /* connecting to IPv6 server failed */ |
| 28 | unsigned unused:23; |
| 29 | struct { |
| 30 | struct in_addr addr; |
| 31 | uint32_t mask; |
| 32 | } sort_list[MAXRESOLVSORT]; |
| 33 | /* 4 byte hole here on 64-bit architectures. */ |
| 34 | void * __glibc_unused_qhook; |
| 35 | void * __glibc_unused_rhook; |
| 36 | int res_h_errno; /* last one set for this context */ |
| 37 | int _vcsock; /* PRIVATE: for res_send VC i/o */ |
| 38 | unsigned int _flags; /* PRIVATE: see below */ |
| 39 | /* 4 byte hole here on 64-bit architectures. */ |
| 40 | union { |
| 41 | char pad[52]; /* On an i386 this means 512b total. */ |
| 42 | struct { |
| 43 | uint16_t nscount; |
| 44 | uint16_t nsmap[MAXNS]; |
| 45 | int nssocks[MAXNS]; |
| 46 | uint16_t nscount6; |
| 47 | uint16_t nsinit; |
| 48 | struct sockaddr_in6 *nsaddrs[MAXNS]; |
| 49 | #ifdef _LIBC |
| 50 | unsigned long long int __glibc_extension_index |
| 51 | __attribute__((packed)); |
| 52 | #else |
| 53 | unsigned int __glibc_reserved[2]; |
| 54 | #endif |
| 55 | } _ext; |
| 56 | } _u; |
| 57 | }; |
| 58 | |
| 59 | typedef struct __res_state *res_state; |
| 60 | |
| 61 | #endif /* __res_state_defined */ |
| 62 | |