nameser_compat.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /* Copyright (c) 1983, 1989
  2. * The Regents of the University of California. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * 4. Neither the name of the University nor the names of its contributors
  13. * may be used to endorse or promote products derived from this software
  14. * without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  17. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  20. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26. * SUCH DAMAGE.
  27. */
  28. /*
  29. * from nameser.h 8.1 (Berkeley) 6/2/93
  30. * $BINDId: nameser_compat.h,v 8.11 1999/01/02 08:00:58 vixie Exp $
  31. */
  32. #ifndef _ARPA_NAMESER_COMPAT_
  33. #define _ARPA_NAMESER_COMPAT_
  34. #define __BIND 19950621 /* (DEAD) interface version stamp. */
  35. #include <endian.h>
  36. /*
  37. * Structure for query header. The order of the fields is machine- and
  38. * compiler-dependent, depending on the byte/bit order and the layout
  39. * of bit fields. We use bit fields only in int variables, as this
  40. * is all ANSI requires. This requires a somewhat confusing rearrangement.
  41. */
  42. typedef struct {
  43. unsigned id :16; /* query identification number */
  44. #if BYTE_ORDER == BIG_ENDIAN
  45. /* fields in third byte */
  46. unsigned qr: 1; /* response flag */
  47. unsigned opcode: 4; /* purpose of message */
  48. unsigned aa: 1; /* authoritive answer */
  49. unsigned tc: 1; /* truncated message */
  50. unsigned rd: 1; /* recursion desired */
  51. /* fields in fourth byte */
  52. unsigned ra: 1; /* recursion available */
  53. unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
  54. unsigned ad: 1; /* authentic data from named */
  55. unsigned cd: 1; /* checking disabled by resolver */
  56. unsigned rcode :4; /* response code */
  57. #endif
  58. #if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
  59. /* fields in third byte */
  60. unsigned rd :1; /* recursion desired */
  61. unsigned tc :1; /* truncated message */
  62. unsigned aa :1; /* authoritive answer */
  63. unsigned opcode :4; /* purpose of message */
  64. unsigned qr :1; /* response flag */
  65. /* fields in fourth byte */
  66. unsigned rcode :4; /* response code */
  67. unsigned cd: 1; /* checking disabled by resolver */
  68. unsigned ad: 1; /* authentic data from named */
  69. unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
  70. unsigned ra :1; /* recursion available */
  71. #endif
  72. /* remaining bytes */
  73. unsigned qdcount :16; /* number of question entries */
  74. unsigned ancount :16; /* number of answer entries */
  75. unsigned nscount :16; /* number of authority entries */
  76. unsigned arcount :16; /* number of resource entries */
  77. } HEADER;
  78. #define PACKETSZ NS_PACKETSZ
  79. #define MAXDNAME NS_MAXDNAME
  80. #define MAXCDNAME NS_MAXCDNAME
  81. #define MAXLABEL NS_MAXLABEL
  82. #define HFIXEDSZ NS_HFIXEDSZ
  83. #define QFIXEDSZ NS_QFIXEDSZ
  84. #define RRFIXEDSZ NS_RRFIXEDSZ
  85. #define INT32SZ NS_INT32SZ
  86. #define INT16SZ NS_INT16SZ
  87. #define INADDRSZ NS_INADDRSZ
  88. #define IN6ADDRSZ NS_IN6ADDRSZ
  89. #define INDIR_MASK NS_CMPRSFLGS
  90. #define NAMESERVER_PORT NS_DEFAULTPORT
  91. #define S_ZONE ns_s_zn
  92. #define S_PREREQ ns_s_pr
  93. #define S_UPDATE ns_s_ud
  94. #define S_ADDT ns_s_ar
  95. #define QUERY ns_o_query
  96. #define IQUERY ns_o_iquery
  97. #define STATUS ns_o_status
  98. #define NS_NOTIFY_OP ns_o_notify
  99. #define NS_UPDATE_OP ns_o_update
  100. #define NOERROR ns_r_noerror
  101. #define FORMERR ns_r_formerr
  102. #define SERVFAIL ns_r_servfail
  103. #define NXDOMAIN ns_r_nxdomain
  104. #define NOTIMP ns_r_notimpl
  105. #define REFUSED ns_r_refused
  106. #define YXDOMAIN ns_r_yxdomain
  107. #define YXRRSET ns_r_yxrrset
  108. #define NXRRSET ns_r_nxrrset
  109. #define NOTAUTH ns_r_notauth
  110. #define NOTZONE ns_r_notzone
  111. /*#define BADSIG ns_r_badsig*/
  112. /*#define BADKEY ns_r_badkey*/
  113. /*#define BADTIME ns_r_badtime*/
  114. #define DELETE ns_uop_delete
  115. #define ADD ns_uop_add
  116. #define T_A ns_t_a
  117. #define T_NS ns_t_ns
  118. #define T_MD ns_t_md
  119. #define T_MF ns_t_mf
  120. #define T_CNAME ns_t_cname
  121. #define T_SOA ns_t_soa
  122. #define T_MB ns_t_mb
  123. #define T_MG ns_t_mg
  124. #define T_MR ns_t_mr
  125. #define T_NULL ns_t_null
  126. #define T_WKS ns_t_wks
  127. #define T_PTR ns_t_ptr
  128. #define T_HINFO ns_t_hinfo
  129. #define T_MINFO ns_t_minfo
  130. #define T_MX ns_t_mx
  131. #define T_TXT ns_t_txt
  132. #define T_RP ns_t_rp
  133. #define T_AFSDB ns_t_afsdb
  134. #define T_X25 ns_t_x25
  135. #define T_ISDN ns_t_isdn
  136. #define T_RT ns_t_rt
  137. #define T_NSAP ns_t_nsap
  138. #define T_NSAP_PTR ns_t_nsap_ptr
  139. #define T_SIG ns_t_sig
  140. #define T_KEY ns_t_key
  141. #define T_PX ns_t_px
  142. #define T_GPOS ns_t_gpos
  143. #define T_AAAA ns_t_aaaa
  144. #define T_LOC ns_t_loc
  145. #define T_NXT ns_t_nxt
  146. #define T_EID ns_t_eid
  147. #define T_NIMLOC ns_t_nimloc
  148. #define T_SRV ns_t_srv
  149. #define T_ATMA ns_t_atma
  150. #define T_NAPTR ns_t_naptr
  151. #define T_TSIG ns_t_tsig
  152. #define T_IXFR ns_t_ixfr
  153. #define T_AXFR ns_t_axfr
  154. #define T_MAILB ns_t_mailb
  155. #define T_MAILA ns_t_maila
  156. #define T_ANY ns_t_any
  157. #define C_IN ns_c_in
  158. #define C_CHAOS ns_c_chaos
  159. #define C_HS ns_c_hs
  160. /* BIND_UPDATE */
  161. #define C_NONE ns_c_none
  162. #define C_ANY ns_c_any
  163. #define GETSHORT NS_GET16
  164. #define GETLONG NS_GET32
  165. #define PUTSHORT NS_PUT16
  166. #define PUTLONG NS_PUT32
  167. #endif /* _ARPA_NAMESER_COMPAT_ */