nameser_compat.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 <apt-pkg/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 INT8SZ NS_INT8SZ
  88. #define INADDRSZ NS_INADDRSZ
  89. #define IN6ADDRSZ NS_IN6ADDRSZ
  90. #define INDIR_MASK NS_CMPRSFLGS
  91. #define NAMESERVER_PORT NS_DEFAULTPORT
  92. #define S_ZONE ns_s_zn
  93. #define S_PREREQ ns_s_pr
  94. #define S_UPDATE ns_s_ud
  95. #define S_ADDT ns_s_ar
  96. #define QUERY ns_o_query
  97. #define IQUERY ns_o_iquery
  98. #define STATUS ns_o_status
  99. #define NS_NOTIFY_OP ns_o_notify
  100. #define NS_UPDATE_OP ns_o_update
  101. #define NOERROR ns_r_noerror
  102. #define FORMERR ns_r_formerr
  103. #define SERVFAIL ns_r_servfail
  104. #define NXDOMAIN ns_r_nxdomain
  105. #define NOTIMP ns_r_notimpl
  106. #define REFUSED ns_r_refused
  107. #define YXDOMAIN ns_r_yxdomain
  108. #define YXRRSET ns_r_yxrrset
  109. #define NXRRSET ns_r_nxrrset
  110. #define NOTAUTH ns_r_notauth
  111. #define NOTZONE ns_r_notzone
  112. /*#define BADSIG ns_r_badsig*/
  113. /*#define BADKEY ns_r_badkey*/
  114. /*#define BADTIME ns_r_badtime*/
  115. #define DELETE ns_uop_delete
  116. #define ADD ns_uop_add
  117. #define T_A ns_t_a
  118. #define T_NS ns_t_ns
  119. #define T_MD ns_t_md
  120. #define T_MF ns_t_mf
  121. #define T_CNAME ns_t_cname
  122. #define T_SOA ns_t_soa
  123. #define T_MB ns_t_mb
  124. #define T_MG ns_t_mg
  125. #define T_MR ns_t_mr
  126. #define T_NULL ns_t_null
  127. #define T_WKS ns_t_wks
  128. #define T_PTR ns_t_ptr
  129. #define T_HINFO ns_t_hinfo
  130. #define T_MINFO ns_t_minfo
  131. #define T_MX ns_t_mx
  132. #define T_TXT ns_t_txt
  133. #define T_RP ns_t_rp
  134. #define T_AFSDB ns_t_afsdb
  135. #define T_X25 ns_t_x25
  136. #define T_ISDN ns_t_isdn
  137. #define T_RT ns_t_rt
  138. #define T_NSAP ns_t_nsap
  139. #define T_NSAP_PTR ns_t_nsap_ptr
  140. #define T_SIG ns_t_sig
  141. #define T_KEY ns_t_key
  142. #define T_PX ns_t_px
  143. #define T_GPOS ns_t_gpos
  144. #define T_AAAA ns_t_aaaa
  145. #define T_LOC ns_t_loc
  146. #define T_NXT ns_t_nxt
  147. #define T_EID ns_t_eid
  148. #define T_NIMLOC ns_t_nimloc
  149. #define T_SRV ns_t_srv
  150. #define T_ATMA ns_t_atma
  151. #define T_NAPTR ns_t_naptr
  152. #define T_A6 ns_t_a6
  153. #define T_DNAME ns_t_dname
  154. #define T_TSIG ns_t_tsig
  155. #define T_IXFR ns_t_ixfr
  156. #define T_AXFR ns_t_axfr
  157. #define T_MAILB ns_t_mailb
  158. #define T_MAILA ns_t_maila
  159. #define T_ANY ns_t_any
  160. #define C_IN ns_c_in
  161. #define C_CHAOS ns_c_chaos
  162. #define C_HS ns_c_hs
  163. /* BIND_UPDATE */
  164. #define C_NONE ns_c_none
  165. #define C_ANY ns_c_any
  166. #define GETSHORT NS_GET16
  167. #define GETLONG NS_GET32
  168. #define PUTSHORT NS_PUT16
  169. #define PUTLONG NS_PUT32
  170. #endif /* _ARPA_NAMESER_COMPAT_ */
  171. /*! \file */