nameser_compat.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. #ifndef _ARPA_NAMESER_COMPAT_
  29. #define _ARPA_NAMESER_COMPAT_
  30. #include <endian.h>
  31. /*%
  32. * Structure for query header. The order of the fields is machine- and
  33. * compiler-dependent, depending on the byte/bit order and the layout
  34. * of bit fields. We use bit fields only in int variables, as this
  35. * is all ANSI requires. This requires a somewhat confusing rearrangement.
  36. */
  37. typedef struct {
  38. unsigned id :16; /*%< query identification number */
  39. #if __BYTE_ORDER == __BIG_ENDIAN
  40. /* fields in third byte */
  41. unsigned qr: 1; /*%< response flag */
  42. unsigned opcode: 4; /*%< purpose of message */
  43. unsigned aa: 1; /*%< authoritive answer */
  44. unsigned tc: 1; /*%< truncated message */
  45. unsigned rd: 1; /*%< recursion desired */
  46. /* fields in fourth byte */
  47. unsigned ra: 1; /*%< recursion available */
  48. unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
  49. unsigned ad: 1; /*%< authentic data from named */
  50. unsigned cd: 1; /*%< checking disabled by resolver */
  51. unsigned rcode :4; /*%< response code */
  52. #endif
  53. #if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN
  54. /* fields in third byte */
  55. unsigned rd :1; /*%< recursion desired */
  56. unsigned tc :1; /*%< truncated message */
  57. unsigned aa :1; /*%< authoritive answer */
  58. unsigned opcode :4; /*%< purpose of message */
  59. unsigned qr :1; /*%< response flag */
  60. /* fields in fourth byte */
  61. unsigned rcode :4; /*%< response code */
  62. unsigned cd: 1; /*%< checking disabled by resolver */
  63. unsigned ad: 1; /*%< authentic data from named */
  64. unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
  65. unsigned ra :1; /*%< recursion available */
  66. #endif
  67. /* remaining bytes */
  68. unsigned qdcount :16; /*%< number of question entries */
  69. unsigned ancount :16; /*%< number of answer entries */
  70. unsigned nscount :16; /*%< number of authority entries */
  71. unsigned arcount :16; /*%< number of resource entries */
  72. } HEADER;
  73. #define PACKETSZ NS_PACKETSZ
  74. #define MAXDNAME NS_MAXDNAME
  75. #define MAXCDNAME NS_MAXCDNAME
  76. #define MAXLABEL NS_MAXLABEL
  77. #define HFIXEDSZ NS_HFIXEDSZ
  78. #define QFIXEDSZ NS_QFIXEDSZ
  79. #define RRFIXEDSZ NS_RRFIXEDSZ
  80. #define INT32SZ NS_INT32SZ
  81. #define INT16SZ NS_INT16SZ
  82. #define INT8SZ NS_INT8SZ
  83. #define INADDRSZ NS_INADDRSZ
  84. #define IN6ADDRSZ NS_IN6ADDRSZ
  85. #define INDIR_MASK NS_CMPRSFLGS
  86. #define NAMESERVER_PORT NS_DEFAULTPORT
  87. #define S_ZONE ns_s_zn
  88. #define S_PREREQ ns_s_pr
  89. #define S_UPDATE ns_s_ud
  90. #define S_ADDT ns_s_ar
  91. #define QUERY ns_o_query
  92. #define IQUERY ns_o_iquery
  93. #define STATUS ns_o_status
  94. #define NS_NOTIFY_OP ns_o_notify
  95. #define NS_UPDATE_OP ns_o_update
  96. #define NOERROR ns_r_noerror
  97. #define FORMERR ns_r_formerr
  98. #define SERVFAIL ns_r_servfail
  99. #define NXDOMAIN ns_r_nxdomain
  100. #define NOTIMP ns_r_notimpl
  101. #define REFUSED ns_r_refused
  102. #define YXDOMAIN ns_r_yxdomain
  103. #define YXRRSET ns_r_yxrrset
  104. #define NXRRSET ns_r_nxrrset
  105. #define NOTAUTH ns_r_notauth
  106. #define NOTZONE ns_r_notzone
  107. /*#define BADSIG ns_r_badsig*/
  108. /*#define BADKEY ns_r_badkey*/
  109. /*#define BADTIME ns_r_badtime*/
  110. #define DELETE ns_uop_delete
  111. #define ADD ns_uop_add
  112. #define T_A ns_t_a
  113. #define T_NS ns_t_ns
  114. #define T_MD ns_t_md
  115. #define T_MF ns_t_mf
  116. #define T_CNAME ns_t_cname
  117. #define T_SOA ns_t_soa
  118. #define T_MB ns_t_mb
  119. #define T_MG ns_t_mg
  120. #define T_MR ns_t_mr
  121. #define T_NULL ns_t_null
  122. #define T_WKS ns_t_wks
  123. #define T_PTR ns_t_ptr
  124. #define T_HINFO ns_t_hinfo
  125. #define T_MINFO ns_t_minfo
  126. #define T_MX ns_t_mx
  127. #define T_TXT ns_t_txt
  128. #define T_RP ns_t_rp
  129. #define T_AFSDB ns_t_afsdb
  130. #define T_X25 ns_t_x25
  131. #define T_ISDN ns_t_isdn
  132. #define T_RT ns_t_rt
  133. #define T_NSAP ns_t_nsap
  134. #define T_NSAP_PTR ns_t_nsap_ptr
  135. #define T_SIG ns_t_sig
  136. #define T_KEY ns_t_key
  137. #define T_PX ns_t_px
  138. #define T_GPOS ns_t_gpos
  139. #define T_AAAA ns_t_aaaa
  140. #define T_LOC ns_t_loc
  141. #define T_NXT ns_t_nxt
  142. #define T_EID ns_t_eid
  143. #define T_NIMLOC ns_t_nimloc
  144. #define T_SRV ns_t_srv
  145. #define T_ATMA ns_t_atma
  146. #define T_NAPTR ns_t_naptr
  147. #define T_KX ns_t_kx
  148. #define T_CERT ns_t_cert
  149. #define T_A6 ns_t_a6
  150. #define T_DNAME ns_t_dname
  151. #define T_SINK ns_t_sink
  152. #define T_OPT ns_t_opt
  153. #define T_APL ns_t_apl
  154. #define T_DS ns_t_ds
  155. #define T_SSHFP ns_t_sshfp
  156. #define T_IPSECKEY ns_t_ipseckey
  157. #define T_RRSIG ns_t_rrsig
  158. #define T_NSEC ns_t_nsec
  159. #define T_DNSKEY ns_t_dnskey
  160. #define T_DHCID ns_t_dhcid
  161. #define T_NSEC3 ns_t_nsec3
  162. #define T_NSEC3PARAM ns_t_nsec3param
  163. #define T_TLSA ns_t_tlsa
  164. #define T_SMIMEA ns_t_smimea
  165. #define T_HIP ns_t_hip
  166. #define T_NINFO ns_t_ninfo
  167. #define T_RKEY ns_t_rkey
  168. #define T_TALINK ns_t_talink
  169. #define T_CDS ns_t_cds
  170. #define T_CDNSKEY ns_t_cdnskey
  171. #define T_OPENPGPKEY ns_t_openpgpkey
  172. #define T_CSYNC ns_t_csync
  173. #define T_SPF ns_t_spf
  174. #define T_UINFO ns_t_uinfo
  175. #define T_UID ns_t_uid
  176. #define T_GID ns_t_gid
  177. #define T_UNSPEC ns_t_unspec
  178. #define T_NID ns_t_nid
  179. #define T_L32 ns_t_l32
  180. #define T_L64 ns_t_l64
  181. #define T_LP ns_t_lp
  182. #define T_EUI48 ns_t_eui48
  183. #define T_EUI64 ns_t_eui64
  184. #define T_TKEY ns_t_tkey
  185. #define T_TSIG ns_t_tsig
  186. #define T_IXFR ns_t_ixfr
  187. #define T_AXFR ns_t_axfr
  188. #define T_MAILB ns_t_mailb
  189. #define T_MAILA ns_t_maila
  190. #define T_ANY ns_t_any
  191. #define T_URI ns_t_uri
  192. #define T_CAA ns_t_caa
  193. #define T_AVC ns_t_avc
  194. #define T_TA ns_t_ta
  195. #define T_DLV ns_t_dlv
  196. #define C_IN ns_c_in
  197. #define C_CHAOS ns_c_chaos
  198. #define C_HS ns_c_hs
  199. /* BIND_UPDATE */
  200. #define C_NONE ns_c_none
  201. #define C_ANY ns_c_any
  202. #define GETSHORT NS_GET16
  203. #define GETLONG NS_GET32
  204. #define PUTSHORT NS_PUT16
  205. #define PUTLONG NS_PUT32
  206. #endif /* _ARPA_NAMESER_COMPAT_ */
  207. /*! \file */