other-licenses/android/arpa_nameser_compat.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/other-licenses/android/arpa_nameser_compat.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,246 @@
     1.4 +/*	$NetBSD: nameser_compat.h,v 1.1.1.2 2004/11/07 01:28:27 christos Exp $	*/
     1.5 +
     1.6 +/* Copyright (c) 1983, 1989
     1.7 + *    The Regents of the University of California.  All rights reserved.
     1.8 + *
     1.9 + * Redistribution and use in source and binary forms, with or without
    1.10 + * modification, are permitted provided that the following conditions
    1.11 + * are met:
    1.12 + * 1. Redistributions of source code must retain the above copyright
    1.13 + *    notice, this list of conditions and the following disclaimer.
    1.14 + * 2. Redistributions in binary form must reproduce the above copyright
    1.15 + *    notice, this list of conditions and the following disclaimer in the
    1.16 + *    documentation and/or other materials provided with the distribution.
    1.17 + * 3. All advertising materials mentioning features or use of this software
    1.18 + *    must display the following acknowledgement:
    1.19 + * 	This product includes software developed by the University of
    1.20 + * 	California, Berkeley and its contributors.
    1.21 + * 4. Neither the name of the University nor the names of its contributors
    1.22 + *    may be used to endorse or promote products derived from this software
    1.23 + *    without specific prior written permission.
    1.24 + *
    1.25 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    1.26 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.27 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.28 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    1.29 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.30 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.31 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.32 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.33 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.34 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.35 + * SUCH DAMAGE.
    1.36 + */
    1.37 +
    1.38 +/*
    1.39 + *      from nameser.h	8.1 (Berkeley) 6/2/93
    1.40 + *	Id: nameser_compat.h,v 1.1.2.3.4.2 2004/07/01 04:43:41 marka Exp
    1.41 + */
    1.42 +
    1.43 +/*
    1.44 + * This version of this file is derived from Android 2.3 "Gingerbread",
    1.45 + * which contains uncredited changes by Android/Google developers.  It has
    1.46 + * been modified in 2011 for use in the Android build of Mozilla Firefox by
    1.47 + * Mozilla contributors (including Michael Edwards <m.k.edwards@gmail.com>,
    1.48 + * and Steve Workman <sjhworkman@gmail.com>).
    1.49 + * These changes are offered under the same license as the original NetBSD
    1.50 + * file, whose copyright and license are unchanged above.
    1.51 + */
    1.52 +
    1.53 +#ifndef _ARPA_NAMESER_COMPAT_
    1.54 +#define	_ARPA_NAMESER_COMPAT_
    1.55 +
    1.56 +#define	__BIND		19950621	/* (DEAD) interface version stamp. */
    1.57 +
    1.58 +#include <endian.h>
    1.59 +
    1.60 +#ifndef BYTE_ORDER
    1.61 +#if (BSD >= 199103)
    1.62 +# include <machine/endian.h>
    1.63 +#else
    1.64 +#ifdef __linux
    1.65 +# include <endian.h>
    1.66 +#else
    1.67 +#define	LITTLE_ENDIAN	1234	/* least-significant byte first (vax, pc) */
    1.68 +#define	BIG_ENDIAN	4321	/* most-significant byte first (IBM, net) */
    1.69 +#define	PDP_ENDIAN	3412	/* LSB first in word, MSW first in long (pdp)*/
    1.70 +
    1.71 +#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
    1.72 +    defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
    1.73 +    defined(__alpha__) || defined(__alpha) || \
    1.74 +    (defined(__Lynx__) && defined(__x86__))
    1.75 +#define BYTE_ORDER	LITTLE_ENDIAN
    1.76 +#endif
    1.77 +
    1.78 +#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
    1.79 +    defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
    1.80 +    defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
    1.81 +    defined(apollo) || defined(__convex__) || defined(_CRAY) || \
    1.82 +    defined(__hppa) || defined(__hp9000) || \
    1.83 +    defined(__hp9000s300) || defined(__hp9000s700) || \
    1.84 +    defined(__hp3000s900) || defined(__hpux) || defined(MPE) || \
    1.85 +    defined (BIT_ZERO_ON_LEFT) || defined(m68k) || defined(__sparc) ||  \
    1.86 +    (defined(__Lynx__) && \
    1.87 +     (defined(__68k__) || defined(__sparc__) || defined(__powerpc__)))
    1.88 +#define BYTE_ORDER	BIG_ENDIAN
    1.89 +#endif
    1.90 +#endif /* __linux */
    1.91 +#endif /* BSD */
    1.92 +#endif /* BYTE_ORDER */
    1.93 +
    1.94 +#if !defined(BYTE_ORDER) || \
    1.95 +    (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
    1.96 +    BYTE_ORDER != PDP_ENDIAN)
    1.97 +	/* you must determine what the correct bit order is for
    1.98 +	 * your compiler - the next line is an intentional error
    1.99 +	 * which will force your compiles to bomb until you fix
   1.100 +	 * the above macros.
   1.101 +	 */
   1.102 +  #error "Undefined or invalid BYTE_ORDER";
   1.103 +#endif
   1.104 +
   1.105 +/*
   1.106 + * Structure for query header.  The order of the fields is machine- and
   1.107 + * compiler-dependent, depending on the byte/bit order and the layout
   1.108 + * of bit fields.  We use bit fields only in int variables, as this
   1.109 + * is all ANSI requires.  This requires a somewhat confusing rearrangement.
   1.110 + */
   1.111 +
   1.112 +typedef struct {
   1.113 +	unsigned	id :16;		/* query identification number */
   1.114 +#if BYTE_ORDER == BIG_ENDIAN
   1.115 +			/* fields in third byte */
   1.116 +	unsigned	qr: 1;		/* response flag */
   1.117 +	unsigned	opcode: 4;	/* purpose of message */
   1.118 +	unsigned	aa: 1;		/* authoritive answer */
   1.119 +	unsigned	tc: 1;		/* truncated message */
   1.120 +	unsigned	rd: 1;		/* recursion desired */
   1.121 +			/* fields in fourth byte */
   1.122 +	unsigned	ra: 1;		/* recursion available */
   1.123 +	unsigned	unused :1;	/* unused bits (MBZ as of 4.9.3a3) */
   1.124 +	unsigned	ad: 1;		/* authentic data from named */
   1.125 +	unsigned	cd: 1;		/* checking disabled by resolver */
   1.126 +	unsigned	rcode :4;	/* response code */
   1.127 +#endif
   1.128 +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
   1.129 +			/* fields in third byte */
   1.130 +	unsigned	rd :1;		/* recursion desired */
   1.131 +	unsigned	tc :1;		/* truncated message */
   1.132 +	unsigned	aa :1;		/* authoritive answer */
   1.133 +	unsigned	opcode :4;	/* purpose of message */
   1.134 +	unsigned	qr :1;		/* response flag */
   1.135 +			/* fields in fourth byte */
   1.136 +	unsigned	rcode :4;	/* response code */
   1.137 +	unsigned	cd: 1;		/* checking disabled by resolver */
   1.138 +	unsigned	ad: 1;		/* authentic data from named */
   1.139 +	unsigned	unused :1;	/* unused bits (MBZ as of 4.9.3a3) */
   1.140 +	unsigned	ra :1;		/* recursion available */
   1.141 +#endif
   1.142 +			/* remaining bytes */
   1.143 +	unsigned	qdcount :16;	/* number of question entries */
   1.144 +	unsigned	ancount :16;	/* number of answer entries */
   1.145 +	unsigned	nscount :16;	/* number of authority entries */
   1.146 +	unsigned	arcount :16;	/* number of resource entries */
   1.147 +} HEADER;
   1.148 +
   1.149 +#define PACKETSZ	NS_PACKETSZ
   1.150 +#define MAXDNAME	NS_MAXDNAME
   1.151 +#define MAXCDNAME	NS_MAXCDNAME
   1.152 +#define MAXLABEL	NS_MAXLABEL
   1.153 +#define	HFIXEDSZ	NS_HFIXEDSZ
   1.154 +#define QFIXEDSZ	NS_QFIXEDSZ
   1.155 +#define RRFIXEDSZ	NS_RRFIXEDSZ
   1.156 +#define	INT32SZ		NS_INT32SZ
   1.157 +#define	INT16SZ		NS_INT16SZ
   1.158 +#define	INT8SZ		NS_INT8SZ
   1.159 +#define	INADDRSZ	NS_INADDRSZ
   1.160 +#define	IN6ADDRSZ	NS_IN6ADDRSZ
   1.161 +#define	INDIR_MASK	NS_CMPRSFLGS
   1.162 +#define NAMESERVER_PORT	NS_DEFAULTPORT
   1.163 +
   1.164 +#define S_ZONE		ns_s_zn
   1.165 +#define S_PREREQ	ns_s_pr
   1.166 +#define S_UPDATE	ns_s_ud
   1.167 +#define S_ADDT		ns_s_ar
   1.168 +
   1.169 +#define QUERY		ns_o_query
   1.170 +#define IQUERY		ns_o_iquery
   1.171 +#define STATUS		ns_o_status
   1.172 +#define	NS_NOTIFY_OP	ns_o_notify
   1.173 +#define	NS_UPDATE_OP	ns_o_update
   1.174 +
   1.175 +#define NOERROR		ns_r_noerror
   1.176 +#define FORMERR		ns_r_formerr
   1.177 +#define SERVFAIL	ns_r_servfail
   1.178 +#define NXDOMAIN	ns_r_nxdomain
   1.179 +#define NOTIMP		ns_r_notimpl
   1.180 +#define REFUSED		ns_r_refused
   1.181 +#define YXDOMAIN	ns_r_yxdomain
   1.182 +#define YXRRSET		ns_r_yxrrset
   1.183 +#define NXRRSET		ns_r_nxrrset
   1.184 +#define NOTAUTH		ns_r_notauth
   1.185 +#define NOTZONE		ns_r_notzone
   1.186 +/*#define BADSIG		ns_r_badsig*/
   1.187 +/*#define BADKEY		ns_r_badkey*/
   1.188 +/*#define BADTIME		ns_r_badtime*/
   1.189 +
   1.190 +
   1.191 +#define DELETE		ns_uop_delete
   1.192 +#define ADD		ns_uop_add
   1.193 +
   1.194 +#define T_A		ns_t_a
   1.195 +#define T_NS		ns_t_ns
   1.196 +#define T_MD		ns_t_md
   1.197 +#define T_MF		ns_t_mf
   1.198 +#define T_CNAME		ns_t_cname
   1.199 +#define T_SOA		ns_t_soa
   1.200 +#define T_MB		ns_t_mb
   1.201 +#define T_MG		ns_t_mg
   1.202 +#define T_MR		ns_t_mr
   1.203 +#define T_NULL		ns_t_null
   1.204 +#define T_WKS		ns_t_wks
   1.205 +#define T_PTR		ns_t_ptr
   1.206 +#define T_HINFO		ns_t_hinfo
   1.207 +#define T_MINFO		ns_t_minfo
   1.208 +#define T_MX		ns_t_mx
   1.209 +#define T_TXT		ns_t_txt
   1.210 +#define	T_RP		ns_t_rp
   1.211 +#define T_AFSDB		ns_t_afsdb
   1.212 +#define T_X25		ns_t_x25
   1.213 +#define T_ISDN		ns_t_isdn
   1.214 +#define T_RT		ns_t_rt
   1.215 +#define T_NSAP		ns_t_nsap
   1.216 +#define T_NSAP_PTR	ns_t_nsap_ptr
   1.217 +#define	T_SIG		ns_t_sig
   1.218 +#define	T_KEY		ns_t_key
   1.219 +#define	T_PX		ns_t_px
   1.220 +#define	T_GPOS		ns_t_gpos
   1.221 +#define	T_AAAA		ns_t_aaaa
   1.222 +#define	T_LOC		ns_t_loc
   1.223 +#define	T_NXT		ns_t_nxt
   1.224 +#define	T_EID		ns_t_eid
   1.225 +#define	T_NIMLOC	ns_t_nimloc
   1.226 +#define	T_SRV		ns_t_srv
   1.227 +#define T_ATMA		ns_t_atma
   1.228 +#define T_NAPTR		ns_t_naptr
   1.229 +#define T_A6		ns_t_a6
   1.230 +#define	T_TSIG		ns_t_tsig
   1.231 +#define	T_IXFR		ns_t_ixfr
   1.232 +#define T_AXFR		ns_t_axfr
   1.233 +#define T_MAILB		ns_t_mailb
   1.234 +#define T_MAILA		ns_t_maila
   1.235 +#define T_ANY		ns_t_any
   1.236 +
   1.237 +#define C_IN		ns_c_in
   1.238 +#define C_CHAOS		ns_c_chaos
   1.239 +#define C_HS		ns_c_hs
   1.240 +/* BIND_UPDATE */
   1.241 +#define C_NONE		ns_c_none
   1.242 +#define C_ANY		ns_c_any
   1.243 +
   1.244 +#define	GETSHORT		NS_GET16
   1.245 +#define	GETLONG			NS_GET32
   1.246 +#define	PUTSHORT		NS_PUT16
   1.247 +#define	PUTLONG			NS_PUT32
   1.248 +
   1.249 +#endif /* _ARPA_NAMESER_COMPAT_ */

mercurial