Print this page
2169 arpa/nameser_compat.h: wrong macros
Reviewed by: Dan McDonald <danmcd@omniti.com>


  48  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  49  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  50  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  51  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  52  * DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  53  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  54  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  55  * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  56  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  57  * SUCH DAMAGE.
  58  */
  59 
  60 /*
  61  *      from nameser.h  8.1 (Berkeley) 6/2/93
  62  *      $Id: nameser_compat.h,v 8.15 2002/07/17 07:01:02 marka Exp $
  63  */
  64 
  65 #ifndef _ARPA_NAMESER_COMPAT_H
  66 #define _ARPA_NAMESER_COMPAT_H
  67 
  68 #pragma ident   "%Z%%M% %I%     %E% SMI"
  69 
  70 #ifdef  __cplusplus
  71 extern "C" {
  72 #endif
  73 
  74 #define __BIND          19950621        /* (DEAD) interface version stamp. */
  75 
  76 #ifndef BYTE_ORDER
  77 #if (BSD >= 199103)
  78 #include <machine/endian.h>
  79 #else
  80 #ifdef linux
  81 #include <endian.h>
  82 #else
  83 #define LITTLE_ENDIAN   1234    /* least-significant byte first (vax, pc) */
  84 #define BIG_ENDIAN      4321    /* most-significant byte first (IBM, net) */
  85 #define PDP_ENDIAN      3412    /* LSB first in word, MSW first in long (pdp) */
  86 
  87 #if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
  88         defined(__i386) || defined(__amd64) || \
  89         defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \


  93 #endif
  94 
  95 #if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
  96     defined(__sparc) || \
  97     defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
  98     defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
  99     defined(apollo) || defined(__convex__) || defined(_CRAY) || \
 100     defined(__hppa) || defined(__hp9000) || \
 101     defined(__hp9000s300) || defined(__hp9000s700) || \
 102     defined(__hp3000s900) || defined(MPE) || \
 103     defined(BIT_ZERO_ON_LEFT) || defined(m68k) || \
 104         (defined(__Lynx__) && \
 105         (defined(__68k__) || defined(__sparc__) || defined(__powerpc__)))
 106 #define BYTE_ORDER      BIG_ENDIAN
 107 #endif
 108 #endif /* linux */
 109 #endif /* BSD */
 110 #endif /* BYTE_ORDER */
 111 
 112 #if !defined(BYTE_ORDER) || \
 113         (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
 114     BYTE_ORDER != PDP_ENDIAN)
 115         /*
 116          * you must determine what the correct bit order is for
 117          * your compiler - the next line is an intentional error
 118          * which will force your compiles to bomb until you fix
 119          * the above macros.
 120          */
 121         error "Undefined or invalid BYTE_ORDER";
 122 #endif
 123 
 124 /*
 125  * Structure for query header.  The order of the fields is machine- and
 126  * compiler-dependent, depending on the byte/bit order and the layout
 127  * of bit fields.  We use bit fields only in int variables, as this
 128  * is all ANSI requires.  This requires a somewhat confusing rearrangement.
 129  */
 130 
 131 typedef struct {
 132         unsigned        id :16;         /* query identification number */
 133 #if BYTE_ORDER == BIG_ENDIAN
 134                         /* fields in third byte */
 135         unsigned        qr: 1;          /* response flag */
 136         unsigned        opcode: 4;      /* purpose of message */
 137         unsigned        aa: 1;          /* authoritive answer */
 138         unsigned        tc: 1;          /* truncated message */
 139         unsigned        rd: 1;          /* recursion desired */
 140                         /* fields in fourth byte */
 141         unsigned        ra: 1;          /* recursion available */




  48  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  49  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  50  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  51  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  52  * DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  53  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  54  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  55  * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  56  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  57  * SUCH DAMAGE.
  58  */
  59 
  60 /*
  61  *      from nameser.h  8.1 (Berkeley) 6/2/93
  62  *      $Id: nameser_compat.h,v 8.15 2002/07/17 07:01:02 marka Exp $
  63  */
  64 
  65 #ifndef _ARPA_NAMESER_COMPAT_H
  66 #define _ARPA_NAMESER_COMPAT_H
  67 


  68 #ifdef  __cplusplus
  69 extern "C" {
  70 #endif
  71 
  72 #define __BIND          19950621        /* (DEAD) interface version stamp. */
  73 
  74 #ifndef BYTE_ORDER
  75 #if (BSD >= 199103)
  76 #include <machine/endian.h>
  77 #else
  78 #ifdef linux
  79 #include <endian.h>
  80 #else
  81 #define LITTLE_ENDIAN   1234    /* least-significant byte first (vax, pc) */
  82 #define BIG_ENDIAN      4321    /* most-significant byte first (IBM, net) */
  83 #define PDP_ENDIAN      3412    /* LSB first in word, MSW first in long (pdp) */
  84 
  85 #if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
  86         defined(__i386) || defined(__amd64) || \
  87         defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \


  91 #endif
  92 
  93 #if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
  94     defined(__sparc) || \
  95     defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
  96     defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
  97     defined(apollo) || defined(__convex__) || defined(_CRAY) || \
  98     defined(__hppa) || defined(__hp9000) || \
  99     defined(__hp9000s300) || defined(__hp9000s700) || \
 100     defined(__hp3000s900) || defined(MPE) || \
 101     defined(BIT_ZERO_ON_LEFT) || defined(m68k) || \
 102         (defined(__Lynx__) && \
 103         (defined(__68k__) || defined(__sparc__) || defined(__powerpc__)))
 104 #define BYTE_ORDER      BIG_ENDIAN
 105 #endif
 106 #endif /* linux */
 107 #endif /* BSD */
 108 #endif /* BYTE_ORDER */
 109 
 110 #if !defined(BYTE_ORDER) || \
 111         ((BYTE_ORDER != BIG_ENDIAN) && (BYTE_ORDER != LITTLE_ENDIAN) && \
 112         (BYTE_ORDER != PDP_ENDIAN))
 113 /*
 114  * you must determine what the correct bit order is for
 115  * your compiler - the next line is an intentional error
 116  * which will force your compiles to bomb until you fix
 117  * the above macros.
 118  */
 119 #error "Undefined or invalid BYTE_ORDER";
 120 #endif
 121 
 122 /*
 123  * Structure for query header.  The order of the fields is machine- and
 124  * compiler-dependent, depending on the byte/bit order and the layout
 125  * of bit fields.  We use bit fields only in int variables, as this
 126  * is all ANSI requires.  This requires a somewhat confusing rearrangement.
 127  */
 128 
 129 typedef struct {
 130         unsigned        id :16;         /* query identification number */
 131 #if BYTE_ORDER == BIG_ENDIAN
 132                         /* fields in third byte */
 133         unsigned        qr: 1;          /* response flag */
 134         unsigned        opcode: 4;      /* purpose of message */
 135         unsigned        aa: 1;          /* authoritive answer */
 136         unsigned        tc: 1;          /* truncated message */
 137         unsigned        rd: 1;          /* recursion desired */
 138                         /* fields in fourth byte */
 139         unsigned        ra: 1;          /* recursion available */