nameser_compat.h revision 1.6.18.1
11.6.18.1Smartin/* $NetBSD: nameser_compat.h,v 1.6.18.1 2020/11/29 11:25:31 martin Exp $ */ 21.1Schristos 31.1Schristos/* Copyright (c) 1983, 1989 41.1Schristos * The Regents of the University of California. All rights reserved. 51.1Schristos * 61.1Schristos * Redistribution and use in source and binary forms, with or without 71.1Schristos * modification, are permitted provided that the following conditions 81.1Schristos * are met: 91.1Schristos * 1. Redistributions of source code must retain the above copyright 101.1Schristos * notice, this list of conditions and the following disclaimer. 111.1Schristos * 2. Redistributions in binary form must reproduce the above copyright 121.1Schristos * notice, this list of conditions and the following disclaimer in the 131.1Schristos * documentation and/or other materials provided with the distribution. 141.6Schristos * 3. Neither the name of the University nor the names of its contributors 151.1Schristos * may be used to endorse or promote products derived from this software 161.1Schristos * without specific prior written permission. 171.1Schristos * 181.1Schristos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 191.1Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 201.1Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 211.1Schristos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 221.1Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 231.1Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 241.1Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 251.1Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 261.1Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 271.1Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 281.1Schristos * SUCH DAMAGE. 291.1Schristos */ 301.1Schristos 311.2Schristos/*% 321.1Schristos * from nameser.h 8.1 (Berkeley) 6/2/93 331.4Schristos * Id: nameser_compat.h,v 1.8 2006/05/19 02:33:40 marka Exp 341.1Schristos */ 351.1Schristos 361.1Schristos#ifndef _ARPA_NAMESER_COMPAT_ 371.1Schristos#define _ARPA_NAMESER_COMPAT_ 381.1Schristos 391.2Schristos#define __BIND 19950621 /*%< (DEAD) interface version stamp. */ 401.1Schristos 411.1Schristos#ifndef BYTE_ORDER 421.1Schristos#if (BSD >= 199103) 431.1Schristos# include <machine/endian.h> 441.1Schristos#else 451.1Schristos#ifdef __linux 461.1Schristos# include <endian.h> 471.1Schristos#else 481.2Schristos#define LITTLE_ENDIAN 1234 /*%< least-significant byte first (vax, pc) */ 491.2Schristos#define BIG_ENDIAN 4321 /*%< most-significant byte first (IBM, net) */ 501.2Schristos#define PDP_ENDIAN 3412 /*%< LSB first in word, MSW first in long (pdp) */ 511.1Schristos 521.1Schristos#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \ 531.1Schristos defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ 541.2Schristos defined(__i386__) || defined(__i386) || defined(__amd64__) || \ 551.2Schristos defined(__x86_64__) || defined(MIPSEL) || defined(_MIPSEL) || \ 561.2Schristos defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) || defined(__alpha) || \ 571.1Schristos (defined(__Lynx__) && defined(__x86__)) 581.1Schristos#define BYTE_ORDER LITTLE_ENDIAN 591.1Schristos#endif 601.1Schristos 611.1Schristos#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ 621.1Schristos defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ 631.1Schristos defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\ 641.1Schristos defined(apollo) || defined(__convex__) || defined(_CRAY) || \ 651.1Schristos defined(__hppa) || defined(__hp9000) || \ 661.1Schristos defined(__hp9000s300) || defined(__hp9000s700) || \ 671.1Schristos defined(__hp3000s900) || defined(__hpux) || defined(MPE) || \ 681.2Schristos defined (BIT_ZERO_ON_LEFT) || defined(m68k) || defined(__sparc) || \ 691.1Schristos (defined(__Lynx__) && \ 701.1Schristos (defined(__68k__) || defined(__sparc__) || defined(__powerpc__))) 711.1Schristos#define BYTE_ORDER BIG_ENDIAN 721.1Schristos#endif 731.1Schristos#endif /* __linux */ 741.1Schristos#endif /* BSD */ 751.1Schristos#endif /* BYTE_ORDER */ 761.1Schristos 771.1Schristos#if !defined(BYTE_ORDER) || \ 781.1Schristos (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \ 791.1Schristos BYTE_ORDER != PDP_ENDIAN) 801.1Schristos /* you must determine what the correct bit order is for 811.1Schristos * your compiler - the next line is an intentional error 821.1Schristos * which will force your compiles to bomb until you fix 831.1Schristos * the above macros. 841.1Schristos */ 851.1Schristos error "Undefined or invalid BYTE_ORDER"; 861.1Schristos#endif 871.1Schristos 881.2Schristos/*% 891.1Schristos * Structure for query header. The order of the fields is machine- and 901.1Schristos * compiler-dependent, depending on the byte/bit order and the layout 911.1Schristos * of bit fields. We use bit fields only in int variables, as this 921.1Schristos * is all ANSI requires. This requires a somewhat confusing rearrangement. 931.1Schristos */ 941.1Schristos 951.1Schristostypedef struct { 961.2Schristos unsigned id :16; /*%< query identification number */ 971.1Schristos#if BYTE_ORDER == BIG_ENDIAN 981.1Schristos /* fields in third byte */ 991.2Schristos unsigned qr: 1; /*%< response flag */ 1001.2Schristos unsigned opcode: 4; /*%< purpose of message */ 1011.2Schristos unsigned aa: 1; /*%< authoritive answer */ 1021.2Schristos unsigned tc: 1; /*%< truncated message */ 1031.2Schristos unsigned rd: 1; /*%< recursion desired */ 1041.1Schristos /* fields in fourth byte */ 1051.2Schristos unsigned ra: 1; /*%< recursion available */ 1061.2Schristos unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ 1071.2Schristos unsigned ad: 1; /*%< authentic data from named */ 1081.2Schristos unsigned cd: 1; /*%< checking disabled by resolver */ 1091.2Schristos unsigned rcode :4; /*%< response code */ 1101.1Schristos#endif 1111.1Schristos#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN 1121.1Schristos /* fields in third byte */ 1131.2Schristos unsigned rd :1; /*%< recursion desired */ 1141.2Schristos unsigned tc :1; /*%< truncated message */ 1151.2Schristos unsigned aa :1; /*%< authoritive answer */ 1161.2Schristos unsigned opcode :4; /*%< purpose of message */ 1171.2Schristos unsigned qr :1; /*%< response flag */ 1181.1Schristos /* fields in fourth byte */ 1191.2Schristos unsigned rcode :4; /*%< response code */ 1201.2Schristos unsigned cd: 1; /*%< checking disabled by resolver */ 1211.2Schristos unsigned ad: 1; /*%< authentic data from named */ 1221.2Schristos unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ 1231.2Schristos unsigned ra :1; /*%< recursion available */ 1241.1Schristos#endif 1251.1Schristos /* remaining bytes */ 1261.2Schristos unsigned qdcount :16; /*%< number of question entries */ 1271.2Schristos unsigned ancount :16; /*%< number of answer entries */ 1281.2Schristos unsigned nscount :16; /*%< number of authority entries */ 1291.2Schristos unsigned arcount :16; /*%< number of resource entries */ 1301.1Schristos} HEADER; 1311.1Schristos 1321.1Schristos#define PACKETSZ NS_PACKETSZ 1331.1Schristos#define MAXDNAME NS_MAXDNAME 1341.1Schristos#define MAXCDNAME NS_MAXCDNAME 1351.1Schristos#define MAXLABEL NS_MAXLABEL 1361.1Schristos#define HFIXEDSZ NS_HFIXEDSZ 1371.1Schristos#define QFIXEDSZ NS_QFIXEDSZ 1381.1Schristos#define RRFIXEDSZ NS_RRFIXEDSZ 1391.1Schristos#define INT32SZ NS_INT32SZ 1401.1Schristos#define INT16SZ NS_INT16SZ 1411.1Schristos#define INT8SZ NS_INT8SZ 1421.1Schristos#define INADDRSZ NS_INADDRSZ 1431.1Schristos#define IN6ADDRSZ NS_IN6ADDRSZ 1441.1Schristos#define INDIR_MASK NS_CMPRSFLGS 1451.1Schristos#define NAMESERVER_PORT NS_DEFAULTPORT 1461.1Schristos 1471.1Schristos#define S_ZONE ns_s_zn 1481.1Schristos#define S_PREREQ ns_s_pr 1491.1Schristos#define S_UPDATE ns_s_ud 1501.1Schristos#define S_ADDT ns_s_ar 1511.1Schristos 1521.1Schristos#define QUERY ns_o_query 1531.1Schristos#define IQUERY ns_o_iquery 1541.1Schristos#define STATUS ns_o_status 1551.1Schristos#define NS_NOTIFY_OP ns_o_notify 1561.1Schristos#define NS_UPDATE_OP ns_o_update 1571.1Schristos 1581.1Schristos#define NOERROR ns_r_noerror 1591.1Schristos#define FORMERR ns_r_formerr 1601.1Schristos#define SERVFAIL ns_r_servfail 1611.1Schristos#define NXDOMAIN ns_r_nxdomain 1621.1Schristos#define NOTIMP ns_r_notimpl 1631.1Schristos#define REFUSED ns_r_refused 1641.1Schristos#define YXDOMAIN ns_r_yxdomain 1651.1Schristos#define YXRRSET ns_r_yxrrset 1661.1Schristos#define NXRRSET ns_r_nxrrset 1671.1Schristos#define NOTAUTH ns_r_notauth 1681.1Schristos#define NOTZONE ns_r_notzone 1691.1Schristos/*#define BADSIG ns_r_badsig*/ 1701.1Schristos/*#define BADKEY ns_r_badkey*/ 1711.1Schristos/*#define BADTIME ns_r_badtime*/ 1721.1Schristos 1731.1Schristos 1741.1Schristos#define DELETE ns_uop_delete 1751.1Schristos#define ADD ns_uop_add 1761.1Schristos 1771.1Schristos#define T_A ns_t_a 1781.1Schristos#define T_NS ns_t_ns 1791.1Schristos#define T_MD ns_t_md 1801.1Schristos#define T_MF ns_t_mf 1811.1Schristos#define T_CNAME ns_t_cname 1821.1Schristos#define T_SOA ns_t_soa 1831.1Schristos#define T_MB ns_t_mb 1841.1Schristos#define T_MG ns_t_mg 1851.1Schristos#define T_MR ns_t_mr 1861.1Schristos#define T_NULL ns_t_null 1871.1Schristos#define T_WKS ns_t_wks 1881.1Schristos#define T_PTR ns_t_ptr 1891.1Schristos#define T_HINFO ns_t_hinfo 1901.1Schristos#define T_MINFO ns_t_minfo 1911.1Schristos#define T_MX ns_t_mx 1921.1Schristos#define T_TXT ns_t_txt 1931.1Schristos#define T_RP ns_t_rp 1941.1Schristos#define T_AFSDB ns_t_afsdb 1951.1Schristos#define T_X25 ns_t_x25 1961.1Schristos#define T_ISDN ns_t_isdn 1971.1Schristos#define T_RT ns_t_rt 1981.1Schristos#define T_NSAP ns_t_nsap 1991.1Schristos#define T_NSAP_PTR ns_t_nsap_ptr 2001.1Schristos#define T_SIG ns_t_sig 2011.1Schristos#define T_KEY ns_t_key 2021.1Schristos#define T_PX ns_t_px 2031.1Schristos#define T_GPOS ns_t_gpos 2041.1Schristos#define T_AAAA ns_t_aaaa 2051.1Schristos#define T_LOC ns_t_loc 2061.1Schristos#define T_NXT ns_t_nxt 2071.1Schristos#define T_EID ns_t_eid 2081.1Schristos#define T_NIMLOC ns_t_nimloc 2091.1Schristos#define T_SRV ns_t_srv 2101.1Schristos#define T_ATMA ns_t_atma 2111.1Schristos#define T_NAPTR ns_t_naptr 2121.1Schristos#define T_A6 ns_t_a6 2131.6.18.1Smartin#define T_DNAME ns_t_dname 2141.1Schristos#define T_TSIG ns_t_tsig 2151.1Schristos#define T_IXFR ns_t_ixfr 2161.1Schristos#define T_AXFR ns_t_axfr 2171.1Schristos#define T_MAILB ns_t_mailb 2181.1Schristos#define T_MAILA ns_t_maila 2191.1Schristos#define T_ANY ns_t_any 2201.1Schristos 2211.1Schristos#define C_IN ns_c_in 2221.1Schristos#define C_CHAOS ns_c_chaos 2231.1Schristos#define C_HS ns_c_hs 2241.1Schristos/* BIND_UPDATE */ 2251.1Schristos#define C_NONE ns_c_none 2261.1Schristos#define C_ANY ns_c_any 2271.1Schristos 2281.1Schristos#define GETSHORT NS_GET16 2291.1Schristos#define GETLONG NS_GET32 2301.1Schristos#define PUTSHORT NS_PUT16 2311.1Schristos#define PUTLONG NS_PUT32 2321.1Schristos 2331.1Schristos#endif /* _ARPA_NAMESER_COMPAT_ */ 234