home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 29 Fixes_o / 29-Fixes_o.zip / prgcsd.exe / NAMESER.H < prev    next >
Text File  |  1992-10-02  |  8KB  |  165 lines

  1. /********************************************************copyrite.xmc***/
  2. /*                                                                     */
  3. /*   Licensed Materials - Property of IBM                              */
  4. /*                                                                     */
  5. /*   This module is "Restricted Materials of IBM":                     */
  6. /*      Program Number:   5798RXW                                      */
  7. /*      Program Name:     IBM TCP/IP Version 1.2 for OS/2              */
  8. /*   (C) Copyright IBM Corporation. 1990, 1991.                        */
  9. /*                                                                     */
  10. /*   See IBM Copyright Instructions.                                   */
  11. /*                                                                     */
  12. /********************************************************copyrite.xmc***/
  13. /*
  14.  * Copyright (c) 1983 Regents of the University of California.
  15.  * All rights reserved.
  16.  *
  17.  * Redistribution and use in source and binary forms are permitted
  18.  * provided that the above copyright notice and this paragraph are
  19.  * duplicated in all such forms and that any documentation,
  20.  * advertising materials, and other materials related to such
  21.  * distribution and use acknowledge that the software was developed
  22.  * by the University of California, Berkeley.  The name of the
  23.  * University may not be used to endorse or promote products derived
  24.  * from this software without specific prior written permission.
  25.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  26.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  27.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  28.  *
  29.  *      @(#)nameser.h   5.20 (Berkeley) 10/7/88
  30.  */
  31. #ifndef __32BIT__
  32. #define _Packed
  33. #define _Seg16
  34. #define _Far16
  35. #define _Cdecl
  36. #endif
  37.  
  38. /*
  39.  * Define constants based on rfc883
  40.  */
  41. #define PACKETSZ        512             /* maximum packet size */
  42. #define MAXDNAME        256             /* maximum domain name */
  43. #define MAXCDNAME       255             /* maximum compressed domain name */
  44. #define MAXLABEL        63              /* maximum length of domain label */
  45.         /* Number of bytes of fixed size data in query structure */
  46. #define QFIXEDSZ        4
  47.         /* number of bytes of fixed size data in resource record */
  48. #define RRFIXEDSZ       10
  49.  
  50. /*
  51.  * Internet nameserver port number
  52.  */
  53. #define NAMESERVER_PORT 53
  54.  
  55. /*
  56.  * Currently defined opcodes
  57.  */
  58. #define QUERY           0               /* standard query */
  59. #define IQUERY          1               /* inverse query */
  60. #define CQUERYM         2               /* completion query (multiple) */
  61. #define CQUERYU         3               /* completion query (unique) */
  62.         /* non standard */
  63. #define UPDATEA         100             /* add resource record */
  64. #define UPDATED         101             /* delete resource record */
  65. #define UPDATEM         102             /* modify resource record */
  66. #define ZONEINIT        103             /* initial zone transfer */
  67. #define ZONEREF         104             /* incremental zone referesh */
  68.  
  69. /*
  70.  * Currently defined response codes
  71.  */
  72. #define NOERROR         0               /* no error */
  73. #define FORMERR         1               /* format error */
  74. #define SERVFAIL        2               /* server failure */
  75. #define NXDOMAIN        3               /* non existent domain */
  76. #define NOTIMP          4               /* not implemented */
  77. #define REFUSED         5               /* query refused */
  78.         /* non standard */
  79. #define NOCHANGE        100             /* update failed to change db */
  80.  
  81. /*
  82.  * Type values for resources and queries
  83.  */
  84. #define T_A             1               /* host address */
  85. #define T_NS            2               /* authoritative server */
  86. #define T_MD            3               /* mail destination */
  87. #define T_MF            4               /* mail forwarder */
  88. #define T_CNAME         5               /* connonical name */
  89. #define T_SOA           6               /* start of authority zone */
  90. #define T_MB            7               /* mailbox domain name */
  91. #define T_MG            8               /* mail group member */
  92. #define T_MR            9               /* mail rename name */
  93. #define T_NULL          10              /* null resource record */
  94. #define T_WKS           11              /* well known service */
  95. #define T_PTR           12              /* domain name pointer */
  96. #define T_HINFO         13              /* host information */
  97. #define T_MINFO         14              /* mailbox information */
  98. #define T_MX            15              /* mail routing information */
  99.         /* non standard */
  100. #define T_UINFO         100             /* user (finger) information */
  101. #define T_UID           101             /* user ID */
  102. #define T_GID           102             /* group ID */
  103.         /* Query type values which do not appear in resource records */
  104. #define T_AXFR          252             /* transfer zone of authority */
  105. #define T_MAILB         253             /* transfer mailbox records */
  106. #define T_MAILA         254             /* transfer mail agent records */
  107. #define T_ANY           255             /* wildcard match */
  108.  
  109. /*
  110.  * Values for class field
  111.  */
  112.  
  113. #define C_IN            1               /* the arpa internet */
  114. #define C_CHAOS         3               /* for chaos net at MIT */
  115.         /* Query class values which do not appear in resource records */
  116. #define C_ANY           255             /* wildcard match */
  117.  
  118. /*
  119.  * Structure for query header, the order of the fields is machine and
  120.  * compiler dependent, in our case, the bits within a byte are assignd
  121.  * least significant first, while the order of transmition is most
  122.  * significant first.  This requires a somewhat confusing rearrangement.
  123.  */
  124.  
  125. typedef struct {
  126.         u_short id;             /* query identification number */
  127.         u_char  rd:1;           /* recursion desired */
  128.         u_char  tc:1;           /* truncated message */
  129.         u_char  aa:1;           /* authoritive answer */
  130.         u_char  opcode:4;       /* purpose of message */
  131.         u_char  qr:1;           /* response flag */
  132.                         /* fields in fourth byte */
  133.         u_char  rcode:4;        /* response code */
  134.         u_char  unused:2;       /* unused bits */
  135.         u_char  pr:1;           /* primary server required (non standard) */
  136.         u_char  ra:1;           /* recursion available */
  137.                         /* remaining bytes */
  138.         u_short qdcount;        /* number of question entries */
  139.         u_short ancount;        /* number of answer entries */
  140.         u_short nscount;        /* number of authority entries */
  141.         u_short arcount;        /* number of resource entries */
  142. } HEADER;
  143.  
  144. /*
  145.  * Defines for handling compressed domain names
  146.  */
  147. #define INDIR_MASK      0xc0
  148.  
  149. /*
  150.  * Structure for passing resource records around.
  151.  */
  152. _Packed struct rrec {
  153.         short   r_zone;                 /* zone number */
  154.         short   r_class;                /* class number */
  155.         short   r_type;                 /* type number */
  156.         u_long  r_ttl;                  /* time to live */
  157.         short   r_size;                 /* size of data area */
  158.         char    * _Seg16 r_data;                /* pointer to data */
  159. };
  160.  
  161. #if 0
  162. extern  u_short _Far16 _Cdecl getshort();
  163. extern  u_long  _Far16 _Cdecl getlong();
  164. #endif
  165.