]> git.saurik.com Git - apple/libc.git/blob - include/arpa/nameser_compat.h
b0a41e05115dee3d14042800e4c9aa608ba6a3f7
[apple/libc.git] / include / arpa / nameser_compat.h
1 /*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /* Copyright (c) 1983, 1989
24 * The Regents of the University of California. All rights reserved.
25 *
26 * Redistribution and use in source and binary forms, with or without
27 * modification, are permitted provided that the following conditions
28 * are met:
29 * 1. Redistributions of source code must retain the above copyright
30 * notice, this list of conditions and the following disclaimer.
31 * 2. Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in the
33 * documentation and/or other materials provided with the distribution.
34 * 3. All advertising materials mentioning features or use of this software
35 * must display the following acknowledgement:
36 * This product includes software developed by the University of
37 * California, Berkeley and its contributors.
38 * 4. Neither the name of the University nor the names of its contributors
39 * may be used to endorse or promote products derived from this software
40 * without specific prior written permission.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
43 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
46 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
48 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
50 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
51 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * SUCH DAMAGE.
53 */
54
55 /*
56 * from nameser.h 8.1 (Berkeley) 6/2/93
57 * From: Id: nameser_compat.h,v 8.9 1998/03/20 23:25:10 halley Exp
58 * $FreeBSD: src/include/arpa/nameser_compat.h,v 1.1.2.1 1999/08/29 14:39:01 peter Exp $
59 */
60
61 #ifndef _ARPA_NAMESER_COMPAT_
62 #define _ARPA_NAMESER_COMPAT_
63
64 #define __BIND 19950621 /* (DEAD) interface version stamp. */
65
66 #include <machine/endian.h>
67
68 #if !defined(BYTE_ORDER) || \
69 (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
70 BYTE_ORDER != PDP_ENDIAN)
71 /* you must determine what the correct bit order is for
72 * your compiler - the next line is an intentional error
73 * which will force your compiles to bomb until you fix
74 * the above macros.
75 */
76 error "Undefined or invalid BYTE_ORDER";
77 #endif
78
79 /*
80 * Structure for query header. The order of the fields is machine- and
81 * compiler-dependent, depending on the byte/bit order and the layout
82 * of bit fields. We use bit fields only in int variables, as this
83 * is all ANSI requires. This requires a somewhat confusing rearrangement.
84 */
85
86 typedef struct {
87 unsigned id :16; /* query identification number */
88 #if BYTE_ORDER == BIG_ENDIAN
89 /* fields in third byte */
90 unsigned qr: 1; /* response flag */
91 unsigned opcode: 4; /* purpose of message */
92 unsigned aa: 1; /* authoritive answer */
93 unsigned tc: 1; /* truncated message */
94 unsigned rd: 1; /* recursion desired */
95 /* fields in fourth byte */
96 unsigned ra: 1; /* recursion available */
97 unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
98 unsigned ad: 1; /* authentic data from named */
99 unsigned cd: 1; /* checking disabled by resolver */
100 unsigned rcode :4; /* response code */
101 #endif
102 #if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
103 /* fields in third byte */
104 unsigned rd :1; /* recursion desired */
105 unsigned tc :1; /* truncated message */
106 unsigned aa :1; /* authoritive answer */
107 unsigned opcode :4; /* purpose of message */
108 unsigned qr :1; /* response flag */
109 /* fields in fourth byte */
110 unsigned rcode :4; /* response code */
111 unsigned cd: 1; /* checking disabled by resolver */
112 unsigned ad: 1; /* authentic data from named */
113 unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
114 unsigned ra :1; /* recursion available */
115 #endif
116 /* remaining bytes */
117 unsigned qdcount :16; /* number of question entries */
118 unsigned ancount :16; /* number of answer entries */
119 unsigned nscount :16; /* number of authority entries */
120 unsigned arcount :16; /* number of resource entries */
121 } HEADER;
122
123 #define PACKETSZ NS_PACKETSZ
124 #define MAXDNAME NS_MAXDNAME
125 #define MAXCDNAME NS_MAXCDNAME
126 #define MAXLABEL NS_MAXLABEL
127 #define HFIXEDSZ NS_HFIXEDSZ
128 #define QFIXEDSZ NS_QFIXEDSZ
129 #define RRFIXEDSZ NS_RRFIXEDSZ
130 #define INT32SZ NS_INT32SZ
131 #define INT16SZ NS_INT16SZ
132 #define INADDRSZ NS_INADDRSZ
133 #define IN6ADDRSZ NS_IN6ADDRSZ
134 #define INDIR_MASK NS_CMPRSFLGS
135 #define NAMESERVER_PORT NS_DEFAULTPORT
136
137 #define S_ZONE ns_s_zn
138 #define S_PREREQ ns_s_pr
139 #define S_UPDATE ns_s_ud
140 #define S_ADDT ns_s_ar
141
142 #define QUERY ns_o_query
143 #define IQUERY ns_o_iquery
144 #define STATUS ns_o_status
145 #define NS_NOTIFY_OP ns_o_notify
146 #define NS_UPDATE_OP ns_o_update
147
148 #define NOERROR ns_r_noerror
149 #define FORMERR ns_r_formerr
150 #define SERVFAIL ns_r_servfail
151 #define NXDOMAIN ns_r_nxdomain
152 #define NOTIMP ns_r_notimpl
153 #define REFUSED ns_r_refused
154 #define YXDOMAIN ns_r_yxdomain
155 #define YXRRSET ns_r_yxrrset
156 #define NXRRSET ns_r_nxrrset
157 #define NOTAUTH ns_r_notauth
158 #define NOTZONE ns_r_notzone
159
160 #define DELETE ns_uop_delete
161 #define ADD ns_uop_add
162
163 #define T_A ns_t_a
164 #define T_NS ns_t_ns
165 #define T_MD ns_t_md
166 #define T_MF ns_t_mf
167 #define T_CNAME ns_t_cname
168 #define T_SOA ns_t_soa
169 #define T_MB ns_t_mb
170 #define T_MG ns_t_mg
171 #define T_MR ns_t_mr
172 #define T_NULL ns_t_null
173 #define T_WKS ns_t_wks
174 #define T_PTR ns_t_ptr
175 #define T_HINFO ns_t_hinfo
176 #define T_MINFO ns_t_minfo
177 #define T_MX ns_t_mx
178 #define T_TXT ns_t_txt
179 #define T_RP ns_t_rp
180 #define T_AFSDB ns_t_afsdb
181 #define T_X25 ns_t_x25
182 #define T_ISDN ns_t_isdn
183 #define T_RT ns_t_rt
184 #define T_NSAP ns_t_nsap
185 #define T_NSAP_PTR ns_t_nsap_ptr
186 #define T_SIG ns_t_sig
187 #define T_KEY ns_t_key
188 #define T_PX ns_t_px
189 #define T_GPOS ns_t_gpos
190 #define T_AAAA ns_t_aaaa
191 #define T_LOC ns_t_loc
192 #define T_NXT ns_t_nxt
193 #define T_EID ns_t_eid
194 #define T_NIMLOC ns_t_nimloc
195 #define T_SRV ns_t_srv
196 #define T_ATMA ns_t_atma
197 #define T_NAPTR ns_t_naptr
198 #define T_IXFR ns_t_ixfr
199 #define T_AXFR ns_t_axfr
200 #define T_MAILB ns_t_mailb
201 #define T_MAILA ns_t_maila
202 #define T_ANY ns_t_any
203
204 #define C_IN ns_c_in
205 #define C_CHAOS ns_c_chaos
206 #define C_HS ns_c_hs
207 /* BIND_UPDATE */
208 #define C_NONE ns_c_none
209 #define C_ANY ns_c_any
210
211 #define GETSHORT NS_GET16
212 #define GETLONG NS_GET32
213 #define PUTSHORT NS_PUT16
214 #define PUTLONG NS_PUT32
215
216 #endif /* _ARPA_NAMESER_COMPAT_ */