17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate  * Copyright(c)	1983,	1989
297c478bd9Sstevel@tonic-gate  *    The Regents of the University of California.  All rights reserved.
307c478bd9Sstevel@tonic-gate  *
317c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
327c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
337c478bd9Sstevel@tonic-gate  * are met:
347c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
357c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
367c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
377c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
387c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
397c478bd9Sstevel@tonic-gate  * 3. All advertising materials mentioning features or use of this software
407c478bd9Sstevel@tonic-gate  *    must display the following acknowledgement:
41*6e270ca8SMarcel Telka  *	This product includes software developed by the University of
42*6e270ca8SMarcel Telka  *	California, Berkeley and its contributors.
437c478bd9Sstevel@tonic-gate  * 4. Neither the name of the University nor the names of its contributors
447c478bd9Sstevel@tonic-gate  *    may be used to endorse or promote products derived from this software
457c478bd9Sstevel@tonic-gate  *    without specific prior written permission.
467c478bd9Sstevel@tonic-gate  *
477c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
487c478bd9Sstevel@tonic-gate  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
497c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
507c478bd9Sstevel@tonic-gate  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
517c478bd9Sstevel@tonic-gate  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
527c478bd9Sstevel@tonic-gate  * DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
537c478bd9Sstevel@tonic-gate  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
547c478bd9Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
557c478bd9Sstevel@tonic-gate  * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
567c478bd9Sstevel@tonic-gate  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
577c478bd9Sstevel@tonic-gate  * SUCH DAMAGE.
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate /*
617c478bd9Sstevel@tonic-gate  *      from nameser.h	8.1 (Berkeley) 6/2/93
627c478bd9Sstevel@tonic-gate  *	$Id: nameser_compat.h,v 8.15 2002/07/17 07:01:02 marka Exp $
637c478bd9Sstevel@tonic-gate  */
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate #ifndef _ARPA_NAMESER_COMPAT_H
667c478bd9Sstevel@tonic-gate #define	_ARPA_NAMESER_COMPAT_H
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
697c478bd9Sstevel@tonic-gate extern "C" {
707c478bd9Sstevel@tonic-gate #endif
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate #define	__BIND		19950621	/* (DEAD) interface version stamp. */
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate #ifndef BYTE_ORDER
757c478bd9Sstevel@tonic-gate #if (BSD >= 199103)
767c478bd9Sstevel@tonic-gate #include <machine/endian.h>
777c478bd9Sstevel@tonic-gate #else
787c478bd9Sstevel@tonic-gate #ifdef linux
797c478bd9Sstevel@tonic-gate #include <endian.h>
807c478bd9Sstevel@tonic-gate #else
817c478bd9Sstevel@tonic-gate #define	LITTLE_ENDIAN	1234	/* least-significant byte first (vax, pc) */
827c478bd9Sstevel@tonic-gate #define	BIG_ENDIAN	4321	/* most-significant byte first (IBM, net) */
837c478bd9Sstevel@tonic-gate #define	PDP_ENDIAN	3412	/* LSB first in word, MSW first in long (pdp) */
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate #if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
86c2e7b48dSkalai 	defined(__i386) || defined(__amd64) || \
877c478bd9Sstevel@tonic-gate 	defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
887c478bd9Sstevel@tonic-gate 	defined(__alpha__) || defined(__alpha) || \
897c478bd9Sstevel@tonic-gate 	(defined(__Lynx__) && defined(__x86__))
907c478bd9Sstevel@tonic-gate #define	BYTE_ORDER	LITTLE_ENDIAN
917c478bd9Sstevel@tonic-gate #endif
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
947c478bd9Sstevel@tonic-gate     defined(__sparc) || \
957c478bd9Sstevel@tonic-gate     defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
967c478bd9Sstevel@tonic-gate     defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
977c478bd9Sstevel@tonic-gate     defined(apollo) || defined(__convex__) || defined(_CRAY) || \
987c478bd9Sstevel@tonic-gate     defined(__hppa) || defined(__hp9000) || \
997c478bd9Sstevel@tonic-gate     defined(__hp9000s300) || defined(__hp9000s700) || \
1007c478bd9Sstevel@tonic-gate     defined(__hp3000s900) || defined(MPE) || \
1017c478bd9Sstevel@tonic-gate     defined(BIT_ZERO_ON_LEFT) || defined(m68k) || \
1027c478bd9Sstevel@tonic-gate 	(defined(__Lynx__) && \
1037c478bd9Sstevel@tonic-gate 	(defined(__68k__) || defined(__sparc__) || defined(__powerpc__)))
1047c478bd9Sstevel@tonic-gate #define	BYTE_ORDER	BIG_ENDIAN
1057c478bd9Sstevel@tonic-gate #endif
1067c478bd9Sstevel@tonic-gate #endif /* linux */
1077c478bd9Sstevel@tonic-gate #endif /* BSD */
1087c478bd9Sstevel@tonic-gate #endif /* BYTE_ORDER */
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #if !defined(BYTE_ORDER) || \
1115566946dSIgor Pashev 	((BYTE_ORDER != BIG_ENDIAN) && (BYTE_ORDER != LITTLE_ENDIAN) && \
1125566946dSIgor Pashev 	(BYTE_ORDER != PDP_ENDIAN))
1135566946dSIgor Pashev /*
1145566946dSIgor Pashev  * you must determine what the correct bit order is for
1155566946dSIgor Pashev  * your compiler - the next line is an intentional error
1165566946dSIgor Pashev  * which will force your compiles to bomb until you fix
1175566946dSIgor Pashev  * the above macros.
1185566946dSIgor Pashev  */
1195566946dSIgor Pashev #error "Undefined or invalid BYTE_ORDER";
1207c478bd9Sstevel@tonic-gate #endif
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate /*
1237c478bd9Sstevel@tonic-gate  * Structure for query header.  The order of the fields is machine- and
1247c478bd9Sstevel@tonic-gate  * compiler-dependent, depending on the byte/bit order and the layout
1257c478bd9Sstevel@tonic-gate  * of bit fields.  We use bit fields only in int variables, as this
1267c478bd9Sstevel@tonic-gate  * is all ANSI requires.  This requires a somewhat confusing rearrangement.
1277c478bd9Sstevel@tonic-gate  */
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate typedef struct {
1307c478bd9Sstevel@tonic-gate 	unsigned	id :16;		/* query identification number */
1317c478bd9Sstevel@tonic-gate #if BYTE_ORDER == BIG_ENDIAN
1327c478bd9Sstevel@tonic-gate 			/* fields in third byte */
1337c478bd9Sstevel@tonic-gate 	unsigned	qr: 1;		/* response flag */
1347c478bd9Sstevel@tonic-gate 	unsigned	opcode: 4;	/* purpose of message */
1357c478bd9Sstevel@tonic-gate 	unsigned	aa: 1;		/* authoritive answer */
1367c478bd9Sstevel@tonic-gate 	unsigned	tc: 1;		/* truncated message */
1377c478bd9Sstevel@tonic-gate 	unsigned	rd: 1;		/* recursion desired */
1387c478bd9Sstevel@tonic-gate 			/* fields in fourth byte */
1397c478bd9Sstevel@tonic-gate 	unsigned	ra: 1;		/* recursion available */
1407c478bd9Sstevel@tonic-gate 	unsigned	unused :1;	/* unused bits (MBZ as of 4.9.3a3) */
1417c478bd9Sstevel@tonic-gate 	unsigned	ad: 1;		/* authentic data from named */
1427c478bd9Sstevel@tonic-gate 	unsigned	cd: 1;		/* checking disabled by resolver */
1437c478bd9Sstevel@tonic-gate 	unsigned	rcode :4;	/* response code */
1447c478bd9Sstevel@tonic-gate #endif
1457c478bd9Sstevel@tonic-gate #if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
1467c478bd9Sstevel@tonic-gate 			/* fields in third byte */
1477c478bd9Sstevel@tonic-gate 	unsigned	rd :1;		/* recursion desired */
1487c478bd9Sstevel@tonic-gate 	unsigned	tc :1;		/* truncated message */
1497c478bd9Sstevel@tonic-gate 	unsigned	aa :1;		/* authoritive answer */
1507c478bd9Sstevel@tonic-gate 	unsigned	opcode :4;	/* purpose of message */
1517c478bd9Sstevel@tonic-gate 	unsigned	qr :1;		/* response flag */
1527c478bd9Sstevel@tonic-gate 			/* fields in fourth byte */
1537c478bd9Sstevel@tonic-gate 	unsigned	rcode :4;	/* response code */
1547c478bd9Sstevel@tonic-gate 	unsigned	cd: 1;		/* checking disabled by resolver */
1557c478bd9Sstevel@tonic-gate 	unsigned	ad: 1;		/* authentic data from named */
1567c478bd9Sstevel@tonic-gate 	unsigned	unused :1;	/* unused bits (MBZ as of 4.9.3a3) */
1577c478bd9Sstevel@tonic-gate 	unsigned	ra :1;		/* recursion available */
1587c478bd9Sstevel@tonic-gate #endif
1597c478bd9Sstevel@tonic-gate 			/* remaining bytes */
1607c478bd9Sstevel@tonic-gate 	unsigned	qdcount :16;	/* number of question entries */
1617c478bd9Sstevel@tonic-gate 	unsigned	ancount :16;	/* number of answer entries */
1627c478bd9Sstevel@tonic-gate 	unsigned	nscount :16;	/* number of authority entries */
1637c478bd9Sstevel@tonic-gate 	unsigned	arcount :16;	/* number of resource entries */
1647c478bd9Sstevel@tonic-gate } HEADER;
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate #define	PACKETSZ	NS_PACKETSZ
1677c478bd9Sstevel@tonic-gate #define	MAXDNAME	NS_MAXDNAME
1687c478bd9Sstevel@tonic-gate #define	MAXCDNAME	NS_MAXCDNAME
1697c478bd9Sstevel@tonic-gate #define	MAXLABEL	NS_MAXLABEL
1707c478bd9Sstevel@tonic-gate #define	HFIXEDSZ	NS_HFIXEDSZ
1717c478bd9Sstevel@tonic-gate #define	QFIXEDSZ	NS_QFIXEDSZ
1727c478bd9Sstevel@tonic-gate #define	RRFIXEDSZ	NS_RRFIXEDSZ
1737c478bd9Sstevel@tonic-gate #define	INT32SZ		NS_INT32SZ
1747c478bd9Sstevel@tonic-gate #define	INT16SZ		NS_INT16SZ
1757c478bd9Sstevel@tonic-gate #define	INT8SZ		NS_INT8SZ
1767c478bd9Sstevel@tonic-gate #define	INADDRSZ	NS_INADDRSZ
1777c478bd9Sstevel@tonic-gate #define	IN6ADDRSZ	NS_IN6ADDRSZ
1787c478bd9Sstevel@tonic-gate #define	INDIR_MASK	NS_CMPRSFLGS
1797c478bd9Sstevel@tonic-gate #define	NAMESERVER_PORT	NS_DEFAULTPORT
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate #define	S_ZONE		ns_s_zn
1827c478bd9Sstevel@tonic-gate #define	S_PREREQ	ns_s_pr
1837c478bd9Sstevel@tonic-gate #define	S_UPDATE	ns_s_ud
1847c478bd9Sstevel@tonic-gate #define	S_ADDT		ns_s_ar
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate #define	QUERY		ns_o_query
1877c478bd9Sstevel@tonic-gate #define	IQUERY		ns_o_iquery
1887c478bd9Sstevel@tonic-gate #define	STATUS		ns_o_status
1897c478bd9Sstevel@tonic-gate #define	NS_NOTIFY_OP	ns_o_notify
1907c478bd9Sstevel@tonic-gate #define	NS_UPDATE_OP	ns_o_update
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate #define	NOERROR		ns_r_noerror
1937c478bd9Sstevel@tonic-gate #define	FORMERR		ns_r_formerr
1947c478bd9Sstevel@tonic-gate #define	SERVFAIL	ns_r_servfail
1957c478bd9Sstevel@tonic-gate #define	NXDOMAIN	ns_r_nxdomain
1967c478bd9Sstevel@tonic-gate #define	NOTIMP		ns_r_notimpl
1977c478bd9Sstevel@tonic-gate #define	REFUSED		ns_r_refused
1987c478bd9Sstevel@tonic-gate #define	YXDOMAIN	ns_r_yxdomain
1997c478bd9Sstevel@tonic-gate #define	YXRRSET		ns_r_yxrrset
2007c478bd9Sstevel@tonic-gate #define	NXRRSET		ns_r_nxrrset
2017c478bd9Sstevel@tonic-gate #define	NOTAUTH		ns_r_notauth
2027c478bd9Sstevel@tonic-gate #define	NOTZONE		ns_r_notzone
2037c478bd9Sstevel@tonic-gate /* #define	BADSIG		ns_r_badsig */
2047c478bd9Sstevel@tonic-gate /* #define	BADKEY		ns_r_badkey */
2057c478bd9Sstevel@tonic-gate /* #define	BADTIME		ns_r_badtime */
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate #define	DELETE		ns_uop_delete
2087c478bd9Sstevel@tonic-gate #ifndef	ADD
2097c478bd9Sstevel@tonic-gate #define	ADD		ns_uop_add
2107c478bd9Sstevel@tonic-gate #endif
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate #define	T_A		ns_t_a
2137c478bd9Sstevel@tonic-gate #define	T_NS		ns_t_ns
2147c478bd9Sstevel@tonic-gate #define	T_MD		ns_t_md
2157c478bd9Sstevel@tonic-gate #define	T_MF		ns_t_mf
2167c478bd9Sstevel@tonic-gate #define	T_CNAME		ns_t_cname
2177c478bd9Sstevel@tonic-gate #define	T_SOA		ns_t_soa
2187c478bd9Sstevel@tonic-gate #define	T_MB		ns_t_mb
2197c478bd9Sstevel@tonic-gate #define	T_MG		ns_t_mg
2207c478bd9Sstevel@tonic-gate #define	T_MR		ns_t_mr
2217c478bd9Sstevel@tonic-gate #define	T_NULL		ns_t_null
2227c478bd9Sstevel@tonic-gate #define	T_WKS		ns_t_wks
2237c478bd9Sstevel@tonic-gate #define	T_PTR		ns_t_ptr
2247c478bd9Sstevel@tonic-gate #define	T_HINFO		ns_t_hinfo
2257c478bd9Sstevel@tonic-gate #define	T_MINFO		ns_t_minfo
2267c478bd9Sstevel@tonic-gate #define	T_MX		ns_t_mx
2277c478bd9Sstevel@tonic-gate #define	T_TXT		ns_t_txt
2287c478bd9Sstevel@tonic-gate #define	T_RP		ns_t_rp
2297c478bd9Sstevel@tonic-gate #define	T_AFSDB		ns_t_afsdb
2307c478bd9Sstevel@tonic-gate #define	T_X25		ns_t_x25
2317c478bd9Sstevel@tonic-gate #define	T_ISDN		ns_t_isdn
2327c478bd9Sstevel@tonic-gate #define	T_RT		ns_t_rt
2337c478bd9Sstevel@tonic-gate #define	T_NSAP		ns_t_nsap
2347c478bd9Sstevel@tonic-gate #define	T_NSAP_PTR	ns_t_nsap_ptr
2357c478bd9Sstevel@tonic-gate #define	T_SIG		ns_t_sig
2367c478bd9Sstevel@tonic-gate #define	T_KEY		ns_t_key
2377c478bd9Sstevel@tonic-gate #define	T_PX		ns_t_px
2387c478bd9Sstevel@tonic-gate #define	T_GPOS		ns_t_gpos
2397c478bd9Sstevel@tonic-gate #define	T_AAAA		ns_t_aaaa
2407c478bd9Sstevel@tonic-gate #define	T_LOC		ns_t_loc
2417c478bd9Sstevel@tonic-gate #define	T_NXT		ns_t_nxt
2427c478bd9Sstevel@tonic-gate #define	T_EID		ns_t_eid
2437c478bd9Sstevel@tonic-gate #define	T_NIMLOC	ns_t_nimloc
2447c478bd9Sstevel@tonic-gate #define	T_SRV		ns_t_srv
2457c478bd9Sstevel@tonic-gate #define	T_ATMA		ns_t_atma
2467c478bd9Sstevel@tonic-gate #define	T_NAPTR		ns_t_naptr
2477c478bd9Sstevel@tonic-gate #define	T_A6		ns_t_a6
2487c478bd9Sstevel@tonic-gate #define	T_TSIG		ns_t_tsig
2497c478bd9Sstevel@tonic-gate #define	T_IXFR		ns_t_ixfr
2507c478bd9Sstevel@tonic-gate #define	T_AXFR		ns_t_axfr
2517c478bd9Sstevel@tonic-gate #define	T_MAILB		ns_t_mailb
2527c478bd9Sstevel@tonic-gate #define	T_MAILA		ns_t_maila
2537c478bd9Sstevel@tonic-gate #define	T_ANY		ns_t_any
2547c478bd9Sstevel@tonic-gate 
2557c478bd9Sstevel@tonic-gate #define	C_IN		ns_c_in
2567c478bd9Sstevel@tonic-gate #define	C_CHAOS		ns_c_chaos
2577c478bd9Sstevel@tonic-gate #define	C_HS		ns_c_hs
2587c478bd9Sstevel@tonic-gate /* BIND_UPDATE */
2597c478bd9Sstevel@tonic-gate #define	C_NONE		ns_c_none
2607c478bd9Sstevel@tonic-gate #define	C_ANY		ns_c_any
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate #define	GETSHORT		NS_GET16
2637c478bd9Sstevel@tonic-gate #define	GETLONG			NS_GET32
2647c478bd9Sstevel@tonic-gate #define	PUTSHORT		NS_PUT16
2657c478bd9Sstevel@tonic-gate #define	PUTLONG			NS_PUT32
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2687c478bd9Sstevel@tonic-gate }
2697c478bd9Sstevel@tonic-gate #endif
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate #endif	/* _ARPA_NAMESER_COMPAT_H */
272