resolv.h revision 1.41 1 1.41 christos /* $NetBSD: resolv.h,v 1.41 2021/04/30 16:07:49 christos Exp $ */
2 1.36 christos
3 1.36 christos /*
4 1.36 christos * Portions Copyright (C) 2004, 2005, 2008, 2009 Internet Systems Consortium, Inc. ("ISC")
5 1.36 christos * Portions Copyright (C) 1995-2003 Internet Software Consortium.
6 1.36 christos *
7 1.36 christos * Permission to use, copy, modify, and/or distribute this software for any
8 1.36 christos * purpose with or without fee is hereby granted, provided that the above
9 1.36 christos * copyright notice and this permission notice appear in all copies.
10 1.36 christos *
11 1.36 christos * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 1.36 christos * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 1.36 christos * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 1.36 christos * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 1.36 christos * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 1.36 christos * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 1.36 christos * PERFORMANCE OF THIS SOFTWARE.
18 1.36 christos */
19 1.18 itojun
20 1.18 itojun /*
21 1.23 christos * Copyright (c) 1983, 1987, 1989
22 1.23 christos * The Regents of the University of California. All rights reserved.
23 1.36 christos *
24 1.18 itojun * Redistribution and use in source and binary forms, with or without
25 1.18 itojun * modification, are permitted provided that the following conditions
26 1.18 itojun * are met:
27 1.18 itojun * 1. Redistributions of source code must retain the above copyright
28 1.18 itojun * notice, this list of conditions and the following disclaimer.
29 1.18 itojun * 2. Redistributions in binary form must reproduce the above copyright
30 1.18 itojun * notice, this list of conditions and the following disclaimer in the
31 1.18 itojun * documentation and/or other materials provided with the distribution.
32 1.23 christos * 3. Neither the name of the University nor the names of its contributors
33 1.18 itojun * may be used to endorse or promote products derived from this software
34 1.18 itojun * without specific prior written permission.
35 1.36 christos *
36 1.23 christos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
37 1.18 itojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 1.18 itojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 1.23 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
40 1.18 itojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41 1.18 itojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
42 1.18 itojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 1.18 itojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
44 1.18 itojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
45 1.18 itojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 1.18 itojun * SUCH DAMAGE.
47 1.18 itojun */
48 1.12 perry
49 1.32 christos /*%
50 1.12 perry * @(#)resolv.h 8.1 (Berkeley) 6/2/93
51 1.36 christos * Id: resolv.h,v 1.30 2009/03/03 01:52:48 each Exp
52 1.9 mrg */
53 1.9 mrg
54 1.1 cgd #ifndef _RESOLV_H_
55 1.1 cgd #define _RESOLV_H_
56 1.1 cgd
57 1.9 mrg #include <sys/param.h>
58 1.23 christos #if (!defined(BSD)) || (BSD < 199306)
59 1.23 christos # include <sys/bitypes.h>
60 1.23 christos #else
61 1.12 perry #include <sys/types.h>
62 1.23 christos #endif
63 1.9 mrg #include <sys/cdefs.h>
64 1.18 itojun #include <sys/socket.h>
65 1.9 mrg #include <stdio.h>
66 1.40 christos #include <netinet/in.h>
67 1.23 christos #include <arpa/nameser.h>
68 1.9 mrg
69 1.32 christos /*%
70 1.10 mrg * Revision information. This is the release date in YYYYMMDD format.
71 1.10 mrg * It can change every day so the right thing to do with it is use it
72 1.10 mrg * in preprocessor commands such as "#if (__RES > 19931104)". Do not
73 1.4 deraadt * compare for equality; rather, use it to determine whether your resolver
74 1.4 deraadt * is new enough to contain a certain feature.
75 1.4 deraadt */
76 1.4 deraadt
77 1.36 christos #define __RES 20090302
78 1.23 christos
79 1.32 christos /*%
80 1.23 christos * This used to be defined in res_query.c, now it's in herror.c.
81 1.23 christos * [XXX no it's not. It's in irs/irs_data.c]
82 1.23 christos * It was
83 1.23 christos * never extern'd by any *.h file before it was placed here. For thread
84 1.23 christos * aware programs, the last h_errno value set is stored in res->h_errno.
85 1.23 christos *
86 1.23 christos * XXX: There doesn't seem to be a good reason for exposing RES_SET_H_ERRNO
87 1.23 christos * (and __h_errno_set) to the public via <resolv.h>.
88 1.23 christos * XXX: __h_errno_set is really part of IRS, not part of the resolver.
89 1.23 christos * If somebody wants to build and use a resolver that doesn't use IRS,
90 1.23 christos * what do they do? Perhaps something like
91 1.23 christos * #ifdef WANT_IRS
92 1.23 christos * # define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
93 1.23 christos * #else
94 1.23 christos * # define RES_SET_H_ERRNO(r,x) (h_errno = (r)->res_h_errno = (x))
95 1.23 christos * #endif
96 1.23 christos */
97 1.23 christos
98 1.23 christos #define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
99 1.32 christos struct __res_state; /*%< forward */
100 1.23 christos __BEGIN_DECLS
101 1.27 he void __h_errno_set(struct __res_state *, int);
102 1.23 christos __END_DECLS
103 1.4 deraadt
104 1.32 christos /*%
105 1.1 cgd * Resolver configuration file.
106 1.1 cgd * Normally not present, but may contain the address of the
107 1.23 christos * initial name server(s) to query and the domain search list.
108 1.1 cgd */
109 1.1 cgd
110 1.1 cgd #ifndef _PATH_RESCONF
111 1.1 cgd #define _PATH_RESCONF "/etc/resolv.conf"
112 1.1 cgd #endif
113 1.1 cgd
114 1.23 christos typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
115 1.23 christos res_sendhookact;
116 1.23 christos
117 1.30 perry typedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *,
118 1.23 christos const u_char **, int *,
119 1.30 perry u_char *, int, int *);
120 1.23 christos
121 1.30 perry typedef res_sendhookact (*res_send_rhook)(const struct sockaddr *,
122 1.23 christos const u_char *, int, u_char *,
123 1.30 perry int, int *);
124 1.23 christos
125 1.23 christos struct res_sym {
126 1.32 christos int number; /*%< Identifying number, like T_MX */
127 1.32 christos const char * name; /*%< Its symbolic name, like "MX" */
128 1.32 christos const char * humanname; /*%< Its fun name, like "mail exchanger" */
129 1.23 christos };
130 1.23 christos
131 1.32 christos /*%
132 1.1 cgd * Global defines and variables for resolver stub.
133 1.1 cgd */
134 1.32 christos #define MAXNS 3 /*%< max # name servers we'll track */
135 1.32 christos #define MAXDFLSRCH 3 /*%< # default domain levels to try */
136 1.32 christos #define MAXDNSRCH 6 /*%< max # domains in search path */
137 1.32 christos #define LOCALDOMAINPARTS 2 /*%< min levels in name that is "local" */
138 1.32 christos #define RES_TIMEOUT 5 /*%< min. seconds between retries */
139 1.32 christos #define MAXRESOLVSORT 10 /*%< number of net to sort on */
140 1.32 christos #define RES_MAXNDOTS 15 /*%< should reflect bit field size */
141 1.32 christos #define RES_MAXRETRANS 30 /*%< only for resolv.conf/RES_OPTIONS */
142 1.32 christos #define RES_MAXRETRY 5 /*%< only for resolv.conf/RES_OPTIONS */
143 1.32 christos #define RES_DFLRETRY 2 /*%< Default #/tries. */
144 1.32 christos #define RES_MAXTIME 65535 /*%< Infinity, in milliseconds. */
145 1.23 christos
146 1.23 christos struct __res_state_ext;
147 1.1 cgd
148 1.4 deraadt struct __res_state {
149 1.32 christos int retrans; /*%< retransmission time interval */
150 1.32 christos int retry; /*%< number of times to retransmit */
151 1.23 christos #ifdef sun
152 1.32 christos u_int options; /*%< option flags - see below. */
153 1.23 christos #else
154 1.32 christos u_long options; /*%< option flags - see below. */
155 1.23 christos #endif
156 1.32 christos int nscount; /*%< number of name servers */
157 1.9 mrg struct sockaddr_in
158 1.32 christos nsaddr_list[MAXNS]; /*%< address of name server */
159 1.32 christos #define nsaddr nsaddr_list[0] /*%< for backward compatibility */
160 1.32 christos u_short id; /*%< current message id */
161 1.32 christos char *dnsrch[MAXDNSRCH+1]; /*%< components of domain to search */
162 1.32 christos char defdname[256]; /*%< default domain (deprecated) */
163 1.23 christos #ifdef sun
164 1.32 christos u_int pfcode; /*%< RES_PRF_ flags - see below. */
165 1.23 christos #else
166 1.32 christos u_long pfcode; /*%< RES_PRF_ flags - see below. */
167 1.23 christos #endif
168 1.32 christos unsigned ndots:4; /*%< threshold for initial abs. query */
169 1.32 christos unsigned nsort:4; /*%< number of elements in sort_list[] */
170 1.4 deraadt char unused[3];
171 1.4 deraadt struct {
172 1.9 mrg struct in_addr addr;
173 1.31 perry uint32_t mask;
174 1.4 deraadt } sort_list[MAXRESOLVSORT];
175 1.28 christos #ifdef __OLD_RES_STATE
176 1.28 christos char lookups[4];
177 1.28 christos #else
178 1.32 christos res_send_qhook qhook; /*%< query hook */
179 1.32 christos res_send_rhook rhook; /*%< response hook */
180 1.32 christos int res_h_errno; /*%< last one set for this context */
181 1.32 christos int _vcsock; /*%< PRIVATE: for res_send VC i/o */
182 1.32 christos u_int _flags; /*%< PRIVATE: see below */
183 1.32 christos u_int _pad; /*%< make _u 64 bit aligned */
184 1.23 christos union {
185 1.23 christos /* On an 32-bit arch this means 512b total. */
186 1.37 christos char pad[56 - 4*sizeof (int) - 3*sizeof (void *)];
187 1.23 christos struct {
188 1.31 perry uint16_t nscount;
189 1.32 christos uint16_t nstimes[MAXNS]; /*%< ms. */
190 1.23 christos int nssocks[MAXNS];
191 1.32 christos struct __res_state_ext *ext; /*%< extention for IPv6 */
192 1.23 christos } _ext;
193 1.23 christos } _u;
194 1.37 christos u_char *_rnd; /*%< PRIVATE: random state */
195 1.28 christos #endif
196 1.23 christos };
197 1.23 christos
198 1.23 christos typedef struct __res_state *res_state;
199 1.23 christos
200 1.23 christos union res_sockaddr_union {
201 1.23 christos struct sockaddr_in sin;
202 1.23 christos #ifdef IN6ADDR_ANY_INIT
203 1.23 christos struct sockaddr_in6 sin6;
204 1.23 christos #endif
205 1.23 christos #ifdef ISC_ALIGN64
206 1.32 christos int64_t __align64; /*%< 64bit alignment */
207 1.23 christos #else
208 1.32 christos int32_t __align32; /*%< 32bit alignment */
209 1.23 christos #endif
210 1.23 christos char __space[128]; /* max size */
211 1.1 cgd };
212 1.1 cgd
213 1.32 christos /*%
214 1.23 christos * Resolver flags (used to be discrete per-module statics ints).
215 1.18 itojun */
216 1.32 christos #define RES_F_VC 0x00000001 /*%< socket is TCP */
217 1.32 christos #define RES_F_CONN 0x00000002 /*%< socket is connected */
218 1.32 christos #define RES_F_EDNS0ERR 0x00000004 /*%< EDNS0 caused errors */
219 1.32 christos #define RES_F__UNUSED 0x00000008 /*%< (unused) */
220 1.32 christos #define RES_F_LASTMASK 0x000000F0 /*%< ordinal server of last res_nsend */
221 1.32 christos #define RES_F_LASTSHIFT 4 /*%< bit position of LASTMASK "flag" */
222 1.23 christos #define RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT)
223 1.23 christos
224 1.23 christos /* res_findzonecut2() options */
225 1.32 christos #define RES_EXHAUSTIVE 0x00000001 /*%< always do all queries */
226 1.32 christos #define RES_IPV4ONLY 0x00000002 /*%< IPv4 only */
227 1.32 christos #define RES_IPV6ONLY 0x00000004 /*%< IPv6 only */
228 1.18 itojun
229 1.32 christos /*%
230 1.9 mrg * Resolver options (keep these in synch with res_debug.c, please)
231 1.1 cgd */
232 1.32 christos #define RES_INIT 0x00000001 /*%< address initialized */
233 1.32 christos #define RES_DEBUG 0x00000002 /*%< print debug messages */
234 1.32 christos #define RES_AAONLY 0x00000004 /*%< authoritative answers only (!IMPL)*/
235 1.32 christos #define RES_USEVC 0x00000008 /*%< use virtual circuit */
236 1.32 christos #define RES_PRIMARY 0x00000010 /*%< query primary server only (!IMPL) */
237 1.32 christos #define RES_IGNTC 0x00000020 /*%< ignore trucation errors */
238 1.32 christos #define RES_RECURSE 0x00000040 /*%< recursion desired */
239 1.32 christos #define RES_DEFNAMES 0x00000080 /*%< use default domain name */
240 1.32 christos #define RES_STAYOPEN 0x00000100 /*%< Keep TCP socket open */
241 1.32 christos #define RES_DNSRCH 0x00000200 /*%< search up local domain tree */
242 1.32 christos #define RES_INSECURE1 0x00000400 /*%< type 1 security disabled */
243 1.32 christos #define RES_INSECURE2 0x00000800 /*%< type 2 security disabled */
244 1.32 christos #define RES_NOALIASES 0x00001000 /*%< shuts off HOSTALIASES feature */
245 1.32 christos #define RES_USE_INET6 0x00002000 /*%< use/map IPv6 in gethostbyname() */
246 1.32 christos #define RES_ROTATE 0x00004000 /*%< rotate ns list after each query */
247 1.32 christos #define RES_NOCHECKNAME 0x00008000 /*%< do not check names for sanity. */
248 1.32 christos #define RES_KEEPTSIG 0x00010000 /*%< do not strip TSIG records */
249 1.32 christos #define RES_BLAST 0x00020000 /*%< blast all recursive servers */
250 1.34 christos #define RES_NSID 0x00040000 /*%< request name server ID */
251 1.32 christos #define RES_NOTLDQUERY 0x00100000 /*%< don't unqualified name as a tld */
252 1.32 christos #define RES_USE_DNSSEC 0x00200000 /*%< use DNSSEC using OK bit in OPT */
253 1.29 christos /* #define RES_DEBUG2 0x00400000 */ /* nslookup internal */
254 1.19 itojun /* KAME extensions: use higher bit to avoid conflict with ISC use */
255 1.32 christos #define RES_USE_DNAME 0x10000000 /*%< use DNAME */
256 1.32 christos #define RES_USE_EDNS0 0x40000000 /*%< use EDNS0 if configured */
257 1.32 christos #define RES_NO_NIBBLE2 0x80000000 /*%< disable alternate nibble lookup */
258 1.1 cgd
259 1.23 christos #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | \
260 1.41 christos RES_DNSRCH | RES_NO_NIBBLE2)
261 1.1 cgd
262 1.32 christos /*%
263 1.4 deraadt * Resolver "pfcode" values. Used by dig.
264 1.4 deraadt */
265 1.9 mrg #define RES_PRF_STATS 0x00000001
266 1.23 christos #define RES_PRF_UPDATE 0x00000002
267 1.9 mrg #define RES_PRF_CLASS 0x00000004
268 1.9 mrg #define RES_PRF_CMD 0x00000008
269 1.9 mrg #define RES_PRF_QUES 0x00000010
270 1.9 mrg #define RES_PRF_ANS 0x00000020
271 1.9 mrg #define RES_PRF_AUTH 0x00000040
272 1.9 mrg #define RES_PRF_ADD 0x00000080
273 1.9 mrg #define RES_PRF_HEAD1 0x00000100
274 1.9 mrg #define RES_PRF_HEAD2 0x00000200
275 1.9 mrg #define RES_PRF_TTLID 0x00000400
276 1.9 mrg #define RES_PRF_HEADX 0x00000800
277 1.9 mrg #define RES_PRF_QUERY 0x00001000
278 1.9 mrg #define RES_PRF_REPLY 0x00002000
279 1.23 christos #define RES_PRF_INIT 0x00004000
280 1.23 christos #define RES_PRF_TRUNC 0x00008000
281 1.23 christos /* 0x00010000 */
282 1.9 mrg
283 1.23 christos /* Things involving an internal (static) resolver context. */
284 1.23 christos __BEGIN_DECLS
285 1.23 christos extern struct __res_state *__res_get_state(void);
286 1.23 christos extern void __res_put_state(struct __res_state *);
287 1.23 christos
288 1.24 christos /*
289 1.24 christos * Source and Binary compatibility; _res will not work properly
290 1.24 christos * with multi-threaded programs.
291 1.24 christos */
292 1.24 christos extern struct __res_state *__res_state(void);
293 1.24 christos #define _res (*__res_state())
294 1.9 mrg
295 1.23 christos __END_DECLS
296 1.4 deraadt
297 1.23 christos #ifndef __BIND_NOSTATIC
298 1.23 christos #define fp_nquery __fp_nquery
299 1.23 christos #define fp_query __fp_query
300 1.23 christos #define hostalias __hostalias
301 1.23 christos #define p_query __p_query
302 1.23 christos #define res_close __res_close
303 1.23 christos #define res_isourserver __res_isourserver
304 1.34 christos #define res_opt __res_opt
305 1.25 christos #define res_querydomain __res_querydomain
306 1.23 christos #define res_send __res_send
307 1.23 christos #define res_sendsigned __res_sendsigned
308 1.10 mrg
309 1.35 christos #ifdef notdef
310 1.35 christos /* NetBSD protects these via weak symbols. */
311 1.35 christos #define res_init __res_init
312 1.35 christos #define res_query __res_query
313 1.35 christos #define res_mkquery __res_mkquery
314 1.35 christos #define dn_expand __dn_expand
315 1.35 christos #define res_search __res_search
316 1.35 christos #endif
317 1.35 christos
318 1.23 christos __BEGIN_DECLS
319 1.30 perry void fp_nquery(const u_char *, int, FILE *);
320 1.30 perry void fp_query(const u_char *, FILE *);
321 1.30 perry const char * hostalias(const char *);
322 1.30 perry void p_query(const u_char *);
323 1.30 perry void res_close(void);
324 1.30 perry int res_init(void);
325 1.30 perry int res_opt(int, u_char *, int, int);
326 1.30 perry int res_isourserver(const struct sockaddr_in *);
327 1.30 perry int res_mkquery(int, const char *, int, int, const u_char *,
328 1.30 perry int, const u_char *, u_char *, int);
329 1.30 perry int res_query(const char *, int, int, u_char *, int);
330 1.30 perry int res_querydomain(const char *, const char *, int, int,
331 1.30 perry u_char *, int);
332 1.30 perry int res_search(const char *, int, int, u_char *, int);
333 1.30 perry int res_send(const u_char *, int, u_char *, int);
334 1.30 perry int res_sendsigned(const u_char *, int, ns_tsig_key *,
335 1.30 perry u_char *, int);
336 1.23 christos __END_DECLS
337 1.18 itojun #endif
338 1.23 christos
339 1.23 christos #if !defined(SHARED_LIBBIND) || defined(LIB)
340 1.23 christos /*
341 1.23 christos * If libbind is a shared object (well, DLL anyway)
342 1.36 christos * these externs break the linker when resolv.h is
343 1.23 christos * included by a lib client (like named)
344 1.23 christos * Make them go away if a client is including this
345 1.23 christos *
346 1.23 christos */
347 1.23 christos extern const struct res_sym __p_key_syms[];
348 1.23 christos extern const struct res_sym __p_cert_syms[];
349 1.10 mrg extern const struct res_sym __p_class_syms[];
350 1.10 mrg extern const struct res_sym __p_type_syms[];
351 1.23 christos extern const struct res_sym __p_rcode_syms[];
352 1.23 christos #endif /* SHARED_LIBBIND */
353 1.1 cgd
354 1.23 christos #define b64_ntop __b64_ntop
355 1.23 christos #define b64_pton __b64_pton
356 1.23 christos #define dn_comp __dn_comp
357 1.23 christos #define dn_count_labels __dn_count_labels
358 1.23 christos #define dn_skipname __dn_skipname
359 1.23 christos #define fp_resstat __fp_resstat
360 1.23 christos #define loc_aton __loc_aton
361 1.23 christos #define loc_ntoa __loc_ntoa
362 1.23 christos #define p_cdname __p_cdname
363 1.23 christos #define p_cdnname __p_cdnname
364 1.23 christos #define p_class __p_class
365 1.23 christos #define p_fqname __p_fqname
366 1.23 christos #define p_fqnname __p_fqnname
367 1.23 christos #define p_option __p_option
368 1.23 christos #define p_secstodate __p_secstodate
369 1.23 christos #define p_section __p_section
370 1.23 christos #define p_time __p_time
371 1.23 christos #define p_type __p_type
372 1.23 christos #define p_rcode __p_rcode
373 1.23 christos #define p_sockun __p_sockun
374 1.23 christos #define putlong __putlong
375 1.23 christos #define putshort __putshort
376 1.38 christos #define res_check __res_check
377 1.23 christos #define res_dnok __res_dnok
378 1.23 christos #define res_findzonecut __res_findzonecut
379 1.23 christos #define res_findzonecut2 __res_findzonecut2
380 1.23 christos #define res_hnok __res_hnok
381 1.23 christos #define res_hostalias __res_hostalias
382 1.23 christos #define res_mailok __res_mailok
383 1.23 christos #define res_nameinquery __res_nameinquery
384 1.23 christos #define res_nclose __res_nclose
385 1.23 christos #define res_ninit __res_ninit
386 1.23 christos #define res_nmkquery __res_nmkquery
387 1.23 christos #define res_pquery __res_pquery
388 1.23 christos #define res_nquery __res_nquery
389 1.23 christos #define res_nquerydomain __res_nquerydomain
390 1.23 christos #define res_nsearch __res_nsearch
391 1.23 christos #define res_nsend __res_nsend
392 1.23 christos #define res_nsendsigned __res_nsendsigned
393 1.23 christos #define res_nisourserver __res_nisourserver
394 1.23 christos #define res_ownok __res_ownok
395 1.23 christos #define res_queriesmatch __res_queriesmatch
396 1.36 christos #define res_rndinit __res_rndinit
397 1.23 christos #define res_randomid __res_randomid
398 1.36 christos #define res_nrandomid __res_nrandomid
399 1.23 christos #define sym_ntop __sym_ntop
400 1.23 christos #define sym_ntos __sym_ntos
401 1.23 christos #define sym_ston __sym_ston
402 1.23 christos #define res_nopt __res_nopt
403 1.34 christos #define res_nopt_rdata __res_nopt_rdata
404 1.23 christos #define res_ndestroy __res_ndestroy
405 1.23 christos #define res_nametoclass __res_nametoclass
406 1.23 christos #define res_nametotype __res_nametotype
407 1.23 christos #define res_setservers __res_setservers
408 1.23 christos #define res_getservers __res_getservers
409 1.23 christos #define res_buildprotolist __res_buildprotolist
410 1.23 christos #define res_destroyprotolist __res_destroyprotolist
411 1.23 christos #define res_destroyservicelist __res_destroyservicelist
412 1.23 christos #define res_get_nibblesuffix __res_get_nibblesuffix
413 1.23 christos #define res_get_nibblesuffix2 __res_get_nibblesuffix2
414 1.23 christos #define res_ourserver_p __res_ourserver_p
415 1.23 christos #define res_protocolname __res_protocolname
416 1.23 christos #define res_protocolnumber __res_protocolnumber
417 1.23 christos #define res_send_setqhook __res_send_setqhook
418 1.23 christos #define res_send_setrhook __res_send_setrhook
419 1.23 christos #define res_servicename __res_servicename
420 1.23 christos #define res_servicenumber __res_servicenumber
421 1.1 cgd __BEGIN_DECLS
422 1.30 perry int res_hnok(const char *);
423 1.30 perry int res_ownok(const char *);
424 1.30 perry int res_mailok(const char *);
425 1.38 christos struct timespec;
426 1.38 christos int res_check(res_state, struct timespec *);
427 1.30 perry int res_dnok(const char *);
428 1.30 perry int sym_ston(const struct res_sym *, const char *, int *);
429 1.30 perry const char * sym_ntos(const struct res_sym *, int, int *);
430 1.30 perry const char * sym_ntop(const struct res_sym *, int, int *);
431 1.30 perry int b64_ntop(u_char const *, size_t, char *, size_t);
432 1.30 perry int b64_pton(char const *, u_char *, size_t);
433 1.30 perry int loc_aton(const char *, u_char *);
434 1.30 perry const char * loc_ntoa(const u_char *, char *);
435 1.30 perry int dn_skipname(const u_char *, const u_char *);
436 1.31 perry void putlong(uint32_t, u_char *);
437 1.31 perry void putshort(uint16_t, u_char *);
438 1.23 christos #ifndef __ultrix__
439 1.31 perry uint16_t _getshort(const u_char *);
440 1.31 perry uint32_t _getlong(const u_char *);
441 1.23 christos #endif
442 1.30 perry const char * p_class(int);
443 1.31 perry const char * p_time(uint32_t);
444 1.30 perry const char * p_type(int);
445 1.30 perry const char * p_rcode(int);
446 1.30 perry const char * p_sockun(union res_sockaddr_union, char *, size_t);
447 1.30 perry const u_char * p_cdnname(const u_char *, const u_char *, int, FILE *);
448 1.30 perry const u_char * p_cdname(const u_char *, const u_char *, FILE *);
449 1.30 perry const u_char * p_fqnname(const u_char *, const u_char *,
450 1.30 perry int, char *, int);
451 1.30 perry const u_char * p_fqname(const u_char *, const u_char *, FILE *);
452 1.30 perry const char * p_option(u_long);
453 1.30 perry char * p_secstodate(u_long);
454 1.30 perry int dn_count_labels(const char *);
455 1.30 perry int dn_comp(const char *, u_char *, int, u_char **, u_char **);
456 1.30 perry int dn_expand(const u_char *, const u_char *, const u_char *,
457 1.30 perry char *, int);
458 1.36 christos void res_rndinit(res_state);
459 1.30 perry u_int res_randomid(void);
460 1.36 christos u_int res_nrandomid(res_state);
461 1.30 perry int res_nameinquery(const char *, int, int, const u_char *,
462 1.30 perry const u_char *);
463 1.30 perry int res_queriesmatch(const u_char *, const u_char *,
464 1.30 perry const u_char *, const u_char *);
465 1.30 perry const char * p_section(int, int);
466 1.23 christos /* Things involving a resolver context. */
467 1.30 perry int res_ninit(res_state);
468 1.30 perry int res_nisourserver(const res_state, const struct sockaddr_in *);
469 1.30 perry void fp_resstat(const res_state, FILE *);
470 1.30 perry void res_pquery(const res_state, const u_char *, int, FILE *);
471 1.30 perry const char * res_hostalias(const res_state, const char *, char *, size_t);
472 1.30 perry int res_nquery(res_state, const char *, int, int, u_char *, int);
473 1.30 perry int res_nsearch(res_state, const char *, int, int, u_char *, int);
474 1.30 perry int res_nquerydomain(res_state, const char *, const char *,
475 1.30 perry int, int, u_char *, int);
476 1.30 perry int res_nmkquery(res_state, int, const char *, int, int,
477 1.23 christos const u_char *, int, const u_char *,
478 1.30 perry u_char *, int);
479 1.30 perry int res_nsend(res_state, const u_char *, int, u_char *, int);
480 1.30 perry int res_nsendsigned(res_state, const u_char *, int,
481 1.30 perry ns_tsig_key *, u_char *, int);
482 1.30 perry int res_findzonecut(res_state, const char *, ns_class, int,
483 1.30 perry char *, size_t, struct in_addr *, int);
484 1.30 perry int res_findzonecut2(res_state, const char *, ns_class, int,
485 1.23 christos char *, size_t,
486 1.30 perry union res_sockaddr_union *, int);
487 1.30 perry void res_nclose(res_state);
488 1.30 perry int res_nopt(res_state, int, u_char *, int, int);
489 1.34 christos int res_nopt_rdata(res_state, int, u_char *, int, u_char *,
490 1.34 christos u_short, u_short, u_char *);
491 1.30 perry void res_send_setqhook(res_send_qhook);
492 1.30 perry void res_send_setrhook(res_send_rhook);
493 1.30 perry int __res_vinit(res_state, int);
494 1.30 perry void res_destroyservicelist(void);
495 1.31 perry const char * res_servicename(uint16_t, const char *);
496 1.30 perry const char * res_protocolname(int);
497 1.30 perry void res_destroyprotolist(void);
498 1.30 perry void res_buildprotolist(void);
499 1.30 perry const char * res_get_nibblesuffix(res_state);
500 1.30 perry const char * res_get_nibblesuffix2(res_state);
501 1.30 perry void res_ndestroy(res_state);
502 1.31 perry uint16_t res_nametoclass(const char *, int *);
503 1.31 perry uint16_t res_nametotype(const char *, int *);
504 1.30 perry void res_setservers(res_state,
505 1.30 perry const union res_sockaddr_union *, int);
506 1.30 perry int res_getservers(res_state,
507 1.30 perry union res_sockaddr_union *, int);
508 1.1 cgd __END_DECLS
509 1.1 cgd
510 1.1 cgd #endif /* !_RESOLV_H_ */
511