aboutsummaryrefslogtreecommitdiff
path: root/include/musl/resolv.h
blob: 8b23ad66cc7613a68e670c95c2b409273fdc05a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#ifndef _RESOLV_H
#define _RESOLV_H

#include <stdint.h>
#include <arpa/nameser.h>
#include <netinet/in.h>

#ifdef __cplusplus
extern "C" {
#endif

#define MAXNS			3
#define MAXDFLSRCH		3
#define MAXDNSRCH		6
#define LOCALDOMAINPARTS	2

#define RES_TIMEOUT		5
#define MAXRESOLVSORT		10
#define RES_MAXNDOTS		15
#define RES_MAXRETRANS		30
#define RES_MAXRETRY		5
#define RES_DFLRETRY		2
#define RES_MAXTIME		65535

/* unused; purely for broken apps */
typedef struct __res_state {
	int retrans;
	int retry;
	unsigned long options;
	int nscount;
	struct sockaddr_in nsaddr_list[MAXNS];
# define nsaddr	nsaddr_list[0]
	unsigned short id;
	char *dnsrch[MAXDNSRCH+1];
	char defdname[256];
	unsigned long pfcode;
	unsigned ndots:4;
	unsigned nsort:4;
	unsigned ipv6_unavail:1;
	unsigned unused:23;
	struct {
		struct in_addr addr;
		uint32_t mask;
	} sort_list[MAXRESOLVSORT];
	void *qhook;
	void *rhook;
	int res_h_errno;
	int _vcsock;
	unsigned _flags;
	union {
		char pad[52];
		struct {
			uint16_t		nscount;
			uint16_t		nsmap[MAXNS];
			int			nssocks[MAXNS];
			uint16_t		nscount6;
			uint16_t		nsinit;
			struct sockaddr_in6	*nsaddrs[MAXNS];
			unsigned int		_initstamp[2];
		} _ext;
	} _u;
} *res_state;

#define	__RES	19960801

#ifndef _PATH_RESCONF
#define _PATH_RESCONF        "/etc/resolv.conf"
#endif

struct res_sym {
	int number;
	char *name;
	char *humanname;
};

#define	RES_F_VC	0x00000001
#define	RES_F_CONN	0x00000002
#define RES_F_EDNS0ERR	0x00000004

#define	RES_EXHAUSTIVE	0x00000001

#define RES_INIT	0x00000001
#define RES_DEBUG	0x00000002
#define RES_AAONLY	0x00000004
#define RES_USEVC	0x00000008
#define RES_PRIMARY	0x00000010
#define RES_IGNTC	0x00000020
#define RES_RECURSE	0x00000040
#define RES_DEFNAMES	0x00000080
#define RES_STAYOPEN	0x00000100
#define RES_DNSRCH	0x00000200
#define	RES_INSECURE1	0x00000400
#define	RES_INSECURE2	0x00000800
#define	RES_NOALIASES	0x00001000
#define	RES_USE_INET6	0x00002000
#define RES_ROTATE	0x00004000
#define	RES_NOCHECKNAME	0x00008000
#define	RES_KEEPTSIG	0x00010000
#define	RES_BLAST	0x00020000
#define RES_USEBSTRING	0x00040000
#define RES_NOIP6DOTINT	0x00080000
#define RES_USE_EDNS0	0x00100000
#define RES_SNGLKUP	0x00200000
#define RES_SNGLKUPREOP	0x00400000
#define RES_USE_DNSSEC	0x00800000

#define RES_DEFAULT	(RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)

#define RES_PRF_STATS	0x00000001
#define RES_PRF_UPDATE	0x00000002
#define RES_PRF_CLASS   0x00000004
#define RES_PRF_CMD	0x00000008
#define RES_PRF_QUES	0x00000010
#define RES_PRF_ANS	0x00000020
#define RES_PRF_AUTH	0x00000040
#define RES_PRF_ADD	0x00000080
#define RES_PRF_HEAD1	0x00000100
#define RES_PRF_HEAD2	0x00000200
#define RES_PRF_TTLID	0x00000400
#define RES_PRF_HEADX	0x00000800
#define RES_PRF_QUERY	0x00001000
#define RES_PRF_REPLY	0x00002000
#define RES_PRF_INIT	0x00004000

struct __res_state *__res_state(void);
#define _res (*__res_state())

int res_init(void);
int res_query(const char *, int, int, unsigned char *, int);
int res_querydomain(const char *, const char *, int, int, unsigned char *, int);
int res_search(const char *, int, int, unsigned char *, int);
int res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
int res_send(const unsigned char *, int, unsigned char *, int);
int dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **);
int dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
int dn_skipname(const unsigned char *, const unsigned char *);

#ifdef __cplusplus
}
#endif

#endif