1 #ifndef res_9_private_h
2 #define res_9_private_h
8 * status codes from dns_res_xxx SPIs
9 * positive numbers are ns_rcode values.
11 #define DNS_RES_STATUS_TIMEOUT -1001
12 #define DNS_RES_STATUS_CANCELLED -1002
13 #define DNS_RES_STATUS_INVALID_QUERY -1003
14 #define DNS_RES_STATUS_INVALID_ARGUMENT -1004
15 #define DNS_RES_STATUS_INVALID_RES_STATE -1005
16 #define DNS_RES_STATUS_INVALID_REPLY -1006
17 #define DNS_RES_STATUS_CONNECTION_REFUSED -1007
18 #define DNS_RES_STATUS_SEND_FAILED -1008
19 #define DNS_RES_STATUS_CONNECTION_FAILED -1009
20 #define DNS_RES_STATUS_SYSTEM_ERROR -1010
22 #define RES_EXT_SUFFIX_LEN 64
25 unsigned id
:16; /* query identification number */
26 #if BYTE_ORDER == BIG_ENDIAN
27 /* fields in third byte */
28 unsigned qr
: 1; /* response flag */
29 unsigned opcode
: 4; /* purpose of message */
30 unsigned aa
: 1; /* authoritive answer */
31 unsigned tc
: 1; /* truncated message */
32 unsigned rd
: 1; /* recursion desired */
33 /* fields in fourth byte */
34 unsigned ra
: 1; /* recursion available */
35 unsigned unused
:3; /* unused bits (MBZ as of 4.9.3a3) */
36 unsigned rcode
:4; /* response code */
38 #if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
39 /* fields in third byte */
40 unsigned rd
:1; /* recursion desired */
41 unsigned tc
:1; /* truncated message */
42 unsigned aa
:1; /* authoritive answer */
43 unsigned opcode
:4; /* purpose of message */
44 unsigned qr
:1; /* response flag */
45 /* fields in fourth byte */
46 unsigned rcode
:4; /* response code */
47 unsigned unused
:3; /* unused bits (MBZ as of 4.9.3a3) */
48 unsigned ra
:1; /* recursion available */
51 unsigned qdcount
:16; /* number of question entries */
52 unsigned ancount
:16; /* number of answer entries */
53 unsigned nscount
:16; /* number of authority entries */
54 unsigned arcount
:16; /* number of resource entries */
57 #ifndef __res_state_ext
58 #define __res_state_ext __res_9_res_state_ext
61 struct __res_state_ext
{
62 union res_sockaddr_union nsaddrs
[MAXNS
];
69 } sort_list
[MAXRESOLVSORT
];
75 #define get_nsaddr res_9_get_nsaddr
76 struct sockaddr
*get_nsaddr
__P((res_state
, size_t));
78 #define res_nsend_2 res_9_nsend_2
79 int res_nsend_2(res_state
, const u_char
*, int, u_char
*, int, struct sockaddr
*, int *);
81 #define res_ourserver_p res_9_ourserver_p
82 int res_ourserver_p(const res_state
, const struct sockaddr
*);
84 res_state
res_state_new();
85 void res_client_close(res_state res
);
88 * From lookupd Thread.h. We use this to signal threads to quit, since pthread_cancel() doesn't work.
90 #define ThreadStateExitRequested 4
95 extern uint32_t notify_register_plain(const char *name
, int *out_token
);
97 __private_extern__
int res_query_mDNSResponder(res_state statp
, const char *name
, int class, int type
, u_char
*answer
, int anslen
, struct sockaddr
*from
, uint32_t *fromlen
);
99 int dns_res_once(struct sockaddr
*server
, struct timeval
*timeout
, int options
, const char *name
, int class, int type
, u_char
*res
, int *reslen
);