|
|
@ -1,4 +1,4 @@ |
|
|
|
/* $OpenBSD: nameser.h,v 1.10 2004/01/22 21:48:02 espie Exp $ */ |
|
|
|
/* $OpenBSD: nameser.h,v 1.11 2005/12/20 02:06:56 millert Exp $ */ |
|
|
|
|
|
|
|
/* |
|
|
|
* ++Copyright++ 1983, 1989, 1993 |
|
|
@ -81,17 +81,8 @@ |
|
|
|
#ifndef _NAMESER_H_ |
|
|
|
#define _NAMESER_H_ |
|
|
|
|
|
|
|
#include <sys/param.h> |
|
|
|
#if (!defined(BSD)) || (BSD < 199306) |
|
|
|
# include <sys/bitypes.h> |
|
|
|
#else |
|
|
|
# include <sys/types.h> |
|
|
|
#endif |
|
|
|
#include <sys/cdefs.h> |
|
|
|
|
|
|
|
#ifdef _AUX_SOURCE |
|
|
|
# include <sys/types.h> |
|
|
|
#endif |
|
|
|
#include <sys/param.h> |
|
|
|
|
|
|
|
/* |
|
|
|
* revision information. this is the release date in YYYYMMDD format. |
|
|
@ -271,45 +262,15 @@ |
|
|
|
#define CONV_BADCKSUM (-3) |
|
|
|
#define CONV_BADBUFLEN (-4) |
|
|
|
|
|
|
|
#ifndef BYTE_ORDER |
|
|
|
#if (BSD >= 199103) |
|
|
|
# include <machine/endian.h> |
|
|
|
#else |
|
|
|
#ifdef linux |
|
|
|
# include <endian.h> |
|
|
|
#else |
|
|
|
#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */ |
|
|
|
#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ |
|
|
|
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/ |
|
|
|
|
|
|
|
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \ |
|
|
|
defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ |
|
|
|
defined(__alpha__) || defined(__alpha) |
|
|
|
#define BYTE_ORDER LITTLE_ENDIAN |
|
|
|
#endif |
|
|
|
|
|
|
|
#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ |
|
|
|
defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ |
|
|
|
defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\ |
|
|
|
defined(apollo) || defined(__convex__) || defined(_CRAY) || \ |
|
|
|
defined(__hppa) || defined(__hp9000) || \ |
|
|
|
defined(__hp9000s300) || defined(__hp9000s700) || \ |
|
|
|
defined (BIT_ZERO_ON_LEFT) || defined(m68k) |
|
|
|
#define BYTE_ORDER BIG_ENDIAN |
|
|
|
#endif |
|
|
|
#endif /* linux */ |
|
|
|
#endif /* BSD */ |
|
|
|
#endif /* BYTE_ORDER */ |
|
|
|
|
|
|
|
#if !defined(BYTE_ORDER) || \ |
|
|
|
(BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \ |
|
|
|
BYTE_ORDER != PDP_ENDIAN) |
|
|
|
#if !defined(_BYTE_ORDER) || \ |
|
|
|
(_BYTE_ORDER != _BIG_ENDIAN && _BYTE_ORDER != _LITTLE_ENDIAN && \ |
|
|
|
_BYTE_ORDER != _PDP_ENDIAN) |
|
|
|
/* you must determine what the correct bit order is for |
|
|
|
* your compiler - the next line is an intentional error |
|
|
|
* which will force your compiles to bomb until you fix |
|
|
|
* the above macros. |
|
|
|
*/ |
|
|
|
error "Undefined or invalid BYTE_ORDER"; |
|
|
|
#error "Undefined or invalid _BYTE_ORDER"; |
|
|
|
#endif |
|
|
|
|
|
|
|
/* |
|
|
@ -321,7 +282,7 @@ |
|
|
|
|
|
|
|
typedef struct { |
|
|
|
unsigned id :16; /* query identification number */ |
|
|
|
#if BYTE_ORDER == BIG_ENDIAN |
|
|
|
#if _BYTE_ORDER == _BIG_ENDIAN |
|
|
|
/* fields in third byte */ |
|
|
|
unsigned qr: 1; /* response flag */ |
|
|
|
unsigned opcode: 4; /* purpose of message */ |
|
|
@ -335,7 +296,7 @@ typedef struct { |
|
|
|
unsigned cd: 1; /* checking disabled by resolver */ |
|
|
|
unsigned rcode :4; /* response code */ |
|
|
|
#endif |
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN |
|
|
|
#if _BYTE_ORDER == _LITTLE_ENDIAN || _BYTE_ORDER == _PDP_ENDIAN |
|
|
|
/* fields in third byte */ |
|
|
|
unsigned rd :1; /* recursion desired */ |
|
|
|
unsigned tc :1; /* truncated message */ |
|
|
|