]>
Commit | Line | Data |
---|---|---|
28f540f4 | 1 | /* |
e685e07d | 2 | * Copyright (c) 1983, 1987, 1989 |
28f540f4 | 3 | * The Regents of the University of California. All rights reserved. |
835bf8e0 | 4 | * |
28f540f4 RM |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
28f540f4 RM |
13 | * 4. Neither the name of the University nor the names of its contributors |
14 | * may be used to endorse or promote products derived from this software | |
15 | * without specific prior written permission. | |
835bf8e0 | 16 | * |
28f540f4 RM |
17 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
27 | * SUCH DAMAGE. | |
28f540f4 RM |
28 | */ |
29 | ||
b43b13ac UD |
30 | /* |
31 | * Portions Copyright (c) 1996-1999 by Internet Software Consortium. | |
32 | * | |
33 | * Permission to use, copy, modify, and distribute this software for any | |
34 | * purpose with or without fee is hereby granted, provided that the above | |
35 | * copyright notice and this permission notice appear in all copies. | |
36 | * | |
37 | * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS | |
38 | * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | |
39 | * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE | |
40 | * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | |
41 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR | |
42 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
43 | * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
44 | * SOFTWARE. | |
45 | */ | |
46 | ||
28f540f4 RM |
47 | /* |
48 | * @(#)resolv.h 8.1 (Berkeley) 6/2/93 | |
e685e07d | 49 | * $BINDId: resolv.h,v 8.31 2000/03/30 20:16:50 vixie Exp $ |
28f540f4 RM |
50 | */ |
51 | ||
e685e07d | 52 | #ifndef _RESOLV_H_ |
500b3a49 | 53 | #define _RESOLV_H_ |
64ca3f32 | 54 | |
500b3a49 ZW |
55 | #include <sys/cdefs.h> |
56 | #include <sys/param.h> | |
64ca3f32 | 57 | #include <sys/types.h> |
500b3a49 | 58 | #include <stdio.h> |
64ca3f32 | 59 | #include <netinet/in.h> |
500b3a49 ZW |
60 | #include <arpa/nameser.h> |
61 | #include <bits/types/res_state.h> | |
28f540f4 RM |
62 | |
63 | /* | |
64 | * Global defines and variables for resolver stub. | |
65 | */ | |
500b3a49 | 66 | #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ |
28f540f4 | 67 | |
500b3a49 ZW |
68 | #define RES_TIMEOUT 5 /* min. seconds between retries */ |
69 | #define RES_MAXNDOTS 15 /* should reflect bit field size */ | |
70 | #define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ | |
71 | #define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ | |
72 | #define RES_DFLRETRY 2 /* Default #/tries. */ | |
73 | #define RES_MAXTIME 65535 /* Infinity, in milliseconds. */ | |
28f540f4 | 74 | |
500b3a49 | 75 | #define nsaddr nsaddr_list[0] /* for backward compatibility */ |
535b764d | 76 | |
535b764d UD |
77 | /* |
78 | * Revision information. This is the release date in YYYYMMDD format. | |
79 | * It can change every day so the right thing to do with it is use it | |
80 | * in preprocessor commands such as "#if (__RES > 19931104)". Do not | |
81 | * compare for equality; rather, use it to determine whether your resolver | |
82 | * is new enough to contain a certain feature. | |
83 | */ | |
84 | ||
85 | #define __RES 19991006 | |
86 | ||
87 | /* | |
88 | * Resolver configuration file. | |
89 | * Normally not present, but may contain the address of the | |
90 | * inital name server(s) to query and the domain search list. | |
91 | */ | |
92 | ||
93 | #ifndef _PATH_RESCONF | |
94 | #define _PATH_RESCONF "/etc/resolv.conf" | |
95 | #endif | |
96 | ||
97 | struct res_sym { | |
98 | int number; /* Identifying number, like T_MX */ | |
99 | char * name; /* Its symbolic name, like "MX" */ | |
100 | char * humanname; /* Its fun name, like "mail exchanger" */ | |
101 | }; | |
b43b13ac | 102 | |
28f540f4 RM |
103 | /* |
104 | * Resolver options (keep these in synch with res_debug.c, please) | |
105 | */ | |
106 | #define RES_INIT 0x00000001 /* address initialized */ | |
107 | #define RES_DEBUG 0x00000002 /* print debug messages */ | |
bfbd1de1 FW |
108 | #define RES_AAONLY \ |
109 | __glibc_macro_warning ("RES_AAONLY is deprecated") 0x00000004 | |
28f540f4 | 110 | #define RES_USEVC 0x00000008 /* use virtual circuit */ |
bfbd1de1 FW |
111 | #define RES_PRIMARY \ |
112 | __glibc_macro_warning ("RES_PRIMARY is deprecated") 0x00000010 | |
28f540f4 RM |
113 | #define RES_IGNTC 0x00000020 /* ignore trucation errors */ |
114 | #define RES_RECURSE 0x00000040 /* recursion desired */ | |
115 | #define RES_DEFNAMES 0x00000080 /* use default domain name */ | |
116 | #define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ | |
117 | #define RES_DNSRCH 0x00000200 /* search up local domain tree */ | |
118 | #define RES_INSECURE1 0x00000400 /* type 1 security disabled */ | |
119 | #define RES_INSECURE2 0x00000800 /* type 2 security disabled */ | |
3d61b63c | 120 | #define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ |
b76e0659 FW |
121 | #define RES_USE_INET6 \ |
122 | __glibc_macro_warning ("RES_USE_INET6 is deprecated") 0x00002000 | |
b43b13ac | 123 | #define RES_ROTATE 0x00004000 /* rotate ns list after each query */ |
bfbd1de1 FW |
124 | #define RES_NOCHECKNAME \ |
125 | __glibc_macro_warning ("RES_NOCHECKNAME is deprecated") 0x00008000 | |
126 | #define RES_KEEPTSIG \ | |
127 | __glibc_macro_warning ("RES_KEEPTSIG is deprecated") 0x00010000 | |
bbe989ee FW |
128 | #define RES_BLAST \ |
129 | __glibc_macro_warning ("RES_BLAST is deprecated") 0x00020000 | |
2bbb7d5b | 130 | #define RES_USE_EDNS0 0x00100000 /* Use EDNS0. */ |
ae061910 | 131 | #define RES_SNGLKUP 0x00200000 /* one outstanding request at a time */ |
44d20bca UD |
132 | #define RES_SNGLKUPREOP 0x00400000 /* -"-, but open new socket for each |
133 | request */ | |
2d0671cb | 134 | #define RES_USE_DNSSEC 0x00800000 /* use DNSSEC using OK bit in OPT */ |
f87dfb1f UD |
135 | #define RES_NOTLDQUERY 0x01000000 /* Do not look up unqualified name |
136 | as a TLD. */ | |
aef16cc8 | 137 | #define RES_NORELOAD 0x02000000 /* No automatic configuration reload. */ |
28f540f4 | 138 | |
7ec47a85 | 139 | #define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH) |
28f540f4 RM |
140 | |
141 | /* | |
142 | * Resolver "pfcode" values. Used by dig. | |
143 | */ | |
144 | #define RES_PRF_STATS 0x00000001 | |
b43b13ac | 145 | #define RES_PRF_UPDATE 0x00000002 |
e685e07d | 146 | #define RES_PRF_CLASS 0x00000004 |
28f540f4 RM |
147 | #define RES_PRF_CMD 0x00000008 |
148 | #define RES_PRF_QUES 0x00000010 | |
149 | #define RES_PRF_ANS 0x00000020 | |
150 | #define RES_PRF_AUTH 0x00000040 | |
151 | #define RES_PRF_ADD 0x00000080 | |
152 | #define RES_PRF_HEAD1 0x00000100 | |
153 | #define RES_PRF_HEAD2 0x00000200 | |
154 | #define RES_PRF_TTLID 0x00000400 | |
155 | #define RES_PRF_HEADX 0x00000800 | |
156 | #define RES_PRF_QUERY 0x00001000 | |
157 | #define RES_PRF_REPLY 0x00002000 | |
b43b13ac | 158 | #define RES_PRF_INIT 0x00004000 |
28f540f4 RM |
159 | /* 0x00008000 */ |
160 | ||
b43b13ac | 161 | /* Things involving an internal (static) resolver context. */ |
835bf8e0 | 162 | __BEGIN_DECLS |
f14273c5 | 163 | extern struct __res_state *__res_state(void) __attribute__ ((__const__)); |
835bf8e0 | 164 | __END_DECLS |
e685e07d | 165 | #define _res (*__res_state()) |
fdacb17d | 166 | |
b43b13ac UD |
167 | #define fp_nquery __fp_nquery |
168 | #define fp_query __fp_query | |
169 | #define hostalias __hostalias | |
170 | #define p_query __p_query | |
171 | #define res_close __res_close | |
e685e07d | 172 | #define res_init __res_init |
b43b13ac | 173 | #define res_isourserver __res_isourserver |
e685e07d UD |
174 | #define res_mkquery __res_mkquery |
175 | #define res_query __res_query | |
176 | #define res_querydomain __res_querydomain | |
177 | #define res_search __res_search | |
b43b13ac | 178 | #define res_send __res_send |
28f540f4 | 179 | |
b43b13ac | 180 | __BEGIN_DECLS |
11160cb7 ZW |
181 | void fp_nquery (const unsigned char *, int, FILE *) __THROW; |
182 | void fp_query (const unsigned char *, FILE *) __THROW; | |
79937577 | 183 | const char * hostalias (const char *) __THROW; |
11160cb7 | 184 | void p_query (const unsigned char *) __THROW; |
79937577 UD |
185 | void res_close (void) __THROW; |
186 | int res_init (void) __THROW; | |
187 | int res_isourserver (const struct sockaddr_in *) __THROW; | |
11160cb7 ZW |
188 | int res_mkquery (int, const char *, int, int, |
189 | const unsigned char *, int, const unsigned char *, | |
190 | unsigned char *, int) __THROW; | |
191 | int res_query (const char *, int, int, unsigned char *, int) | |
192 | __THROW; | |
79937577 | 193 | int res_querydomain (const char *, const char *, int, int, |
11160cb7 ZW |
194 | unsigned char *, int) __THROW; |
195 | int res_search (const char *, int, int, unsigned char *, int) | |
196 | __THROW; | |
197 | int res_send (const unsigned char *, int, unsigned char *, int) | |
198 | __THROW; | |
b43b13ac | 199 | __END_DECLS |
df21c858 | 200 | |
b43b13ac UD |
201 | #define b64_ntop __b64_ntop |
202 | #define b64_pton __b64_pton | |
203 | #define dn_comp __dn_comp | |
204 | #define dn_count_labels __dn_count_labels | |
e685e07d | 205 | #define dn_expand __dn_expand |
b43b13ac UD |
206 | #define dn_skipname __dn_skipname |
207 | #define fp_resstat __fp_resstat | |
208 | #define loc_aton __loc_aton | |
209 | #define loc_ntoa __loc_ntoa | |
210 | #define p_cdname __p_cdname | |
211 | #define p_cdnname __p_cdnname | |
212 | #define p_class __p_class | |
213 | #define p_fqname __p_fqname | |
214 | #define p_fqnname __p_fqnname | |
215 | #define p_option __p_option | |
b43b13ac UD |
216 | #define p_time __p_time |
217 | #define p_type __p_type | |
218 | #define p_rcode __p_rcode | |
219 | #define putlong __putlong | |
220 | #define putshort __putshort | |
221 | #define res_dnok __res_dnok | |
b43b13ac UD |
222 | #define res_hnok __res_hnok |
223 | #define res_hostalias __res_hostalias | |
224 | #define res_mailok __res_mailok | |
225 | #define res_nameinquery __res_nameinquery | |
226 | #define res_nclose __res_nclose | |
227 | #define res_ninit __res_ninit | |
228 | #define res_nmkquery __res_nmkquery | |
b43b13ac UD |
229 | #define res_nquery __res_nquery |
230 | #define res_nquerydomain __res_nquerydomain | |
231 | #define res_nsearch __res_nsearch | |
232 | #define res_nsend __res_nsend | |
b43b13ac UD |
233 | #define res_ownok __res_ownok |
234 | #define res_queriesmatch __res_queriesmatch | |
235 | #define res_randomid __res_randomid | |
236 | #define sym_ntop __sym_ntop | |
237 | #define sym_ntos __sym_ntos | |
238 | #define sym_ston __sym_ston | |
28f540f4 | 239 | __BEGIN_DECLS |
79937577 UD |
240 | int res_hnok (const char *) __THROW; |
241 | int res_ownok (const char *) __THROW; | |
242 | int res_mailok (const char *) __THROW; | |
243 | int res_dnok (const char *) __THROW; | |
244 | int sym_ston (const struct res_sym *, const char *, int *) __THROW; | |
245 | const char * sym_ntos (const struct res_sym *, int, int *) __THROW; | |
246 | const char * sym_ntop (const struct res_sym *, int, int *) __THROW; | |
11160cb7 ZW |
247 | int b64_ntop (const unsigned char *, size_t, char *, size_t) |
248 | __THROW; | |
249 | int b64_pton (char const *, unsigned char *, size_t) __THROW; | |
250 | int loc_aton (const char *__ascii, unsigned char *__binary) __THROW; | |
251 | const char * loc_ntoa (const unsigned char *__binary, char *__ascii) __THROW; | |
252 | int dn_skipname (const unsigned char *, const unsigned char *) | |
253 | __THROW; | |
254 | void putlong (uint32_t, unsigned char *) __THROW; | |
255 | void putshort (uint16_t, unsigned char *) __THROW; | |
79937577 | 256 | const char * p_class (int) __THROW; |
11160cb7 | 257 | const char * p_time (uint32_t) __THROW; |
79937577 UD |
258 | const char * p_type (int) __THROW; |
259 | const char * p_rcode (int) __THROW; | |
11160cb7 ZW |
260 | const unsigned char * p_cdnname (const unsigned char *, |
261 | const unsigned char *, int, FILE *) __THROW; | |
262 | const unsigned char * p_cdname (const unsigned char *, const unsigned char *, | |
263 | FILE *) __THROW; | |
264 | const unsigned char * p_fqnname (const unsigned char *__cp, | |
265 | const unsigned char *__msg, | |
266 | int, char *, int) __THROW; | |
267 | const unsigned char * p_fqname (const unsigned char *, | |
268 | const unsigned char *, FILE *) __THROW; | |
269 | const char * p_option (unsigned long __option) __THROW; | |
79937577 | 270 | int dn_count_labels (const char *) __THROW; |
11160cb7 ZW |
271 | int dn_comp (const char *, unsigned char *, int, unsigned char **, |
272 | unsigned char **) __THROW; | |
273 | int dn_expand (const unsigned char *, const unsigned char *, | |
274 | const unsigned char *, char *, int) __THROW; | |
275 | unsigned int res_randomid (void) __THROW; | |
79937577 | 276 | int res_nameinquery (const char *, int, int, |
11160cb7 ZW |
277 | const unsigned char *, |
278 | const unsigned char *) __THROW; | |
279 | int res_queriesmatch (const unsigned char *, | |
280 | const unsigned char *, | |
281 | const unsigned char *, | |
282 | const unsigned char *) __THROW; | |
b43b13ac | 283 | /* Things involving a resolver context. */ |
79937577 | 284 | int res_ninit (res_state) __THROW; |
79937577 | 285 | void fp_resstat (const res_state, FILE *) __THROW; |
79937577 UD |
286 | const char * res_hostalias (const res_state, const char *, char *, size_t) |
287 | __THROW; | |
11160cb7 ZW |
288 | int res_nquery (res_state, const char *, int, int, |
289 | unsigned char *, int) __THROW; | |
290 | int res_nsearch (res_state, const char *, int, int, | |
291 | unsigned char *, int) __THROW; | |
79937577 | 292 | int res_nquerydomain (res_state, const char *, const char *, int, |
11160cb7 | 293 | int, unsigned char *, int) __THROW; |
79937577 | 294 | int res_nmkquery (res_state, int, const char *, int, int, |
11160cb7 ZW |
295 | const unsigned char *, int, |
296 | const unsigned char *, unsigned char *, int) | |
79937577 | 297 | __THROW; |
11160cb7 ZW |
298 | int res_nsend (res_state, const unsigned char *, int, |
299 | unsigned char *, int) __THROW; | |
79937577 | 300 | void res_nclose (res_state) __THROW; |
500b3a49 | 301 | |
28f540f4 RM |
302 | __END_DECLS |
303 | ||
b43b13ac | 304 | #endif /* !_RESOLV_H_ */ |