home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / t / tel2305s.zip / INCLUDE / DOMAIN.H < prev    next >
C/C++ Source or Header  |  1992-04-07  |  3KB  |  105 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. #define DOMAIN_H
  27.  
  28. /*
  29. *  special domain data structures
  30. */
  31.  
  32. #define DOMSIZE 512            /* maximum domain message size to mess with */
  33.  
  34. /*
  35. *  Header for the DOMAIN queries
  36. *  ALL OF THESE ARE BYTE SWAPPED QUANTITIES!
  37. *
  38. */
  39. struct dhead {
  40.     uint16    ident,            /* unique identifier */
  41.         flags,
  42.         qdcount,            /* question section, # of entries */
  43.         ancount,            /* answers, how many */
  44.         nscount,            /* count of name server RRs */
  45.         arcount;            /* number of "additional" records */
  46. };
  47.  
  48. /*
  49.  *  flag masks for the flags field of the DOMAIN header
  50.  */
  51. #define DQR            0x8000            /* query=0, response=1 */
  52. #define DOPCODE        0x7100            /* opcode, see below */
  53. #define DAA            0x0400            /* Authoritative answer */
  54. #define DTC            0x0200            /* Truncation, response was cut off at 512 */
  55. #define DRD            0x0100            /* Recursion desired */
  56. #define DRA            0x0080            /* Recursion available */
  57. #define DRCODE        0x000F            /* response code, see below */
  58.  
  59. /* opcode possible values: */
  60. #define DOPQUERY    0            /* a standard query */
  61. #define DOPIQ        1            /* an inverse query */
  62. #define DOPCQM        2            /* a completion query, multiple reply */
  63. #define DOPCQU        3             /* a completion query, single reply */
  64.  
  65. /* the rest reserved for future */
  66. /* legal response codes: */
  67. #define DROK        0                /* okay response */
  68. #define DRFORM        1                /* format error */
  69. #define DRFAIL        2                /* their problem, server failed */
  70. #define DRNAME        3                /* name error, we know name doesn't exist */
  71. #define DRNOPE        4                /* no can do request */
  72. #define DRNOWAY        5                /* name server refusing to do request */
  73. #define DTYPEA        1                /* host address resource record (RR) */
  74. #define DTYPEPTR    12                /* a domain name ptr */
  75. #define DIN            1                /* ARPA internet class */
  76. #define DWILD        255                /* wildcard for several of the classifications */
  77.  
  78. /*
  79.  *  a resource record is made up of a compressed domain name followed by
  80.  *  this structure.  All of these ints need to be byteswapped before use.
  81.  */
  82. struct rrpart {
  83.     uint16    rtype,                    /* resource record type=DTYPEA */
  84.             rclass;                    /* RR class=DIN */
  85.     uint32    rttl;                    /* time-to-live, changed to 32 bits */
  86.     uint16    rdlength;                /* length of next field */
  87.     uint8    rdata[DOMSIZE];            /* data field */
  88. };
  89.  
  90. /*
  91. *  data for domain name lookup
  92. */
  93. #ifdef OLD_WAY
  94. #ifndef DOMAINMASTER
  95. extern
  96. #endif
  97. static
  98. struct useek {
  99.     struct dhead h;
  100.     uint8 x[DOMSIZE];
  101. } question;
  102. #endif
  103.  
  104. #endif
  105.