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