xref: /titanic_53/usr/src/head/resolv.h (revision 9525b14bcdeb5b5f6f95ab27c2f48f18bd2ec829)
17c478bd9Sstevel@tonic-gate /*
2*9525b14bSRao Shoaib  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
37c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate  *
57c478bd9Sstevel@tonic-gate  * Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T
67c478bd9Sstevel@tonic-gate  * All Rights Reserved
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley
97c478bd9Sstevel@tonic-gate  * 4.3 BSD under license from the regents of the University of
107c478bd9Sstevel@tonic-gate  * California.
117c478bd9Sstevel@tonic-gate  */
127c478bd9Sstevel@tonic-gate 
137c478bd9Sstevel@tonic-gate /*
147c478bd9Sstevel@tonic-gate  * BIND 4.9.4:
157c478bd9Sstevel@tonic-gate  */
167c478bd9Sstevel@tonic-gate 
177c478bd9Sstevel@tonic-gate /*
187c478bd9Sstevel@tonic-gate  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software for any
217c478bd9Sstevel@tonic-gate  * purpose with or without fee is hereby granted, provided that the above
227c478bd9Sstevel@tonic-gate  * copyright notice and this permission notice appear in all copies, and that
237c478bd9Sstevel@tonic-gate  * the name of Digital Equipment Corporation not be used in advertising or
247c478bd9Sstevel@tonic-gate  * publicity pertaining to distribution of the document or software without
257c478bd9Sstevel@tonic-gate  * specific, written prior permission.
267c478bd9Sstevel@tonic-gate  *
277c478bd9Sstevel@tonic-gate  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
287c478bd9Sstevel@tonic-gate  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
297c478bd9Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
307c478bd9Sstevel@tonic-gate  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
317c478bd9Sstevel@tonic-gate  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
327c478bd9Sstevel@tonic-gate  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
337c478bd9Sstevel@tonic-gate  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
347c478bd9Sstevel@tonic-gate  * SOFTWARE.
357c478bd9Sstevel@tonic-gate  * --Copyright--
367c478bd9Sstevel@tonic-gate  *
377c478bd9Sstevel@tonic-gate  * End BIND 4.9.4
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * Copyright (c) 1983, 1987, 1989
427c478bd9Sstevel@tonic-gate  *    The Regents of the University of California.  All rights reserved.
437c478bd9Sstevel@tonic-gate  *
447c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
457c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
467c478bd9Sstevel@tonic-gate  * are met:
477c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
487c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
497c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
507c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
517c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
527c478bd9Sstevel@tonic-gate  * 3. All advertising materials mentioning features or use of this software
537c478bd9Sstevel@tonic-gate  *    must display the following acknowledgement:
547c478bd9Sstevel@tonic-gate  * 	This product includes software developed by the University of
557c478bd9Sstevel@tonic-gate  * 	California, Berkeley and its contributors.
567c478bd9Sstevel@tonic-gate  * 4. Neither the name of the University nor the names of its contributors
577c478bd9Sstevel@tonic-gate  *    may be used to endorse or promote products derived from this software
587c478bd9Sstevel@tonic-gate  *    without specific prior written permission.
597c478bd9Sstevel@tonic-gate  *
607c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
617c478bd9Sstevel@tonic-gate  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
627c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
637c478bd9Sstevel@tonic-gate  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
647c478bd9Sstevel@tonic-gate  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
657c478bd9Sstevel@tonic-gate  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
667c478bd9Sstevel@tonic-gate  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
677c478bd9Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
687c478bd9Sstevel@tonic-gate  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
697c478bd9Sstevel@tonic-gate  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
707c478bd9Sstevel@tonic-gate  * SUCH DAMAGE.
717c478bd9Sstevel@tonic-gate  */
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /*
747c478bd9Sstevel@tonic-gate  * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
757c478bd9Sstevel@tonic-gate  *
767c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software for any
777c478bd9Sstevel@tonic-gate  * purpose with or without fee is hereby granted, provided that the above
787c478bd9Sstevel@tonic-gate  * copyright notice and this permission notice appear in all copies.
797c478bd9Sstevel@tonic-gate  *
807c478bd9Sstevel@tonic-gate  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
817c478bd9Sstevel@tonic-gate  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
827c478bd9Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
837c478bd9Sstevel@tonic-gate  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
847c478bd9Sstevel@tonic-gate  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
857c478bd9Sstevel@tonic-gate  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
867c478bd9Sstevel@tonic-gate  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
877c478bd9Sstevel@tonic-gate  * SOFTWARE.
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /*
917c478bd9Sstevel@tonic-gate  *	@(#)resolv.h	8.1 (Berkeley) 6/2/93
927c478bd9Sstevel@tonic-gate  *	$Id: resolv.h,v 8.52 2003/04/29 02:27:03 marka Exp $
937c478bd9Sstevel@tonic-gate  */
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate #ifndef _RESOLV_H_
967c478bd9Sstevel@tonic-gate #define	_RESOLV_H_
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate #include <sys/param.h>
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate #include <stdio.h>
1017c478bd9Sstevel@tonic-gate #include <arpa/nameser.h>
1027c478bd9Sstevel@tonic-gate #include <sys/socket.h>
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1057c478bd9Sstevel@tonic-gate extern "C" {
1067c478bd9Sstevel@tonic-gate #endif
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate /*
1097c478bd9Sstevel@tonic-gate  * Revision information.  This is the release date in YYYYMMDD format.
1107c478bd9Sstevel@tonic-gate  * It can change every day so the right thing to do with it is use it
1117c478bd9Sstevel@tonic-gate  * in preprocessor commands such as "#if (__RES > 19931104)".  Do not
1127c478bd9Sstevel@tonic-gate  * compare for equality; rather, use it to determine whether your resolver
1137c478bd9Sstevel@tonic-gate  * is new enough to contain a certain feature.
1147c478bd9Sstevel@tonic-gate  */
1157c478bd9Sstevel@tonic-gate 
116*9525b14bSRao Shoaib #define	__RES	20090302
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate #define	RES_SET_H_ERRNO(r, x)	__h_errno_set(r, x)
1197c478bd9Sstevel@tonic-gate struct __res_state;					/* forward */
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate void __h_errno_set(struct __res_state *res, int err);
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate /*
1247c478bd9Sstevel@tonic-gate  * Resolver configuration file.
1257c478bd9Sstevel@tonic-gate  * Normally not present, but may contain the address of the
1267c478bd9Sstevel@tonic-gate  * initial name server(s) to query and the domain search list.
1277c478bd9Sstevel@tonic-gate  */
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate #ifndef _PATH_RESCONF
1307c478bd9Sstevel@tonic-gate #define	_PATH_RESCONF		"/etc/resolv.conf"
1317c478bd9Sstevel@tonic-gate #endif
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate #ifdef __STDC__
1347c478bd9Sstevel@tonic-gate #ifndef __P
1357c478bd9Sstevel@tonic-gate #define	__P(x)	x
1367c478bd9Sstevel@tonic-gate #endif
1377c478bd9Sstevel@tonic-gate #else
1387c478bd9Sstevel@tonic-gate #ifndef __P
1397c478bd9Sstevel@tonic-gate #define	__P(x)	()
1407c478bd9Sstevel@tonic-gate #endif
1417c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
1447c478bd9Sstevel@tonic-gate 	res_sendhookact;
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr * const *ns,
1477c478bd9Sstevel@tonic-gate 						const uchar_t **query,
1487c478bd9Sstevel@tonic-gate 						int *querylen,
1497c478bd9Sstevel@tonic-gate 						uchar_t *ans,
1507c478bd9Sstevel@tonic-gate 						int anssiz,
1517c478bd9Sstevel@tonic-gate 						int *resplen));
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr *ns,
1547c478bd9Sstevel@tonic-gate 						const uchar_t *query,
1557c478bd9Sstevel@tonic-gate 						int querylen,
1567c478bd9Sstevel@tonic-gate 						uchar_t *ans,
1577c478bd9Sstevel@tonic-gate 						int anssiz,
1587c478bd9Sstevel@tonic-gate 						int *resplen));
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate struct res_sym {
1617c478bd9Sstevel@tonic-gate 	int		number;	   /* Identifying number, like T_MX */
1627c478bd9Sstevel@tonic-gate 	const char 	*name;	   /* Its symbolic name, like "MX" */
1637c478bd9Sstevel@tonic-gate 	const char 	*humanname; /* Its fun name, like "mail exchanger" */
1647c478bd9Sstevel@tonic-gate };
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate /*
1677c478bd9Sstevel@tonic-gate  * Global defines and variables for resolver stub.
1687c478bd9Sstevel@tonic-gate  */
1697c478bd9Sstevel@tonic-gate /* ADDRSORT and MAXADDR retained for compatibility; not used */
1707c478bd9Sstevel@tonic-gate #define	ADDRSORT	1	/* enable the address-sorting option */
1717c478bd9Sstevel@tonic-gate #define	MAXADDR		10	/* max # addresses to sort by */
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate #define	MAXNS			3	/* max # name servers we'll track */
1747c478bd9Sstevel@tonic-gate #define	MAXDFLSRCH		3	/* # default domain levels to try */
1757c478bd9Sstevel@tonic-gate #define	MAXDNSRCH		6	/* max # domains in search path */
1767c478bd9Sstevel@tonic-gate #define	LOCALDOMAINPARTS	2	/* min levels in name that is "local" */
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate #define	RES_TIMEOUT		5	/* min. seconds between retries */
1797c478bd9Sstevel@tonic-gate #define	MAXRESOLVSORT		10	/* number of net to sort on */
1807c478bd9Sstevel@tonic-gate #define	RES_MAXNDOTS		15	/* should reflect bit field size */
1817c478bd9Sstevel@tonic-gate #define	RES_MAXRETRANS		30	/* only for resolv.conf/RES_OPTIONS */
1827c478bd9Sstevel@tonic-gate #define	RES_MAXRETRY		5	/* only for resolv.conf/RES_OPTIONS */
1837c478bd9Sstevel@tonic-gate #define	RES_DFLRETRY		2	/* Default #/tries. */
1847c478bd9Sstevel@tonic-gate #define	RES_MAXTIME		65535	/* Infinity, in milliseconds. */
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate struct __res_state_ext;
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate struct __res_state {
1897c478bd9Sstevel@tonic-gate 	int	retrans;		/* retransmission time interval */
1907c478bd9Sstevel@tonic-gate 	int	retry;			/* number of times to retransmit */
1917c478bd9Sstevel@tonic-gate #ifdef __sun
1927c478bd9Sstevel@tonic-gate 	uint_t	options;		/* option flags - see below. */
1937c478bd9Sstevel@tonic-gate #else
1947c478bd9Sstevel@tonic-gate 	ulong_t	options;		/* option flags - see below. */
1957c478bd9Sstevel@tonic-gate #endif
1967c478bd9Sstevel@tonic-gate 	int	nscount;		/* number of name servers */
1977c478bd9Sstevel@tonic-gate 	struct sockaddr_in
1987c478bd9Sstevel@tonic-gate 		nsaddr_list[MAXNS];	/* address of name server */
1997c478bd9Sstevel@tonic-gate #define	nsaddr	nsaddr_list[0]		/* for backward compatibility */
2007c478bd9Sstevel@tonic-gate 	ushort_t id;			/* current packet id */
2017c478bd9Sstevel@tonic-gate 	char	*dnsrch[MAXDNSRCH+1];	/* components of domain to search */
2027c478bd9Sstevel@tonic-gate 	char	defdname[256];		/* default domain (deprecated) */
2037c478bd9Sstevel@tonic-gate #ifdef __sun
2047c478bd9Sstevel@tonic-gate 	uint_t	pfcode;			/* RES_PRF_ flags - see below. */
2057c478bd9Sstevel@tonic-gate #else
2067c478bd9Sstevel@tonic-gate 	ulong_t	pfcode;			/* RES_PRF_ flags - see below. */
2077c478bd9Sstevel@tonic-gate #endif
2087c478bd9Sstevel@tonic-gate 	unsigned ndots:4;		/* threshold for initial abs. query */
2097c478bd9Sstevel@tonic-gate 	unsigned nsort:4;		/* number of elements in sort_list[] */
2107c478bd9Sstevel@tonic-gate 	char	unused[3];
2117c478bd9Sstevel@tonic-gate 	struct {
2127c478bd9Sstevel@tonic-gate 		struct in_addr	addr;
2137c478bd9Sstevel@tonic-gate 		unsigned int	mask;
2147c478bd9Sstevel@tonic-gate 	} sort_list[MAXRESOLVSORT];
2157c478bd9Sstevel@tonic-gate 	res_send_qhook qhook;		/* query hook */
2167c478bd9Sstevel@tonic-gate 	res_send_rhook rhook;		/* response hook */
2177c478bd9Sstevel@tonic-gate 	int		res_h_errno;	/* last one set for this context */
2187c478bd9Sstevel@tonic-gate 	int		_vcsock;	/* PRIVATE: for res_send VC i/o */
2197c478bd9Sstevel@tonic-gate 	uint_t	_flags;		/* PRIVATE: see below */
2207c478bd9Sstevel@tonic-gate 	uint_t	_pad;			/* make _u 64 bit aligned */
2217c478bd9Sstevel@tonic-gate 	union {
2227c478bd9Sstevel@tonic-gate 		/* On an 32-bit arch this means 512b total. */
2237c478bd9Sstevel@tonic-gate 		char	pad[72 - 4*sizeof (int) - 2*sizeof (void *)];
2247c478bd9Sstevel@tonic-gate 		struct {
2257c478bd9Sstevel@tonic-gate 			uint16_t		nscount;
2267c478bd9Sstevel@tonic-gate 			uint16_t		nstimes[MAXNS];	/* ms. */
2277c478bd9Sstevel@tonic-gate 			int			nssocks[MAXNS];
2287c478bd9Sstevel@tonic-gate 			struct __res_state_ext *ext;	/* extention for IPv6 */
229*9525b14bSRao Shoaib 			uchar_t	_rnd[16];	/* PRIVATE: random state */
2307c478bd9Sstevel@tonic-gate 		} _ext;
2317c478bd9Sstevel@tonic-gate 	} _u;
2327c478bd9Sstevel@tonic-gate };
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate typedef	struct __res_state	*res_state;
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate union res_sockaddr_union {
2377c478bd9Sstevel@tonic-gate 	struct sockaddr_in	sin;
2387c478bd9Sstevel@tonic-gate #ifdef IN6ADDR_ANY_INIT
2397c478bd9Sstevel@tonic-gate 	struct sockaddr_in6	sin6;
2407c478bd9Sstevel@tonic-gate #endif
2417c478bd9Sstevel@tonic-gate #ifdef ISC_ALIGN64
2427c478bd9Sstevel@tonic-gate 	int64_t			__align64;	/* 64bit alignment */
2437c478bd9Sstevel@tonic-gate #else
2447c478bd9Sstevel@tonic-gate 	int32_t			__align32;	/* 32bit alignment */
2457c478bd9Sstevel@tonic-gate #endif
2467c478bd9Sstevel@tonic-gate 	char			__space[128];   /* max size */
2477c478bd9Sstevel@tonic-gate };
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate /*
2507c478bd9Sstevel@tonic-gate  * Resolver flags (used to be discrete per-module statics ints).
2517c478bd9Sstevel@tonic-gate  */
2527c478bd9Sstevel@tonic-gate #define	RES_F_VC	0x00000001	/* socket is TCP */
2537c478bd9Sstevel@tonic-gate #define	RES_F_CONN	0x00000002	/* socket is connected */
2547c478bd9Sstevel@tonic-gate #define	RES_F_EDNS0ERR	0x00000004	/* EDNS0 caused errors */
2557c478bd9Sstevel@tonic-gate #define	RES_F__UNUSED	0x00000008	/* (unused) */
2567c478bd9Sstevel@tonic-gate #define	RES_F_LASTMASK	0x000000F0	/* ordinal server of last res_nsend */
2577c478bd9Sstevel@tonic-gate #define	RES_F_LASTSHIFT	4		/* bit position of LASTMASK "flag" */
2587c478bd9Sstevel@tonic-gate #define	RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT)
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate /* res_findzonecut2() options */
2617c478bd9Sstevel@tonic-gate #define	RES_EXHAUSTIVE	0x00000001	/* always do all queries */
2627c478bd9Sstevel@tonic-gate #define	RES_IPV4ONLY	0x00000002	/* IPv4 only */
2637c478bd9Sstevel@tonic-gate #define	RES_IPV6ONLY	0x00000004	/* IPv6 only */
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate /*
2667c478bd9Sstevel@tonic-gate  * Resolver options (keep these in synch with res_debug.c, please)
2677c478bd9Sstevel@tonic-gate  */
2687c478bd9Sstevel@tonic-gate #define	RES_INIT	0x00000001	/* address initialized */
2697c478bd9Sstevel@tonic-gate #define	RES_DEBUG	0x00000002	/* print debug messages */
2707c478bd9Sstevel@tonic-gate #define	RES_AAONLY	0x00000004	/* authoritative answers only (!IMPL) */
2717c478bd9Sstevel@tonic-gate #define	RES_USEVC	0x00000008	/* use virtual circuit */
2727c478bd9Sstevel@tonic-gate #define	RES_PRIMARY	0x00000010	/* query primary server only (!IMPL) */
2737c478bd9Sstevel@tonic-gate #define	RES_IGNTC	0x00000020	/* ignore trucation errors */
2747c478bd9Sstevel@tonic-gate #define	RES_RECURSE	0x00000040	/* recursion desired */
2757c478bd9Sstevel@tonic-gate #define	RES_DEFNAMES	0x00000080	/* use default domain name */
2767c478bd9Sstevel@tonic-gate #define	RES_STAYOPEN	0x00000100	/* Keep TCP socket open */
2777c478bd9Sstevel@tonic-gate #define	RES_DNSRCH	0x00000200	/* search up local domain tree */
2787c478bd9Sstevel@tonic-gate #define	RES_INSECURE1	0x00000400	/* type 1 security disabled */
2797c478bd9Sstevel@tonic-gate #define	RES_INSECURE2	0x00000800	/* type 2 security disabled */
2807c478bd9Sstevel@tonic-gate #define	RES_NOALIASES	0x00001000	/* shuts off HOSTALIASES feature */
2817c478bd9Sstevel@tonic-gate #define	RES_USE_INET6	0x00002000	/* use/map IPv6 in gethostbyname() */
2827c478bd9Sstevel@tonic-gate #define	RES_ROTATE	0x00004000	/* rotate ns list after each query */
2837c478bd9Sstevel@tonic-gate #define	RES_NOCHECKNAME	0x00008000	/* do not check names for sanity. */
2847c478bd9Sstevel@tonic-gate #define	RES_KEEPTSIG	0x00010000	/* do not strip TSIG records */
2857c478bd9Sstevel@tonic-gate #define	RES_BLAST	0x00020000	/* blast all recursive servers */
2867c478bd9Sstevel@tonic-gate #define	RES_NO_NIBBLE	0x00040000	/* disable IPv6 nibble mode reverse */
2877c478bd9Sstevel@tonic-gate #define	RES_NO_BITSTRING 0x00080000	/* disable IPv6 bitstring mode revrse */
2887c478bd9Sstevel@tonic-gate #define	RES_NOTLDQUERY	0x00100000	/* don't unqualified name as a tld */
2897c478bd9Sstevel@tonic-gate #define	RES_USE_DNSSEC	0x00200000	/* use DNSSEC using OK bit in OPT */
2907c478bd9Sstevel@tonic-gate /* KAME extensions: use higher bit to avoid conflict with ISC use */
2917c478bd9Sstevel@tonic-gate #define	RES_USE_DNAME	0x10000000	/* use DNAME */
2927c478bd9Sstevel@tonic-gate #define	RES_USE_EDNS0	0x40000000	/* use EDNS0 if configured */
2937c478bd9Sstevel@tonic-gate #define	RES_NO_NIBBLE2	0x80000000	/* disable alternate nibble lookup */
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate #define	RES_DEFAULT	(RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate /*
2987c478bd9Sstevel@tonic-gate  * Resolver "pfcode" values.  Used by dig.
2997c478bd9Sstevel@tonic-gate  */
3007c478bd9Sstevel@tonic-gate #define	RES_PRF_STATS	0x00000001
3017c478bd9Sstevel@tonic-gate #define	RES_PRF_UPDATE	0x00000002
3027c478bd9Sstevel@tonic-gate #define	RES_PRF_CLASS   0x00000004
3037c478bd9Sstevel@tonic-gate #define	RES_PRF_CMD		0x00000008
3047c478bd9Sstevel@tonic-gate #define	RES_PRF_QUES	0x00000010
3057c478bd9Sstevel@tonic-gate #define	RES_PRF_ANS		0x00000020
3067c478bd9Sstevel@tonic-gate #define	RES_PRF_AUTH	0x00000040
3077c478bd9Sstevel@tonic-gate #define	RES_PRF_ADD		0x00000080
3087c478bd9Sstevel@tonic-gate #define	RES_PRF_HEAD1	0x00000100
3097c478bd9Sstevel@tonic-gate #define	RES_PRF_HEAD2	0x00000200
3107c478bd9Sstevel@tonic-gate #define	RES_PRF_TTLID	0x00000400
3117c478bd9Sstevel@tonic-gate #define	RES_PRF_HEADX	0x00000800
3127c478bd9Sstevel@tonic-gate #define	RES_PRF_QUERY	0x00001000
3137c478bd9Sstevel@tonic-gate #define	RES_PRF_REPLY	0x00002000
3147c478bd9Sstevel@tonic-gate #define	RES_PRF_INIT	0x00004000
3157c478bd9Sstevel@tonic-gate #define	RES_PRF_TRUNC	0x00008000
3167c478bd9Sstevel@tonic-gate /*			0x00010000	*/
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate /* Things involving an internal (static) resolver context. */
3197c478bd9Sstevel@tonic-gate #ifdef _REENTRANT
3207c478bd9Sstevel@tonic-gate extern struct __res_state *__res_state(void);
3217c478bd9Sstevel@tonic-gate #define	_res (*__res_state())
3227c478bd9Sstevel@tonic-gate #else
3237c478bd9Sstevel@tonic-gate #ifndef __BIND_NOSTATIC
3247c478bd9Sstevel@tonic-gate extern struct __res_state _res;
3257c478bd9Sstevel@tonic-gate #endif
3267c478bd9Sstevel@tonic-gate #endif
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate #ifndef __BIND_NOSTATIC
3297c478bd9Sstevel@tonic-gate void		fp_nquery __P((const uchar_t *, int, FILE *));
3307c478bd9Sstevel@tonic-gate void		fp_query __P((const uchar_t *, FILE *));
3317c478bd9Sstevel@tonic-gate const char *hostalias __P((const char *));
3327c478bd9Sstevel@tonic-gate void		p_query __P((const uchar_t *));
3337c478bd9Sstevel@tonic-gate void		res_close __P((void));
3347c478bd9Sstevel@tonic-gate int		res_init __P((void));
3357c478bd9Sstevel@tonic-gate int		res_isourserver __P((const struct sockaddr_in *));
3367c478bd9Sstevel@tonic-gate int		res_mkquery __P((int, const char *, int, int, const uchar_t *,
3377c478bd9Sstevel@tonic-gate 				int, const uchar_t *, uchar_t *, int));
3387c478bd9Sstevel@tonic-gate int		res_query	__P((const char *, int, int, uchar_t *, int));
3397c478bd9Sstevel@tonic-gate int		res_querydomain __P((const char *, const char *, int, int,
3407c478bd9Sstevel@tonic-gate 				uchar_t *, int));
3417c478bd9Sstevel@tonic-gate int		res_search __P((const char *, int, int, uchar_t *, int));
3427c478bd9Sstevel@tonic-gate int		res_send __P((const uchar_t *, int, uchar_t *, int));
3437c478bd9Sstevel@tonic-gate int		res_sendsigned __P((const uchar_t *, int, ns_tsig_key *,
3447c478bd9Sstevel@tonic-gate 				    uchar_t *, int));
3457c478bd9Sstevel@tonic-gate #endif	/* __BIND_NOSTATIC */
3467c478bd9Sstevel@tonic-gate 
3477c478bd9Sstevel@tonic-gate extern const struct res_sym __p_key_syms[];
3487c478bd9Sstevel@tonic-gate extern const struct res_sym __p_cert_syms[];
3497c478bd9Sstevel@tonic-gate extern const struct res_sym __p_class_syms[];
3507c478bd9Sstevel@tonic-gate extern const struct res_sym __p_type_syms[];
3517c478bd9Sstevel@tonic-gate extern const struct res_sym __p_rcode_syms[];
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate int		res_hnok __P((const char *));
3547c478bd9Sstevel@tonic-gate int		res_ownok __P((const char *));
3557c478bd9Sstevel@tonic-gate int		res_mailok __P((const char *));
3567c478bd9Sstevel@tonic-gate int		res_dnok __P((const char *));
3577c478bd9Sstevel@tonic-gate int		sym_ston __P((const struct res_sym *, const char *, int *));
3587c478bd9Sstevel@tonic-gate const char	*sym_ntos __P((const struct res_sym *, int, int *));
3597c478bd9Sstevel@tonic-gate const char	*sym_ntop __P((const struct res_sym *, int, int *));
3607c478bd9Sstevel@tonic-gate int		b64_ntop __P((uchar_t const *, size_t, char *, size_t));
3617c478bd9Sstevel@tonic-gate int		b64_pton __P((char const *, uchar_t *, size_t));
3627c478bd9Sstevel@tonic-gate int		loc_aton __P((const char *ascii, uchar_t *binary));
3637c478bd9Sstevel@tonic-gate const char	*loc_ntoa __P((const uchar_t *binary, char *ascii));
3647c478bd9Sstevel@tonic-gate int		dn_skipname __P((const uchar_t *, const uchar_t *));
3657c478bd9Sstevel@tonic-gate void		putlong __P((unsigned int, uchar_t *));
3667c478bd9Sstevel@tonic-gate void		putshort __P((unsigned short, uchar_t *));
3677c478bd9Sstevel@tonic-gate const char	*p_class __P((int));
3687c478bd9Sstevel@tonic-gate const char	*p_time __P((unsigned int));
3697c478bd9Sstevel@tonic-gate const char	*p_type __P((int));
3707c478bd9Sstevel@tonic-gate const char	*p_rcode __P((int));
3717c478bd9Sstevel@tonic-gate const char	*p_sockun __P((union res_sockaddr_union, char *, size_t));
3727c478bd9Sstevel@tonic-gate const uchar_t	*p_cdnname __P((const uchar_t *, const uchar_t *, int,
3737c478bd9Sstevel@tonic-gate 			FILE *));
3747c478bd9Sstevel@tonic-gate const uchar_t	*p_cdname __P((const uchar_t *, const uchar_t *, FILE *));
3757c478bd9Sstevel@tonic-gate const uchar_t	*p_fqnname __P((const uchar_t *cp, const uchar_t *msg,
3767c478bd9Sstevel@tonic-gate 			int, char *, int));
3777c478bd9Sstevel@tonic-gate const uchar_t	*p_fqname __P((const uchar_t *, const uchar_t *, FILE *));
3787c478bd9Sstevel@tonic-gate const char	*p_option __P((uint_t option));
3797c478bd9Sstevel@tonic-gate char		*p_secstodate __P((uint_t));
3807c478bd9Sstevel@tonic-gate int		dn_count_labels __P((const char *));
3817c478bd9Sstevel@tonic-gate int		dn_comp __P((const char *, uchar_t *, int,
3827c478bd9Sstevel@tonic-gate 				uchar_t **, uchar_t **));
3837c478bd9Sstevel@tonic-gate int		dn_expand __P((const uchar_t *, const uchar_t *,
3847c478bd9Sstevel@tonic-gate 			const uchar_t *, char *, int));
385*9525b14bSRao Shoaib void		res_rndinit __P((res_state));
3867c478bd9Sstevel@tonic-gate uint_t		res_randomid __P((void));
387*9525b14bSRao Shoaib uint_t		res_nrandomid __P((res_state));
3887c478bd9Sstevel@tonic-gate int		res_nameinquery __P((const char *, int, int,
3897c478bd9Sstevel@tonic-gate 				const uchar_t *, const uchar_t *));
3907c478bd9Sstevel@tonic-gate int		res_queriesmatch __P((const uchar_t *, const uchar_t *,
3917c478bd9Sstevel@tonic-gate 				const uchar_t *, const uchar_t *));
3927c478bd9Sstevel@tonic-gate const char	*p_section __P((int section, int opcode));
3937c478bd9Sstevel@tonic-gate 
3947c478bd9Sstevel@tonic-gate 
3957c478bd9Sstevel@tonic-gate /* Things involving a resolver context. */
3967c478bd9Sstevel@tonic-gate int		res_ninit __P((res_state));
3977c478bd9Sstevel@tonic-gate int		res_nisourserver __P((const res_state,
3987c478bd9Sstevel@tonic-gate 				const struct sockaddr_in *));
3997c478bd9Sstevel@tonic-gate void	fp_resstat __P((const res_state, FILE *));
4007c478bd9Sstevel@tonic-gate void	res_pquery	__P((const res_state, const uchar_t *, int, FILE *));
4017c478bd9Sstevel@tonic-gate const char	*res_hostalias __P((const res_state, const char *,
4027c478bd9Sstevel@tonic-gate 				char *, size_t));
4037c478bd9Sstevel@tonic-gate int		res_nquery __P((res_state,
4047c478bd9Sstevel@tonic-gate 				const char *, int, int, uchar_t *, int));
4057c478bd9Sstevel@tonic-gate int		res_nsearch __P((res_state, const char *, int,
4067c478bd9Sstevel@tonic-gate 				int, uchar_t *, int));
4077c478bd9Sstevel@tonic-gate int		res_nquerydomain __P((res_state,
4087c478bd9Sstevel@tonic-gate 				const char *, const char *, int, int,
4097c478bd9Sstevel@tonic-gate 				uchar_t *, int));
4107c478bd9Sstevel@tonic-gate int		res_nmkquery __P((res_state,
4117c478bd9Sstevel@tonic-gate 				int, const char *, int, int, const uchar_t *,
4127c478bd9Sstevel@tonic-gate 				int, const uchar_t *, uchar_t *, int));
4137c478bd9Sstevel@tonic-gate int		res_nsend __P((res_state, const uchar_t *, int, uchar_t *,
4147c478bd9Sstevel@tonic-gate 				int));
4157c478bd9Sstevel@tonic-gate int		res_nsendsigned __P((res_state, const uchar_t *, int,
4167c478bd9Sstevel@tonic-gate 				ns_tsig_key *, uchar_t *, int));
4177c478bd9Sstevel@tonic-gate int		res_findzonecut __P((res_state, const char *, ns_class, int,
4187c478bd9Sstevel@tonic-gate 				char *, size_t, struct in_addr *, int));
4197c478bd9Sstevel@tonic-gate int		res_findzonecut2 __P((res_state, const char *, ns_class, int,
4207c478bd9Sstevel@tonic-gate 				char *, size_t, union res_sockaddr_union *,
4217c478bd9Sstevel@tonic-gate 				int));
4227c478bd9Sstevel@tonic-gate void		res_nclose __P((res_state));
4237c478bd9Sstevel@tonic-gate int		res_nopt __P((res_state, int, uchar_t *, int, int));
424*9525b14bSRao Shoaib int		res_nopt_rdata __P((res_state, int, uchar_t *, int, uchar_t *,
425*9525b14bSRao Shoaib 				    ushort_t, ushort_t, uchar_t *));
4267c478bd9Sstevel@tonic-gate void		res_send_setqhook __P((res_send_qhook hook));
4277c478bd9Sstevel@tonic-gate void		res_send_setrhook __P((res_send_rhook hook));
4287c478bd9Sstevel@tonic-gate int		__res_vinit __P((res_state, int));
4297c478bd9Sstevel@tonic-gate void		res_destroyservicelist __P((void));
4307c478bd9Sstevel@tonic-gate const char 	*res_servicename __P((uint16_t port, const char *proto));
4317c478bd9Sstevel@tonic-gate const char 	*res_protocolname __P((int num));
4327c478bd9Sstevel@tonic-gate void		res_destroyprotolist __P((void));
4337c478bd9Sstevel@tonic-gate void		res_buildprotolist __P((void));
4347c478bd9Sstevel@tonic-gate const char 	*res_get_nibblesuffix __P((res_state));
4357c478bd9Sstevel@tonic-gate const char 	*res_get_nibblesuffix2 __P((res_state));
4367c478bd9Sstevel@tonic-gate void		res_ndestroy __P((res_state));
4377c478bd9Sstevel@tonic-gate uint16_t	res_nametoclass __P((const char *buf, int *success));
4387c478bd9Sstevel@tonic-gate uint16_t	res_nametotype __P((const char *buf, int *success));
4397c478bd9Sstevel@tonic-gate void		res_setservers __P((res_state,
4407c478bd9Sstevel@tonic-gate 				    const union res_sockaddr_union *, int));
4417c478bd9Sstevel@tonic-gate int		res_getservers __P((res_state,
4427c478bd9Sstevel@tonic-gate 				    union res_sockaddr_union *, int));
4437c478bd9Sstevel@tonic-gate 
4447c478bd9Sstevel@tonic-gate 
4457c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4467c478bd9Sstevel@tonic-gate }
4477c478bd9Sstevel@tonic-gate #endif
4487c478bd9Sstevel@tonic-gate 
4497c478bd9Sstevel@tonic-gate #endif /* !_RESOLV_H_ */
450