1*6996e5b2SAugustin Cavalier /* 2*6996e5b2SAugustin Cavalier * Copyright (c) 1983, 1989 379e1d377SIngo Weinhold * The Regents of the University of California. All rights reserved. 479e1d377SIngo Weinhold * 579e1d377SIngo Weinhold * Redistribution and use in source and binary forms, with or without 679e1d377SIngo Weinhold * modification, are permitted provided that the following conditions 779e1d377SIngo Weinhold * are met: 879e1d377SIngo Weinhold * 1. Redistributions of source code must retain the above copyright 979e1d377SIngo Weinhold * notice, this list of conditions and the following disclaimer. 1079e1d377SIngo Weinhold * 2. Redistributions in binary form must reproduce the above copyright 1179e1d377SIngo Weinhold * notice, this list of conditions and the following disclaimer in the 1279e1d377SIngo Weinhold * documentation and/or other materials provided with the distribution. 13*6996e5b2SAugustin Cavalier * 3. Neither the name of the University nor the names of its contributors 1479e1d377SIngo Weinhold * may be used to endorse or promote products derived from this software 1579e1d377SIngo Weinhold * without specific prior written permission. 1679e1d377SIngo Weinhold * 1779e1d377SIngo Weinhold * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1879e1d377SIngo Weinhold * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1979e1d377SIngo Weinhold * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2079e1d377SIngo Weinhold * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2179e1d377SIngo Weinhold * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2279e1d377SIngo Weinhold * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2379e1d377SIngo Weinhold * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2479e1d377SIngo Weinhold * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2579e1d377SIngo Weinhold * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2679e1d377SIngo Weinhold * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2779e1d377SIngo Weinhold * SUCH DAMAGE. 2879e1d377SIngo Weinhold */ 2979e1d377SIngo Weinhold #ifndef _ARPA_NAMESER_COMPAT_ 3079e1d377SIngo Weinhold #define _ARPA_NAMESER_COMPAT_ 3179e1d377SIngo Weinhold 3279e1d377SIngo Weinhold #define __BIND 19950621 /* (DEAD) interface version stamp. */ 3379e1d377SIngo Weinhold 3479e1d377SIngo Weinhold #include <endian.h> 3579e1d377SIngo Weinhold 3679e1d377SIngo Weinhold #if !defined(BYTE_ORDER) || \ 37*6996e5b2SAugustin Cavalier (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN) 3879e1d377SIngo Weinhold /* you must determine what the correct bit order is for 3979e1d377SIngo Weinhold * your compiler - the next line is an intentional error 4079e1d377SIngo Weinhold * which will force your compiles to bomb until you fix 4179e1d377SIngo Weinhold * the above macros. 4279e1d377SIngo Weinhold */ 43*6996e5b2SAugustin Cavalier #error "Undefined or invalid BYTE_ORDER"; 4479e1d377SIngo Weinhold #endif 4579e1d377SIngo Weinhold 4679e1d377SIngo Weinhold /* 4779e1d377SIngo Weinhold * Structure for query header. The order of the fields is machine- and 4879e1d377SIngo Weinhold * compiler-dependent, depending on the byte/bit order and the layout 4979e1d377SIngo Weinhold * of bit fields. We use bit fields only in int variables, as this 5079e1d377SIngo Weinhold * is all ANSI requires. This requires a somewhat confusing rearrangement. 5179e1d377SIngo Weinhold */ 5279e1d377SIngo Weinhold 5379e1d377SIngo Weinhold typedef struct { 5479e1d377SIngo Weinhold unsigned id :16; /* query identification number */ 5579e1d377SIngo Weinhold #if BYTE_ORDER == BIG_ENDIAN 5679e1d377SIngo Weinhold /* fields in third byte */ 5779e1d377SIngo Weinhold unsigned qr: 1; /* response flag */ 5879e1d377SIngo Weinhold unsigned opcode: 4; /* purpose of message */ 59*6996e5b2SAugustin Cavalier unsigned aa: 1; /* authoritative answer */ 6079e1d377SIngo Weinhold unsigned tc: 1; /* truncated message */ 6179e1d377SIngo Weinhold unsigned rd: 1; /* recursion desired */ 6279e1d377SIngo Weinhold /* fields in fourth byte */ 6379e1d377SIngo Weinhold unsigned ra: 1; /* recursion available */ 6479e1d377SIngo Weinhold unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ 6579e1d377SIngo Weinhold unsigned ad: 1; /* authentic data from named */ 6679e1d377SIngo Weinhold unsigned cd: 1; /* checking disabled by resolver */ 6779e1d377SIngo Weinhold unsigned rcode :4; /* response code */ 6879e1d377SIngo Weinhold #endif 69*6996e5b2SAugustin Cavalier #if BYTE_ORDER == LITTLE_ENDIAN 7079e1d377SIngo Weinhold /* fields in third byte */ 7179e1d377SIngo Weinhold unsigned rd :1; /* recursion desired */ 7279e1d377SIngo Weinhold unsigned tc :1; /* truncated message */ 73*6996e5b2SAugustin Cavalier unsigned aa :1; /* authoritative answer */ 7479e1d377SIngo Weinhold unsigned opcode :4; /* purpose of message */ 7579e1d377SIngo Weinhold unsigned qr :1; /* response flag */ 7679e1d377SIngo Weinhold /* fields in fourth byte */ 7779e1d377SIngo Weinhold unsigned rcode :4; /* response code */ 7879e1d377SIngo Weinhold unsigned cd: 1; /* checking disabled by resolver */ 7979e1d377SIngo Weinhold unsigned ad: 1; /* authentic data from named */ 8079e1d377SIngo Weinhold unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ 8179e1d377SIngo Weinhold unsigned ra :1; /* recursion available */ 8279e1d377SIngo Weinhold #endif 8379e1d377SIngo Weinhold /* remaining bytes */ 8479e1d377SIngo Weinhold unsigned qdcount :16; /* number of question entries */ 8579e1d377SIngo Weinhold unsigned ancount :16; /* number of answer entries */ 8679e1d377SIngo Weinhold unsigned nscount :16; /* number of authority entries */ 8779e1d377SIngo Weinhold unsigned arcount :16; /* number of resource entries */ 8879e1d377SIngo Weinhold } HEADER; 8979e1d377SIngo Weinhold 9079e1d377SIngo Weinhold #define PACKETSZ NS_PACKETSZ 9179e1d377SIngo Weinhold #define MAXDNAME NS_MAXDNAME 9279e1d377SIngo Weinhold #define MAXCDNAME NS_MAXCDNAME 9379e1d377SIngo Weinhold #define MAXLABEL NS_MAXLABEL 9479e1d377SIngo Weinhold #define HFIXEDSZ NS_HFIXEDSZ 9579e1d377SIngo Weinhold #define QFIXEDSZ NS_QFIXEDSZ 9679e1d377SIngo Weinhold #define RRFIXEDSZ NS_RRFIXEDSZ 9779e1d377SIngo Weinhold #define INT32SZ NS_INT32SZ 9879e1d377SIngo Weinhold #define INT16SZ NS_INT16SZ 9979e1d377SIngo Weinhold #define INT8SZ NS_INT8SZ 10079e1d377SIngo Weinhold #define INADDRSZ NS_INADDRSZ 10179e1d377SIngo Weinhold #define IN6ADDRSZ NS_IN6ADDRSZ 10279e1d377SIngo Weinhold #define INDIR_MASK NS_CMPRSFLGS 10379e1d377SIngo Weinhold #define NAMESERVER_PORT NS_DEFAULTPORT 10479e1d377SIngo Weinhold 10579e1d377SIngo Weinhold #define S_ZONE ns_s_zn 10679e1d377SIngo Weinhold #define S_PREREQ ns_s_pr 10779e1d377SIngo Weinhold #define S_UPDATE ns_s_ud 10879e1d377SIngo Weinhold #define S_ADDT ns_s_ar 10979e1d377SIngo Weinhold 11079e1d377SIngo Weinhold #define QUERY ns_o_query 11179e1d377SIngo Weinhold #define IQUERY ns_o_iquery 11279e1d377SIngo Weinhold #define STATUS ns_o_status 11379e1d377SIngo Weinhold #define NS_NOTIFY_OP ns_o_notify 11479e1d377SIngo Weinhold #define NS_UPDATE_OP ns_o_update 11579e1d377SIngo Weinhold 11679e1d377SIngo Weinhold #define NOERROR ns_r_noerror 11779e1d377SIngo Weinhold #define FORMERR ns_r_formerr 11879e1d377SIngo Weinhold #define SERVFAIL ns_r_servfail 11979e1d377SIngo Weinhold #define NXDOMAIN ns_r_nxdomain 12079e1d377SIngo Weinhold #define NOTIMP ns_r_notimpl 12179e1d377SIngo Weinhold #define REFUSED ns_r_refused 12279e1d377SIngo Weinhold #define YXDOMAIN ns_r_yxdomain 12379e1d377SIngo Weinhold #define YXRRSET ns_r_yxrrset 12479e1d377SIngo Weinhold #define NXRRSET ns_r_nxrrset 12579e1d377SIngo Weinhold #define NOTAUTH ns_r_notauth 12679e1d377SIngo Weinhold #define NOTZONE ns_r_notzone 12779e1d377SIngo Weinhold /*#define BADSIG ns_r_badsig*/ 12879e1d377SIngo Weinhold /*#define BADKEY ns_r_badkey*/ 12979e1d377SIngo Weinhold /*#define BADTIME ns_r_badtime*/ 13079e1d377SIngo Weinhold 13179e1d377SIngo Weinhold 13279e1d377SIngo Weinhold #define DELETE ns_uop_delete 13379e1d377SIngo Weinhold #define ADD ns_uop_add 13479e1d377SIngo Weinhold 13579e1d377SIngo Weinhold #define T_A ns_t_a 13679e1d377SIngo Weinhold #define T_NS ns_t_ns 13779e1d377SIngo Weinhold #define T_MD ns_t_md 13879e1d377SIngo Weinhold #define T_MF ns_t_mf 13979e1d377SIngo Weinhold #define T_CNAME ns_t_cname 14079e1d377SIngo Weinhold #define T_SOA ns_t_soa 14179e1d377SIngo Weinhold #define T_MB ns_t_mb 14279e1d377SIngo Weinhold #define T_MG ns_t_mg 14379e1d377SIngo Weinhold #define T_MR ns_t_mr 14479e1d377SIngo Weinhold #define T_NULL ns_t_null 14579e1d377SIngo Weinhold #define T_WKS ns_t_wks 14679e1d377SIngo Weinhold #define T_PTR ns_t_ptr 14779e1d377SIngo Weinhold #define T_HINFO ns_t_hinfo 14879e1d377SIngo Weinhold #define T_MINFO ns_t_minfo 14979e1d377SIngo Weinhold #define T_MX ns_t_mx 15079e1d377SIngo Weinhold #define T_TXT ns_t_txt 15179e1d377SIngo Weinhold #define T_RP ns_t_rp 15279e1d377SIngo Weinhold #define T_AFSDB ns_t_afsdb 15379e1d377SIngo Weinhold #define T_X25 ns_t_x25 15479e1d377SIngo Weinhold #define T_ISDN ns_t_isdn 15579e1d377SIngo Weinhold #define T_RT ns_t_rt 15679e1d377SIngo Weinhold #define T_NSAP ns_t_nsap 15779e1d377SIngo Weinhold #define T_NSAP_PTR ns_t_nsap_ptr 15879e1d377SIngo Weinhold #define T_SIG ns_t_sig 15979e1d377SIngo Weinhold #define T_KEY ns_t_key 16079e1d377SIngo Weinhold #define T_PX ns_t_px 16179e1d377SIngo Weinhold #define T_GPOS ns_t_gpos 16279e1d377SIngo Weinhold #define T_AAAA ns_t_aaaa 16379e1d377SIngo Weinhold #define T_LOC ns_t_loc 16479e1d377SIngo Weinhold #define T_NXT ns_t_nxt 16579e1d377SIngo Weinhold #define T_EID ns_t_eid 16679e1d377SIngo Weinhold #define T_NIMLOC ns_t_nimloc 16779e1d377SIngo Weinhold #define T_SRV ns_t_srv 16879e1d377SIngo Weinhold #define T_ATMA ns_t_atma 16979e1d377SIngo Weinhold #define T_NAPTR ns_t_naptr 17079e1d377SIngo Weinhold #define T_A6 ns_t_a6 171*6996e5b2SAugustin Cavalier #define T_DNAME ns_t_dname 172*6996e5b2SAugustin Cavalier #define T_OPT ns_t_opt 17379e1d377SIngo Weinhold #define T_TSIG ns_t_tsig 17479e1d377SIngo Weinhold #define T_IXFR ns_t_ixfr 17579e1d377SIngo Weinhold #define T_AXFR ns_t_axfr 17679e1d377SIngo Weinhold #define T_MAILB ns_t_mailb 17779e1d377SIngo Weinhold #define T_MAILA ns_t_maila 17879e1d377SIngo Weinhold #define T_ANY ns_t_any 17979e1d377SIngo Weinhold 18079e1d377SIngo Weinhold #define C_IN ns_c_in 18179e1d377SIngo Weinhold #define C_CHAOS ns_c_chaos 18279e1d377SIngo Weinhold #define C_HS ns_c_hs 18379e1d377SIngo Weinhold /* BIND_UPDATE */ 18479e1d377SIngo Weinhold #define C_NONE ns_c_none 18579e1d377SIngo Weinhold #define C_ANY ns_c_any 18679e1d377SIngo Weinhold 18779e1d377SIngo Weinhold #define GETSHORT NS_GET16 18879e1d377SIngo Weinhold #define GETLONG NS_GET32 18979e1d377SIngo Weinhold #define PUTSHORT NS_PUT16 19079e1d377SIngo Weinhold #define PUTLONG NS_PUT32 19179e1d377SIngo Weinhold 19279e1d377SIngo Weinhold #endif /* _ARPA_NAMESER_COMPAT_ */ 193