williamr@2
|
1 |
/* NAMESER.H
|
williamr@2
|
2 |
*
|
williamr@4
|
3 |
* Portions Copyright (c) 1993-1999 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
4 |
* All rights reserved.
|
williamr@2
|
5 |
*/
|
williamr@2
|
6 |
|
williamr@2
|
7 |
/** @file
|
williamr@2
|
8 |
@publishedAll
|
williamr@2
|
9 |
@released
|
williamr@2
|
10 |
*/
|
williamr@2
|
11 |
|
williamr@2
|
12 |
/*
|
williamr@2
|
13 |
* Copyright (c) 1983, 1989, 1993
|
williamr@2
|
14 |
* The Regents of the University of California. All rights reserved.
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
* Redistribution and use in source and binary forms, with or without
|
williamr@2
|
17 |
* modification, are permitted provided that the following conditions
|
williamr@2
|
18 |
* are met:
|
williamr@2
|
19 |
* 1. Redistributions of source code must retain the above copyright
|
williamr@2
|
20 |
* notice, this list of conditions and the following disclaimer.
|
williamr@2
|
21 |
* 2. Redistributions in binary form must reproduce the above copyright
|
williamr@2
|
22 |
* notice, this list of conditions and the following disclaimer in the
|
williamr@2
|
23 |
* documentation and/or other materials provided with the distribution.
|
williamr@2
|
24 |
* 3. All advertising materials mentioning features or use of this software
|
williamr@2
|
25 |
* must display the following acknowledgement:
|
williamr@2
|
26 |
* This product includes software developed by the University of
|
williamr@2
|
27 |
* California, Berkeley and its contributors.
|
williamr@2
|
28 |
* 4. Neither the name of the University nor the names of its contributors
|
williamr@2
|
29 |
* may be used to endorse or promote products derived from this software
|
williamr@2
|
30 |
* without specific prior written permission.
|
williamr@2
|
31 |
*
|
williamr@2
|
32 |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
williamr@2
|
33 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
williamr@2
|
34 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
williamr@2
|
35 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
williamr@2
|
36 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
williamr@2
|
37 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
williamr@2
|
38 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
williamr@2
|
39 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
williamr@2
|
40 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
williamr@2
|
41 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
williamr@2
|
42 |
* SUCH DAMAGE.
|
williamr@2
|
43 |
*
|
williamr@2
|
44 |
* -
|
williamr@2
|
45 |
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
williamr@2
|
46 |
*
|
williamr@2
|
47 |
* Permission to use, copy, modify, and distribute this software for any
|
williamr@2
|
48 |
* purpose with or without fee is hereby granted, provided that the above
|
williamr@2
|
49 |
* copyright notice and this permission notice appear in all copies, and that
|
williamr@2
|
50 |
* the name of Digital Equipment Corporation not be used in advertising or
|
williamr@2
|
51 |
* publicity pertaining to distribution of the document or software without
|
williamr@2
|
52 |
* specific, written prior permission.
|
williamr@2
|
53 |
*
|
williamr@2
|
54 |
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
|
williamr@2
|
55 |
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
|
williamr@2
|
56 |
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
|
williamr@2
|
57 |
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
williamr@2
|
58 |
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
williamr@2
|
59 |
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
williamr@2
|
60 |
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
williamr@2
|
61 |
* SOFTWARE.
|
williamr@2
|
62 |
* -
|
williamr@2
|
63 |
* Portions Copyright (c) 1995 by International Business Machines, Inc.
|
williamr@2
|
64 |
*
|
williamr@2
|
65 |
* International Business Machines, Inc. (hereinafter called IBM) grants
|
williamr@2
|
66 |
* permission under its copyrights to use, copy, modify, and distribute this
|
williamr@2
|
67 |
* Software with or without fee, provided that the above copyright notice and
|
williamr@2
|
68 |
* all paragraphs of this notice appear in all copies, and that the name of IBM
|
williamr@2
|
69 |
* not be used in connection with the marketing of any product incorporating
|
williamr@2
|
70 |
* the Software or modifications thereof, without specific, written prior
|
williamr@2
|
71 |
* permission.
|
williamr@2
|
72 |
*
|
williamr@2
|
73 |
* To the extent it has a right to do so, IBM grants an immunity from suit
|
williamr@2
|
74 |
* under its patents, if any, for the use, sale or manufacture of products to
|
williamr@2
|
75 |
* the extent that such products are used for performing Domain Name System
|
williamr@2
|
76 |
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
|
williamr@2
|
77 |
* granted for any product per se or for any other function of any product.
|
williamr@2
|
78 |
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
|
williamr@2
|
79 |
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
williamr@2
|
80 |
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
|
williamr@2
|
81 |
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
|
williamr@2
|
82 |
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
|
williamr@2
|
83 |
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
williamr@2
|
84 |
*
|
williamr@2
|
85 |
* @(#)nameser.h 8.2 (Berkeley) 2/16/94
|
williamr@2
|
86 |
* From Id: nameser.h,v 8.11 1996/10/08 04:51:02 vixie Exp
|
williamr@2
|
87 |
* $Id: nameser.h,v 1.11 1997/02/23 09:17:20 peter Exp $
|
williamr@2
|
88 |
*/
|
williamr@2
|
89 |
|
williamr@2
|
90 |
#ifndef _ARPA_NAMESER_H_
|
williamr@2
|
91 |
#define _ARPA_NAMESER_H_
|
williamr@2
|
92 |
|
williamr@2
|
93 |
#ifdef __cplusplus
|
williamr@2
|
94 |
extern "C" {
|
williamr@2
|
95 |
#endif
|
williamr@2
|
96 |
|
williamr@2
|
97 |
#include <sys/param.h>
|
williamr@2
|
98 |
#include <sys/types.h>
|
williamr@2
|
99 |
|
williamr@2
|
100 |
/**
|
williamr@2
|
101 |
revision information. this is the release date in YYYYMMDD format.
|
williamr@2
|
102 |
it can change every day so the right thing to do with it is use it
|
williamr@2
|
103 |
in preprocessor commands such as "#if (__BIND > 19931104)". do not
|
williamr@2
|
104 |
compare for equality; rather, use it to determine whether your resolver
|
williamr@2
|
105 |
is new enough to contain a certain feature.
|
williamr@2
|
106 |
*/
|
williamr@2
|
107 |
|
williamr@2
|
108 |
#define __BIND 19960801 /* interface version stamp */
|
williamr@2
|
109 |
|
williamr@2
|
110 |
/**
|
williamr@2
|
111 |
Define constants based on rfc883
|
williamr@2
|
112 |
*/
|
williamr@2
|
113 |
|
williamr@2
|
114 |
/** maximum packet size */
|
williamr@2
|
115 |
#define PACKETSZ 512
|
williamr@2
|
116 |
|
williamr@2
|
117 |
/** maximum presentation domain name */
|
williamr@2
|
118 |
#define MAXDNAME 1025
|
williamr@2
|
119 |
|
williamr@2
|
120 |
/** maximum compressed domain name */
|
williamr@2
|
121 |
#define MAXCDNAME 255
|
williamr@2
|
122 |
|
williamr@2
|
123 |
/** maximum length of domain label */
|
williamr@2
|
124 |
#define MAXLABEL 63
|
williamr@2
|
125 |
|
williamr@2
|
126 |
/** #/bytes of fixed data in header */
|
williamr@2
|
127 |
#define HFIXEDSZ 12
|
williamr@2
|
128 |
|
williamr@2
|
129 |
/** #/bytes of fixed data in query */
|
williamr@2
|
130 |
#define QFIXEDSZ 4
|
williamr@2
|
131 |
|
williamr@2
|
132 |
/** #/bytes of fixed data in r record */
|
williamr@2
|
133 |
#define RRFIXEDSZ 10
|
williamr@2
|
134 |
|
williamr@2
|
135 |
/** for systems without 32-bit ints */
|
williamr@2
|
136 |
#define INT32SZ 4
|
williamr@2
|
137 |
|
williamr@2
|
138 |
/** for systems without 16-bit ints */
|
williamr@2
|
139 |
#define INT16SZ 2
|
williamr@2
|
140 |
|
williamr@2
|
141 |
/** IPv4 T_A */
|
williamr@2
|
142 |
#define INADDRSZ 4
|
williamr@2
|
143 |
|
williamr@2
|
144 |
/** IPv6 T_AAAA */
|
williamr@2
|
145 |
#define IN6ADDRSZ 16
|
williamr@2
|
146 |
|
williamr@2
|
147 |
/**
|
williamr@2
|
148 |
Internet nameserver port number
|
williamr@2
|
149 |
*/
|
williamr@2
|
150 |
#define NAMESERVER_PORT 53
|
williamr@2
|
151 |
|
williamr@2
|
152 |
|
williamr@2
|
153 |
/**
|
williamr@2
|
154 |
Currently defined opcodes
|
williamr@2
|
155 |
*/
|
williamr@2
|
156 |
|
williamr@2
|
157 |
/** standard query */
|
williamr@2
|
158 |
#define QUERY 0x0
|
williamr@2
|
159 |
|
williamr@2
|
160 |
/** inverse query */
|
williamr@2
|
161 |
#define IQUERY 0x1
|
williamr@2
|
162 |
|
williamr@2
|
163 |
/** nameserver status query */
|
williamr@2
|
164 |
#define STATUS 0x2
|
williamr@2
|
165 |
|
williamr@2
|
166 |
/* 0x3 reserved */
|
williamr@2
|
167 |
/*#define xxx 0x3 */
|
williamr@2
|
168 |
#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */
|
williamr@2
|
169 |
|
williamr@2
|
170 |
|
williamr@2
|
171 |
/**
|
williamr@2
|
172 |
Currently defined response codes
|
williamr@2
|
173 |
*/
|
williamr@2
|
174 |
|
williamr@2
|
175 |
/** no error */
|
williamr@2
|
176 |
#define NOERROR 0
|
williamr@2
|
177 |
|
williamr@2
|
178 |
/** format error */
|
williamr@2
|
179 |
#define FORMERR 1
|
williamr@2
|
180 |
|
williamr@2
|
181 |
/** server failure */
|
williamr@2
|
182 |
#define SERVFAIL 2
|
williamr@2
|
183 |
|
williamr@2
|
184 |
/** non existent domain */
|
williamr@2
|
185 |
#define NXDOMAIN 3
|
williamr@2
|
186 |
|
williamr@2
|
187 |
/** not implemented */
|
williamr@2
|
188 |
#define NOTIMP 4
|
williamr@2
|
189 |
|
williamr@2
|
190 |
/** query refused */
|
williamr@2
|
191 |
#define REFUSED 5
|
williamr@2
|
192 |
|
williamr@2
|
193 |
|
williamr@2
|
194 |
|
williamr@2
|
195 |
/**
|
williamr@2
|
196 |
Type values for resources and queries
|
williamr@2
|
197 |
*/
|
williamr@2
|
198 |
|
williamr@2
|
199 |
/** host address */
|
williamr@2
|
200 |
#define T_A 1
|
williamr@2
|
201 |
|
williamr@2
|
202 |
/** authoritative server */
|
williamr@2
|
203 |
#define T_NS 2
|
williamr@2
|
204 |
|
williamr@2
|
205 |
/** mail destination */
|
williamr@2
|
206 |
#define T_MD 3
|
williamr@2
|
207 |
|
williamr@2
|
208 |
/** mail forwarder */
|
williamr@2
|
209 |
#define T_MF 4
|
williamr@2
|
210 |
|
williamr@2
|
211 |
/** canonical name */
|
williamr@2
|
212 |
#define T_CNAME 5
|
williamr@2
|
213 |
|
williamr@2
|
214 |
/** start of authority zone */
|
williamr@2
|
215 |
#define T_SOA 6
|
williamr@2
|
216 |
|
williamr@2
|
217 |
/** mailbox domain name */
|
williamr@2
|
218 |
#define T_MB 7
|
williamr@2
|
219 |
|
williamr@2
|
220 |
/** mail group member */
|
williamr@2
|
221 |
#define T_MG 8
|
williamr@2
|
222 |
|
williamr@2
|
223 |
/** mail rename name */
|
williamr@2
|
224 |
#define T_MR 9
|
williamr@2
|
225 |
|
williamr@2
|
226 |
/** null resource record */
|
williamr@2
|
227 |
#define T_NULL 10
|
williamr@2
|
228 |
|
williamr@2
|
229 |
/** well known service */
|
williamr@2
|
230 |
#define T_WKS 11
|
williamr@2
|
231 |
|
williamr@2
|
232 |
/** domain name pointer */
|
williamr@2
|
233 |
#define T_PTR 12
|
williamr@2
|
234 |
|
williamr@2
|
235 |
/** host information */
|
williamr@2
|
236 |
#define T_HINFO 13
|
williamr@2
|
237 |
|
williamr@2
|
238 |
/** mailbox information */
|
williamr@2
|
239 |
#define T_MINFO 14
|
williamr@2
|
240 |
|
williamr@2
|
241 |
/** mail routing information */
|
williamr@2
|
242 |
#define T_MX 15
|
williamr@2
|
243 |
|
williamr@2
|
244 |
/** text strings */
|
williamr@2
|
245 |
#define T_TXT 16
|
williamr@2
|
246 |
|
williamr@2
|
247 |
/** responsible person */
|
williamr@2
|
248 |
#define T_RP 17
|
williamr@2
|
249 |
|
williamr@2
|
250 |
/** AFS cell database */
|
williamr@2
|
251 |
#define T_AFSDB 18
|
williamr@2
|
252 |
|
williamr@2
|
253 |
/** X_25 calling address */
|
williamr@2
|
254 |
#define T_X25 19
|
williamr@2
|
255 |
|
williamr@2
|
256 |
/** ISDN calling address */
|
williamr@2
|
257 |
#define T_ISDN 20
|
williamr@2
|
258 |
|
williamr@2
|
259 |
/** router */
|
williamr@2
|
260 |
#define T_RT 21
|
williamr@2
|
261 |
|
williamr@2
|
262 |
/** NSAP address */
|
williamr@2
|
263 |
#define T_NSAP 22
|
williamr@2
|
264 |
|
williamr@2
|
265 |
/** reverse NSAP lookup (deprecated) */
|
williamr@2
|
266 |
#define T_NSAP_PTR 23
|
williamr@2
|
267 |
|
williamr@2
|
268 |
/** security signature */
|
williamr@2
|
269 |
#define T_SIG 24
|
williamr@2
|
270 |
|
williamr@2
|
271 |
/** security key */
|
williamr@2
|
272 |
#define T_KEY 25
|
williamr@2
|
273 |
|
williamr@2
|
274 |
/** X.400 mail mapping */
|
williamr@2
|
275 |
#define T_PX 26
|
williamr@2
|
276 |
|
williamr@2
|
277 |
/** geographical position (withdrawn) */
|
williamr@2
|
278 |
#define T_GPOS 27
|
williamr@2
|
279 |
|
williamr@2
|
280 |
/** IP6 Address */
|
williamr@2
|
281 |
#define T_AAAA 28
|
williamr@2
|
282 |
|
williamr@2
|
283 |
/** Location Information */
|
williamr@2
|
284 |
#define T_LOC 29
|
williamr@2
|
285 |
|
williamr@2
|
286 |
/** Next Valid Name in Zone */
|
williamr@2
|
287 |
#define T_NXT 30
|
williamr@2
|
288 |
|
williamr@2
|
289 |
/** Endpoint identifier */
|
williamr@2
|
290 |
#define T_EID 31
|
williamr@2
|
291 |
|
williamr@2
|
292 |
/** Nimrod locator */
|
williamr@2
|
293 |
#define T_NIMLOC 32
|
williamr@2
|
294 |
|
williamr@2
|
295 |
/** Server selection */
|
williamr@2
|
296 |
#define T_SRV 33
|
williamr@2
|
297 |
|
williamr@2
|
298 |
/** ATM Address */
|
williamr@2
|
299 |
#define T_ATMA 34
|
williamr@2
|
300 |
|
williamr@2
|
301 |
/** Naming Authority PoinTeR */
|
williamr@2
|
302 |
#define T_NAPTR 35
|
williamr@2
|
303 |
|
williamr@2
|
304 |
/** user (finger) information
|
williamr@2
|
305 |
non standard
|
williamr@2
|
306 |
*/
|
williamr@2
|
307 |
#define T_UINFO 100
|
williamr@2
|
308 |
|
williamr@2
|
309 |
/** user ID */
|
williamr@2
|
310 |
#define T_UID 101
|
williamr@2
|
311 |
|
williamr@2
|
312 |
/** group ID */
|
williamr@2
|
313 |
#define T_GID 102
|
williamr@2
|
314 |
|
williamr@2
|
315 |
/** Unspecified format (binary data) */
|
williamr@2
|
316 |
#define T_UNSPEC 103
|
williamr@2
|
317 |
|
williamr@2
|
318 |
/** Query type values which do not appear in resource records
|
williamr@2
|
319 |
incremental zone transfer */
|
williamr@2
|
320 |
#define T_IXFR 251
|
williamr@2
|
321 |
|
williamr@2
|
322 |
/** transfer zone of authority */
|
williamr@2
|
323 |
#define T_AXFR 252
|
williamr@2
|
324 |
|
williamr@2
|
325 |
/** transfer mailbox records */
|
williamr@2
|
326 |
#define T_MAILB 253
|
williamr@2
|
327 |
|
williamr@2
|
328 |
/** transfer mail agent records */
|
williamr@2
|
329 |
#define T_MAILA 254
|
williamr@2
|
330 |
|
williamr@2
|
331 |
/** wildcard match */
|
williamr@2
|
332 |
#define T_ANY 255
|
williamr@2
|
333 |
|
williamr@2
|
334 |
/**
|
williamr@2
|
335 |
Values for class field
|
williamr@2
|
336 |
*/
|
williamr@2
|
337 |
#define C_IN 1 /* the arpa internet */
|
williamr@2
|
338 |
#define C_CHAOS 3 /* for chaos net (MIT) */
|
williamr@2
|
339 |
#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */
|
williamr@2
|
340 |
/* Query class values which do not appear in resource records */
|
williamr@2
|
341 |
#define C_ANY 255 /* wildcard match */
|
williamr@2
|
342 |
|
williamr@2
|
343 |
/**
|
williamr@2
|
344 |
Flags field of the KEY RR rdata
|
williamr@2
|
345 |
*/
|
williamr@2
|
346 |
#define KEYFLAG_TYPEMASK 0xC000 /* Mask for "type" bits */
|
williamr@2
|
347 |
#define KEYFLAG_TYPE_AUTH_CONF 0x0000 /* Key usable for both */
|
williamr@2
|
348 |
#define KEYFLAG_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */
|
williamr@2
|
349 |
#define KEYFLAG_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */
|
williamr@2
|
350 |
#define KEYFLAG_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */
|
williamr@2
|
351 |
/** The type bits can also be interpreted independently, as single bits: */
|
williamr@2
|
352 |
#define KEYFLAG_NO_AUTH 0x8000 /* Key not usable for authentication */
|
williamr@2
|
353 |
#define KEYFLAG_NO_CONF 0x4000 /* Key not usable for confidentiality */
|
williamr@2
|
354 |
|
williamr@2
|
355 |
#define KEYFLAG_EXPERIMENTAL 0x2000 /* Security is *mandatory* if bit=0 */
|
williamr@2
|
356 |
#define KEYFLAG_RESERVED3 0x1000 /* reserved - must be zero */
|
williamr@2
|
357 |
#define KEYFLAG_RESERVED4 0x0800 /* reserved - must be zero */
|
williamr@2
|
358 |
#define KEYFLAG_USERACCOUNT 0x0400 /* key is assoc. with a user acct */
|
williamr@2
|
359 |
#define KEYFLAG_ENTITY 0x0200 /* key is assoc. with entity eg host */
|
williamr@2
|
360 |
#define KEYFLAG_ZONEKEY 0x0100 /* key is zone key for the zone named */
|
williamr@2
|
361 |
#define KEYFLAG_IPSEC 0x0080 /* key is for IPSEC use (host or user)*/
|
williamr@2
|
362 |
#define KEYFLAG_EMAIL 0x0040 /* key is for email (MIME security) */
|
williamr@2
|
363 |
#define KEYFLAG_RESERVED10 0x0020 /* reserved - must be zero */
|
williamr@2
|
364 |
#define KEYFLAG_RESERVED11 0x0010 /* reserved - must be zero */
|
williamr@2
|
365 |
#define KEYFLAG_SIGNATORYMASK 0x000F /* key can sign DNS RR's of same name */
|
williamr@2
|
366 |
|
williamr@2
|
367 |
#define KEYFLAG_RESERVED_BITMASK ( KEYFLAG_RESERVED3 | \
|
williamr@2
|
368 |
KEYFLAG_RESERVED4 | \
|
williamr@2
|
369 |
KEYFLAG_RESERVED10| KEYFLAG_RESERVED11)
|
williamr@2
|
370 |
|
williamr@2
|
371 |
/**
|
williamr@2
|
372 |
The Algorithm field of the KEY and SIG RR's is an integer, {1..254}
|
williamr@2
|
373 |
*/
|
williamr@2
|
374 |
#define ALGORITHM_MD5RSA 1 /* MD5 with RSA */
|
williamr@2
|
375 |
#define ALGORITHM_EXPIRE_ONLY 253 /* No alg, no security */
|
williamr@2
|
376 |
#define ALGORITHM_PRIVATE_OID 254 /* Key begins with OID indicating alg */
|
williamr@2
|
377 |
|
williamr@2
|
378 |
/**
|
williamr@2
|
379 |
Signatures
|
williamr@2
|
380 |
*/
|
williamr@2
|
381 |
/** Size of a mod or exp in bits */
|
williamr@2
|
382 |
#define MIN_MD5RSA_KEY_PART_BITS 512
|
williamr@2
|
383 |
#define MAX_MD5RSA_KEY_PART_BITS 2552
|
williamr@2
|
384 |
/** Total of binary mod and exp, bytes */
|
williamr@2
|
385 |
#define MAX_MD5RSA_KEY_BYTES ((MAX_MD5RSA_KEY_PART_BITS+7/8)*2+3)
|
williamr@2
|
386 |
/** Max length of text sig block */
|
williamr@2
|
387 |
#define MAX_KEY_BASE64 (((MAX_MD5RSA_KEY_BYTES+2)/3)*4)
|
williamr@2
|
388 |
|
williamr@2
|
389 |
/**
|
williamr@2
|
390 |
Status return codes for T_UNSPEC conversion routines
|
williamr@2
|
391 |
*/
|
williamr@2
|
392 |
#define CONV_SUCCESS 0
|
williamr@2
|
393 |
#define CONV_OVERFLOW (-1)
|
williamr@2
|
394 |
#define CONV_BADFMT (-2)
|
williamr@2
|
395 |
#define CONV_BADCKSUM (-3)
|
williamr@2
|
396 |
#define CONV_BADBUFLEN (-4)
|
williamr@2
|
397 |
|
williamr@2
|
398 |
/**
|
williamr@2
|
399 |
Structure for query header. The order of the fields is machine- and
|
williamr@2
|
400 |
compiler-dependent, depending on the byte/bit order and the layout
|
williamr@2
|
401 |
of bit fields. We use bit fields only in int variables, as this
|
williamr@2
|
402 |
is all ANSI requires. This requires a somewhat confusing rearrangement.
|
williamr@2
|
403 |
EPOC32 is little-endian
|
williamr@2
|
404 |
*/
|
williamr@2
|
405 |
typedef struct {
|
williamr@2
|
406 |
unsigned id :16; /* query identification number */
|
williamr@2
|
407 |
/* fields in third byte */
|
williamr@2
|
408 |
unsigned rd :1; /* recursion desired */
|
williamr@2
|
409 |
unsigned tc :1; /* truncated message */
|
williamr@2
|
410 |
unsigned aa :1; /* authoritative answer */
|
williamr@2
|
411 |
unsigned opcode :4; /* purpose of message */
|
williamr@2
|
412 |
unsigned qr :1; /* response flag */
|
williamr@2
|
413 |
/* fields in fourth byte */
|
williamr@2
|
414 |
unsigned rcode :4; /* response code */
|
williamr@2
|
415 |
unsigned cd: 1; /* checking disabled by resolver */
|
williamr@2
|
416 |
unsigned ad: 1; /* authentic data from named */
|
williamr@2
|
417 |
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
|
williamr@2
|
418 |
unsigned ra :1; /* recursion available */
|
williamr@2
|
419 |
/* remaining bytes */
|
williamr@2
|
420 |
unsigned qdcount :16; /* number of question entries */
|
williamr@2
|
421 |
unsigned ancount :16; /* number of answer entries */
|
williamr@2
|
422 |
unsigned nscount :16; /* number of authority entries */
|
williamr@2
|
423 |
unsigned arcount :16; /* number of resource entries */
|
williamr@2
|
424 |
} HEADER;
|
williamr@2
|
425 |
|
williamr@2
|
426 |
/**
|
williamr@2
|
427 |
Defines for handling compressed domain names
|
williamr@2
|
428 |
*/
|
williamr@2
|
429 |
#define INDIR_MASK 0xc0
|
williamr@2
|
430 |
|
williamr@2
|
431 |
extern u_int16_t _getshort (const u_char *);
|
williamr@2
|
432 |
extern u_int32_t _getlong (const u_char *);
|
williamr@2
|
433 |
|
williamr@2
|
434 |
/**
|
williamr@2
|
435 |
Inline versions of get/put short/long. Pointer is advanced.
|
williamr@2
|
436 |
|
williamr@2
|
437 |
These macros demonstrate the property of C whereby it can be
|
williamr@2
|
438 |
portable or it can be elegant but rarely both.
|
williamr@2
|
439 |
*/
|
williamr@2
|
440 |
#define GETSHORT(s, cp) { \
|
williamr@2
|
441 |
register u_char *t_cp = (u_char *)(cp); \
|
williamr@2
|
442 |
(s) = ((u_int16_t)t_cp[0] << 8) \
|
williamr@2
|
443 |
| ((u_int16_t)t_cp[1]) \
|
williamr@2
|
444 |
; \
|
williamr@2
|
445 |
(cp) += INT16SZ; \
|
williamr@2
|
446 |
}
|
williamr@2
|
447 |
|
williamr@2
|
448 |
#define GETLONG(l, cp) { \
|
williamr@2
|
449 |
register u_char *t_cp = (u_char *)(cp); \
|
williamr@2
|
450 |
(l) = ((u_int32_t)t_cp[0] << 24) \
|
williamr@2
|
451 |
| ((u_int32_t)t_cp[1] << 16) \
|
williamr@2
|
452 |
| ((u_int32_t)t_cp[2] << 8) \
|
williamr@2
|
453 |
| ((u_int32_t)t_cp[3]) \
|
williamr@2
|
454 |
; \
|
williamr@2
|
455 |
(cp) += INT32SZ; \
|
williamr@2
|
456 |
}
|
williamr@2
|
457 |
|
williamr@2
|
458 |
#define PUTSHORT(s, cp) { \
|
williamr@2
|
459 |
register u_int16_t t_s = (u_int16_t)(s); \
|
williamr@2
|
460 |
register u_char *t_cp = (u_char *)(cp); \
|
williamr@2
|
461 |
*t_cp++ = t_s >> 8; \
|
williamr@2
|
462 |
*t_cp = t_s; \
|
williamr@2
|
463 |
(cp) += INT16SZ; \
|
williamr@2
|
464 |
}
|
williamr@2
|
465 |
|
williamr@2
|
466 |
#define PUTLONG(l, cp) { \
|
williamr@2
|
467 |
register u_int32_t t_l = (u_int32_t)(l); \
|
williamr@2
|
468 |
register u_char *t_cp = (u_char *)(cp); \
|
williamr@2
|
469 |
*t_cp++ = t_l >> 24; \
|
williamr@2
|
470 |
*t_cp++ = t_l >> 16; \
|
williamr@2
|
471 |
*t_cp++ = t_l >> 8; \
|
williamr@2
|
472 |
*t_cp = t_l; \
|
williamr@2
|
473 |
(cp) += INT32SZ; \
|
williamr@2
|
474 |
}
|
williamr@2
|
475 |
|
williamr@2
|
476 |
#ifdef __cplusplus
|
williamr@2
|
477 |
}
|
williamr@2
|
478 |
#endif
|
williamr@2
|
479 |
#endif /* !_ARPA_NAMESER_H_ */
|