1#ifndef __DNS_PRIVATE_H__
2#define __DNS_PRIVATE_H__
3
4#include <sys/cdefs.h>
5
6#define MDNS_HANDLE_NAME "*MDNS*"
7
8#define DNS_FLAG_DEBUG                    0x00000001
9#define DNS_FLAG_CHECK_RESOLVER_DIR       0x00000002
10#define DNS_FLAG_HAVE_IPV6_SERVER         0x00000004
11#define DNS_FLAG_OK_TO_SKIP_AAAA          0x00000008
12#define DNS_FLAG_DEFAULT_RESOLVER         0x00000010
13#define DNS_FLAG_FORWARD_TO_MDNSRESPONDER 0x00000020
14
15typedef struct
16{
17	res_state res;
18	char *source;
19	char *name;
20	uint32_t search_count;
21	char **search_list;
22	uint16_t port;
23	uint32_t flags;
24	uint32_t total_timeout;
25	uint32_t send_timeout;
26	uint32_t search_order;
27	uint32_t reserved1;
28	void *reserved_pointer1;
29} pdns_handle_t;
30
31typedef struct
32{
33	pdns_handle_t *pdns_primary;
34	uint32_t client_count;
35	pdns_handle_t **client;
36	uint32_t modtime;
37	uint32_t stattime;
38	uint32_t stat_latency;
39	uint32_t flags;
40	int notify_sys_config_token;
41	int notify_dir_token;
42	int notify_delay_token;
43	time_t dns_delay;
44	uint32_t reserved1;
45	void *reserved_pointer1;
46} sdns_handle_t;
47
48typedef struct __dns_handle_private_struct
49{
50	uint32_t handle_type;
51	sdns_handle_t *sdns;
52	pdns_handle_t *pdns;
53	char *recvbuf;
54	uint32_t recvsize;
55	uint32_t reserved1;
56	uint32_t reserved2;
57	void *reserved_pointer1;
58	void *reserved_pointer2;
59} dns_private_handle_t;
60
61
62__BEGIN_DECLS
63
64/*
65 * Returns the number of nameserver addresses available to the input
66 * DNS client.  Returns zero if the input handle is a "Super" DNS handle.
67 */
68extern uint32_t dns_server_list_count(dns_handle_t d);
69
70/*
71 * Returns the nameserver address at the given index.  Returns NULL
72 * if the index is out of range.  Caller should free the returned sockaddr.
73 */
74extern struct sockaddr *dns_server_list_address(dns_handle_t d, uint32_t i);
75
76/*
77 * Returns a list of all server addresses for all clients.
78 * Caller must free each list entry, and the returned list.
79 */
80extern void dns_all_server_addrs(dns_handle_t d, struct sockaddr ***addrs, uint32_t *count);
81
82/*
83 * Returns the number of names in the search list.
84 */
85uint32_t dns_search_list_count(dns_handle_t d);
86
87__END_DECLS
88
89#endif /* __DNS_PRIVATE_H__ */
90