force people doing ports to define their machine's bit order
[unix-history] / usr / src / include / arpa / nameser.h
index e38f8f3..0b7c65c 100644 (file)
@@ -1,4 +1,11 @@
-/*     nameser.h       4.1     85/03/01        */
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)nameser.h   5.4 (Berkeley) %G%
+ */
+
 /*
  * Define constants based on rfc883
  */
 /*
  * Define constants based on rfc883
  */
        /* number of bytes of fixed size data in resource record */
 #define RRFIXEDSZ      10
 
        /* number of bytes of fixed size data in resource record */
 #define RRFIXEDSZ      10
 
-#ifdef vax
-#define HTONS(s)       (((s >> 8) & 0xff) | ((s & 0xff) << 8))
-#else
-#define HTONS(s)
-#endif
+/*
+ * Internet nameserver port number
+ */
+#define NAMESERVER_PORT        53
 
 /*
  * Currently defined opcodes
 
 /*
  * Currently defined opcodes
 
 typedef struct {
        u_short id;             /* query identification number */
 
 typedef struct {
        u_short id;             /* query identification number */
+#if defined (sun) || defined (gould) || defined (BIT_ZERO_ON_LEFT)
+       /* Bit zero on left:  Gould and similar architectures */
+                       /* fields in third byte */
+       u_char  qr:1;           /* response flag */
+       u_char  opcode:4;       /* purpose of message */
+       u_char  aa:1;           /* authoritive answer */
+       u_char  tc:1;           /* truncated message */
+       u_char  rd:1;           /* recursion desired */
+                       /* fields in fourth byte */
+       u_char  ra:1;           /* recursion available */
+       u_char  pr:1;           /* primary server required (non standard) */
+       u_char  unused:2;       /* unused bits */
+       u_char  rcode:4;        /* response code */
+#else
+#if defined (vax) || defined (BIT_ZERO_ON_RIGHT)
+       /* Bit zero on right:  VAX */
                        /* fields in third byte */
        u_char  rd:1;           /* recursion desired */
        u_char  tc:1;           /* truncated message */
        u_char  aa:1;           /* authoritive answer */
        u_char  opcode:4;       /* purpose of message */
        u_char  qr:1;           /* response flag */
                        /* fields in third byte */
        u_char  rd:1;           /* recursion desired */
        u_char  tc:1;           /* truncated message */
        u_char  aa:1;           /* authoritive answer */
        u_char  opcode:4;       /* purpose of message */
        u_char  qr:1;           /* response flag */
-                       /* fields in forth byte */
+                       /* fields in fourth byte */
        u_char  rcode:4;        /* response code */
        u_char  unused:2;       /* unused bits */
        u_char  pr:1;           /* primary server required (non standard) */
        u_char  ra:1;           /* recursion available */
        u_char  rcode:4;        /* response code */
        u_char  unused:2;       /* unused bits */
        u_char  pr:1;           /* primary server required (non standard) */
        u_char  ra:1;           /* recursion available */
+#else
+       /* you must determine what the correct bit order is for your compiler */
+       UNDEFINED_BIT_ORDER;
+#endif
+#endif
                        /* remaining bytes */
        u_short qdcount;        /* number of question entries */
        u_short ancount;        /* number of answer entries */
                        /* remaining bytes */
        u_short qdcount;        /* number of question entries */
        u_short ancount;        /* number of answer entries */
@@ -122,3 +149,6 @@ struct rrec {
        int     r_size;                 /* size of data area */
        char    *r_data;                /* pointer to data */
 };
        int     r_size;                 /* size of data area */
        char    *r_data;                /* pointer to data */
 };
+
+extern u_short getshort();
+extern u_long  getlong();