1: /*
   2:  * Copyright (c) 1983 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)nameser.h	5.11 (Berkeley) 2/14/86
   7:  */
   8: 
   9: /*
  10:  * Define constants based on rfc883
  11:  */
  12: #define PACKETSZ    512     /* maximum packet size */
  13: #define MAXDNAME    256     /* maximum domain name */
  14: #define MAXCDNAME   255     /* maximum compressed domain name */
  15: #define MAXLABEL    63      /* maximum length of domain label */
  16:     /* Number of bytes of fixed size data in query structure */
  17: #define QFIXEDSZ    4
  18:     /* number of bytes of fixed size data in resource record */
  19: #define RRFIXEDSZ   10
  20: 
  21: /*
  22:  * Internet nameserver port number
  23:  */
  24: #define NAMESERVER_PORT 53
  25: 
  26: /*
  27:  * Currently defined opcodes
  28:  */
  29: #define QUERY       0       /* standard query */
  30: #define IQUERY      1       /* inverse query */
  31: #define CQUERYM     2       /* completion query (multiple) */
  32: #define CQUERYU     3       /* completion query (unique) */
  33:     /* non standard */
  34: #define UPDATEA     100     /* add resource record */
  35: #define UPDATED     101     /* delete resource record */
  36: #define UPDATEM     102     /* modify resource record */
  37: #define ZONEINIT    103     /* initial zone transfer */
  38: #define ZONEREF     104     /* incremental zone referesh */
  39: 
  40: /*
  41:  * Currently defined response codes
  42:  */
  43: #define NOERROR     0       /* no error */
  44: #define FORMERR     1       /* format error */
  45: #define SERVFAIL    2       /* server failure */
  46: #define NXDOMAIN    3       /* non existent domain */
  47: #define NOTIMP      4       /* not implemented */
  48: #define REFUSED     5       /* query refused */
  49:     /* non standard */
  50: #define NOCHANGE    100     /* update failed to change db */
  51: 
  52: /*
  53:  * Type values for resources and queries
  54:  */
  55: #define T_A     1       /* host address */
  56: #define T_NS        2       /* authoritative server */
  57: #define T_MD        3       /* mail destination */
  58: #define T_MF        4       /* mail forwarder */
  59: #define T_CNAME     5       /* connonical name */
  60: #define T_SOA       6       /* start of authority zone */
  61: #define T_MB        7       /* mailbox domain name */
  62: #define T_MG        8       /* mail group member */
  63: #define T_MR        9       /* mail rename name */
  64: #define T_NULL      10      /* null resource record */
  65: #define T_WKS       11      /* well known service */
  66: #define T_PTR       12      /* domain name pointer */
  67: #define T_HINFO     13      /* host information */
  68: #define T_MINFO     14      /* mailbox information */
  69: #define T_MX        15      /* mail routing information */
  70:     /* non standard */
  71: #define T_UINFO     100     /* user (finger) information */
  72: #define T_UID       101     /* user ID */
  73: #define T_GID       102     /* group ID */
  74:     /* Query type values which do not appear in resource records */
  75: #define T_AXFR      252     /* transfer zone of authority */
  76: #define T_MAILB     253     /* transfer mailbox records */
  77: #define T_MAILA     254     /* transfer mail agent records */
  78: #define T_ANY       255     /* wildcard match */
  79: 
  80: /*
  81:  * Values for class field
  82:  */
  83: 
  84: #define C_IN        1       /* the arpa internet */
  85: #define C_CHAOS     3       /* for chaos net at MIT */
  86:     /* Query class values which do not appear in resource records */
  87: #define C_ANY       255     /* wildcard match */
  88: 
  89: /*
  90:  * Structure for query header, the order of the fields is machine and
  91:  * compiler dependent, in our case, the bits within a byte are assignd
  92:  * least significant first, while the order of transmition is most
  93:  * significant first.  This requires a somewhat confusing rearrangement.
  94:  */
  95: 
  96: typedef struct {
  97:     u_short id;     /* query identification number */
  98: #if defined (sun) || defined (sel) || defined (pyr) || defined (is68k) \
  99: || defined (tahoe) || defined (BIT_ZERO_ON_LEFT)
 100:     /* Bit zero on left:  Gould and similar architectures */
 101:             /* fields in third byte */
 102:     u_char  qr:1;       /* response flag */
 103:     u_char  opcode:4;   /* purpose of message */
 104:     u_char  aa:1;       /* authoritive answer */
 105:     u_char  tc:1;       /* truncated message */
 106:     u_char  rd:1;       /* recursion desired */
 107:             /* fields in fourth byte */
 108:     u_char  ra:1;       /* recursion available */
 109:     u_char  pr:1;       /* primary server required (non standard) */
 110:     u_char  unused:2;   /* unused bits */
 111:     u_char  rcode:4;    /* response code */
 112: #else
 113: #if defined (vax) || defined (BIT_ZERO_ON_RIGHT)
 114:     /* Bit zero on right:  VAX */
 115:             /* fields in third byte */
 116:     u_char  rd:1;       /* recursion desired */
 117:     u_char  tc:1;       /* truncated message */
 118:     u_char  aa:1;       /* authoritive answer */
 119:     u_char  opcode:4;   /* purpose of message */
 120:     u_char  qr:1;       /* response flag */
 121:             /* fields in fourth byte */
 122:     u_char  rcode:4;    /* response code */
 123:     u_char  unused:2;   /* unused bits */
 124:     u_char  pr:1;       /* primary server required (non standard) */
 125:     u_char  ra:1;       /* recursion available */
 126: #else
 127:     /* you must determine what the correct bit order is for your compiler */
 128:     UNDEFINED_BIT_ORDER;
 129: #endif
 130: #endif
 131:             /* remaining bytes */
 132:     u_short qdcount;    /* number of question entries */
 133:     u_short ancount;    /* number of answer entries */
 134:     u_short nscount;    /* number of authority entries */
 135:     u_short arcount;    /* number of resource entries */
 136: } HEADER;
 137: 
 138: /*
 139:  * Defines for handling compressed domain names
 140:  */
 141: #define INDIR_MASK  0xc0
 142: 
 143: /*
 144:  * Structure for passing resource records around.
 145:  */
 146: struct rrec {
 147:     short   r_zone;         /* zone number */
 148:     short   r_class;        /* class number */
 149:     short   r_type;         /* type number */
 150:     u_long  r_ttl;          /* time to live */
 151:     int r_size;         /* size of data area */
 152:     char    *r_data;        /* pointer to data */
 153: };
 154: 
 155: extern  u_short getshort();
 156: extern  u_long  getlong();

Defined struct's

rrec defined in line 146; used 2 times

Defined macros

CQUERYM defined in line 31; used 1 times
CQUERYU defined in line 32; never used
C_CHAOS defined in line 85; never used
FORMERR defined in line 44; used 20 times
INDIR_MASK defined in line 141; used 5 times
MAXCDNAME defined in line 14; never used
MAXLABEL defined in line 15; used 1 times
NOCHANGE defined in line 50; never used
NOTIMP defined in line 47; used 1 times
NXDOMAIN defined in line 46; used 1 times
REFUSED defined in line 48; used 2 times
RRFIXEDSZ defined in line 19; used 6 times
T_MAILA defined in line 77; never used
T_MD defined in line 57; never used
T_MF defined in line 58; never used
T_NULL defined in line 64; used 2 times
UPDATEA defined in line 34; never used
UPDATED defined in line 35; never used
UPDATEM defined in line 36; never used
ZONEINIT defined in line 37; never used
ZONEREF defined in line 38; never used

Usage of this include

Last modified: 1986-04-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2225
Valid CSS Valid XHTML 1.0 Strict