home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / NETWORK / TEL23SRC.ZIP / INCLUDE / DOMAIN.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-10  |  3.0 KB  |  106 lines

  1. /*
  2. *    DOMAIN.H
  3. *
  4. *    Domain processing header file
  5. *
  6. *****************************************************************************
  7. *                                                                            *
  8. *     part of:                                                                *
  9. *     TCP/IP kernel for NCSA Telnet                                            *
  10. *     by Tim Krauskopf                                                        *
  11. *                                                                            *
  12. *     National Center for Supercomputing Applications                        *
  13. *     152 Computing Applications Building                                    *
  14. *     605 E. Springfield Ave.                                                *
  15. *     Champaign, IL  61820                                                    *
  16. *                                                                            *
  17. *****************************************************************************
  18. *
  19. *    Revision history:
  20. *
  21. *    5/90    created for greater portability        QAK
  22. *
  23. */
  24.  
  25. #ifndef DOMAIN_H
  26.  
  27. /*
  28. *  special domain data structures
  29. */
  30.  
  31. #define DOMSIZE 512            /* maximum domain message size to mess with */
  32.  
  33. /*
  34. *  Header for the DOMAIN queries
  35. *  ALL OF THESE ARE BYTE SWAPPED QUANTITIES!
  36. *
  37. */
  38. struct dhead {
  39.     uint16    ident,            /* unique identifier */
  40.         flags,
  41.         qdcount,            /* question section, # of entries */
  42.         ancount,            /* answers, how many */
  43.         nscount,            /* count of name server RRs */
  44.         arcount;            /* number of "additional" records */
  45. };
  46.  
  47. /*
  48.  *  flag masks for the flags field of the DOMAIN header
  49.  */
  50. #define DQR            0x8000            /* query=0, response=1 */
  51. #define DOPCODE        0x7100            /* opcode, see below */
  52. #define DAA            0x0400            /* Authoritative answer */
  53. #define DTC            0x0200            /* Truncation, response was cut off at 512 */
  54. #define DRD            0x0100            /* Recursion desired */
  55. #define DRA            0x0080            /* Recursion available */
  56. #define DRCODE        0x000F            /* response code, see below */
  57.  
  58. /* opcode possible values: */
  59. #define DOPQUERY    0            /* a standard query */
  60. #define DOPIQ        1            /* an inverse query */
  61. #define DOPCQM        2            /* a completion query, multiple reply */
  62. #define DOPCQU        3             /* a completion query, single reply */
  63.  
  64. /* the rest reserved for future */
  65. /* legal response codes: */
  66. #define DROK        0                /* okay response */
  67. #define DRFORM        1                /* format error */
  68. #define DRFAIL        2                /* their problem, server failed */
  69. #define DRNAME        3                /* name error, we know name doesn't exist */
  70. #define DRNOPE        4                /* no can do request */
  71. #define DRNOWAY        5                /* name server refusing to do request */
  72. #define DTYPEA        1                /* host address resource record (RR) */
  73. #define DTYPEPTR    12                /* a domain name ptr */
  74. #define DIN            1                /* ARPA internet class */
  75. #define DWILD        255                /* wildcard for several of the classifications */
  76.  
  77. /*
  78.  *  a resource record is made up of a compressed domain name followed by
  79.  *  this structure.  All of these ints need to be byteswapped before use.
  80.  */
  81. struct rrpart {
  82.     uint16    rtype,                    /* resource record type=DTYPEA */
  83.             rclass;                    /* RR class=DIN */
  84.     uint32    rttl;                    /* time-to-live, changed to 32 bits */
  85.     uint16    rdlength;                /* length of next field */
  86.     uint8    rdata[DOMSIZE];            /* data field */
  87. };
  88.  
  89. /*
  90. *  data for domain name lookup
  91. */
  92. #ifdef DOMAINMASTER
  93. struct useek {
  94.     struct dhead h;
  95.     uint8 x[DOMSIZE];
  96. } question;
  97. #else
  98. extern struct useek {
  99.     struct dhead h;
  100.     uint8 x[DOMSIZE];
  101. } question;
  102. #endif
  103.  
  104. #define DOMAIN_H
  105. #endif
  106.