/contrib/bind9/lib/dns/include/dns/types.h

https://bitbucket.org/freebsd/freebsd-head/ · C Header · 376 lines · 263 code · 45 blank · 68 comment · 8 complexity · 4af266018305c8c72462e533318994da MD5 · raw file

  1. /*
  2. * Copyright (C) 2004-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
  3. * Copyright (C) 1998-2003 Internet Software Consortium.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  10. * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  11. * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  12. * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  14. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. * PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. /* $Id$ */
  18. #ifndef DNS_TYPES_H
  19. #define DNS_TYPES_H 1
  20. /*! \file dns/types.h
  21. * \brief
  22. * Including this file gives you type declarations suitable for use in
  23. * .h files, which lets us avoid circular type reference problems.
  24. * \brief
  25. * To actually use a type or get declarations of its methods, you must
  26. * include the appropriate .h file too.
  27. */
  28. #include <isc/types.h>
  29. typedef struct dns_acache dns_acache_t;
  30. typedef struct dns_acacheentry dns_acacheentry_t;
  31. typedef struct dns_acachestats dns_acachestats_t;
  32. typedef struct dns_acl dns_acl_t;
  33. typedef struct dns_aclelement dns_aclelement_t;
  34. typedef struct dns_aclenv dns_aclenv_t;
  35. typedef struct dns_adb dns_adb_t;
  36. typedef struct dns_adbaddrinfo dns_adbaddrinfo_t;
  37. typedef ISC_LIST(dns_adbaddrinfo_t) dns_adbaddrinfolist_t;
  38. typedef struct dns_adbentry dns_adbentry_t;
  39. typedef struct dns_adbfind dns_adbfind_t;
  40. typedef ISC_LIST(dns_adbfind_t) dns_adbfindlist_t;
  41. typedef struct dns_byaddr dns_byaddr_t;
  42. typedef struct dns_client dns_client_t;
  43. typedef void dns_clientrestrans_t;
  44. typedef void dns_clientreqtrans_t;
  45. typedef void dns_clientupdatetrans_t;
  46. typedef struct dns_cache dns_cache_t;
  47. typedef isc_uint16_t dns_cert_t;
  48. typedef struct dns_compress dns_compress_t;
  49. typedef struct dns_db dns_db_t;
  50. typedef struct dns_dbimplementation dns_dbimplementation_t;
  51. typedef struct dns_dbiterator dns_dbiterator_t;
  52. typedef void dns_dbload_t;
  53. typedef void dns_dbnode_t;
  54. typedef struct dns_dbtable dns_dbtable_t;
  55. typedef void dns_dbversion_t;
  56. typedef struct dns_dlzimplementation dns_dlzimplementation_t;
  57. typedef struct dns_dlzdb dns_dlzdb_t;
  58. typedef struct dns_sdlzimplementation dns_sdlzimplementation_t;
  59. typedef struct dns_decompress dns_decompress_t;
  60. typedef struct dns_dispatch dns_dispatch_t;
  61. typedef struct dns_dispatchevent dns_dispatchevent_t;
  62. typedef struct dns_dispatchlist dns_dispatchlist_t;
  63. typedef struct dns_dispatchmgr dns_dispatchmgr_t;
  64. typedef struct dns_dispentry dns_dispentry_t;
  65. typedef struct dns_dns64 dns_dns64_t;
  66. typedef ISC_LIST(dns_dns64_t) dns_dns64list_t;
  67. typedef struct dns_dnsseckey dns_dnsseckey_t;
  68. typedef ISC_LIST(dns_dnsseckey_t) dns_dnsseckeylist_t;
  69. typedef struct dns_dumpctx dns_dumpctx_t;
  70. typedef struct dns_fetch dns_fetch_t;
  71. typedef struct dns_fixedname dns_fixedname_t;
  72. typedef struct dns_forwarders dns_forwarders_t;
  73. typedef struct dns_fwdtable dns_fwdtable_t;
  74. typedef struct dns_iptable dns_iptable_t;
  75. typedef isc_uint32_t dns_iterations_t;
  76. typedef isc_uint16_t dns_keyflags_t;
  77. typedef struct dns_keynode dns_keynode_t;
  78. typedef ISC_LIST(dns_keynode_t) dns_keynodelist_t;
  79. typedef struct dns_keytable dns_keytable_t;
  80. typedef isc_uint16_t dns_keytag_t;
  81. typedef struct dns_loadctx dns_loadctx_t;
  82. typedef struct dns_loadmgr dns_loadmgr_t;
  83. typedef struct dns_message dns_message_t;
  84. typedef isc_uint16_t dns_messageid_t;
  85. typedef isc_region_t dns_label_t;
  86. typedef struct dns_lookup dns_lookup_t;
  87. typedef struct dns_name dns_name_t;
  88. typedef ISC_LIST(dns_name_t) dns_namelist_t;
  89. typedef isc_uint16_t dns_opcode_t;
  90. typedef unsigned char dns_offsets_t[128];
  91. typedef struct dns_order dns_order_t;
  92. typedef struct dns_peer dns_peer_t;
  93. typedef struct dns_peerlist dns_peerlist_t;
  94. typedef struct dns_portlist dns_portlist_t;
  95. typedef struct dns_rbt dns_rbt_t;
  96. typedef isc_uint16_t dns_rcode_t;
  97. typedef struct dns_rdata dns_rdata_t;
  98. typedef struct dns_rdatacallbacks dns_rdatacallbacks_t;
  99. typedef isc_uint16_t dns_rdataclass_t;
  100. typedef struct dns_rdatalist dns_rdatalist_t;
  101. typedef struct dns_rdataset dns_rdataset_t;
  102. typedef ISC_LIST(dns_rdataset_t) dns_rdatasetlist_t;
  103. typedef struct dns_rdatasetiter dns_rdatasetiter_t;
  104. typedef isc_uint16_t dns_rdatatype_t;
  105. typedef struct dns_request dns_request_t;
  106. typedef struct dns_requestmgr dns_requestmgr_t;
  107. typedef struct dns_resolver dns_resolver_t;
  108. typedef struct dns_sdbimplementation dns_sdbimplementation_t;
  109. typedef isc_uint8_t dns_secalg_t;
  110. typedef isc_uint8_t dns_secproto_t;
  111. typedef struct dns_signature dns_signature_t;
  112. typedef struct dns_ssurule dns_ssurule_t;
  113. typedef struct dns_ssutable dns_ssutable_t;
  114. typedef struct dns_stats dns_stats_t;
  115. typedef isc_uint32_t dns_rdatastatstype_t;
  116. typedef struct dns_tkeyctx dns_tkeyctx_t;
  117. typedef isc_uint16_t dns_trust_t;
  118. typedef struct dns_tsec dns_tsec_t;
  119. typedef struct dns_tsig_keyring dns_tsig_keyring_t;
  120. typedef struct dns_tsigkey dns_tsigkey_t;
  121. typedef isc_uint32_t dns_ttl_t;
  122. typedef struct dns_validator dns_validator_t;
  123. typedef struct dns_view dns_view_t;
  124. typedef ISC_LIST(dns_view_t) dns_viewlist_t;
  125. typedef struct dns_zone dns_zone_t;
  126. typedef ISC_LIST(dns_zone_t) dns_zonelist_t;
  127. typedef struct dns_zonemgr dns_zonemgr_t;
  128. typedef struct dns_zt dns_zt_t;
  129. /*
  130. * If we are not using GSSAPI, define the types we use as opaque types here.
  131. */
  132. #ifndef GSSAPI
  133. typedef struct not_defined_gss_cred_id *gss_cred_id_t;
  134. typedef struct not_defined_gss_ctx *gss_ctx_id_t;
  135. #endif
  136. typedef struct dst_gssapi_signverifyctx dst_gssapi_signverifyctx_t;
  137. typedef enum {
  138. dns_hash_sha1 = 1
  139. } dns_hash_t;
  140. typedef enum {
  141. dns_fwdpolicy_none = 0,
  142. dns_fwdpolicy_first = 1,
  143. dns_fwdpolicy_only = 2
  144. } dns_fwdpolicy_t;
  145. typedef enum {
  146. dns_namereln_none = 0,
  147. dns_namereln_contains = 1,
  148. dns_namereln_subdomain = 2,
  149. dns_namereln_equal = 3,
  150. dns_namereln_commonancestor = 4
  151. } dns_namereln_t;
  152. typedef enum {
  153. dns_one_answer, dns_many_answers
  154. } dns_transfer_format_t;
  155. typedef enum {
  156. dns_dbtype_zone = 0, dns_dbtype_cache = 1, dns_dbtype_stub = 3
  157. } dns_dbtype_t;
  158. typedef enum {
  159. dns_notifytype_no = 0,
  160. dns_notifytype_yes = 1,
  161. dns_notifytype_explicit = 2,
  162. dns_notifytype_masteronly = 3
  163. } dns_notifytype_t;
  164. typedef enum {
  165. dns_dialuptype_no = 0,
  166. dns_dialuptype_yes = 1,
  167. dns_dialuptype_notify = 2,
  168. dns_dialuptype_notifypassive = 3,
  169. dns_dialuptype_refresh = 4,
  170. dns_dialuptype_passive = 5
  171. } dns_dialuptype_t;
  172. typedef enum {
  173. dns_masterformat_none = 0,
  174. dns_masterformat_text = 1,
  175. dns_masterformat_raw = 2
  176. } dns_masterformat_t;
  177. typedef enum {
  178. dns_v4_aaaa_ok = 0,
  179. dns_v4_aaaa_filter = 1,
  180. dns_v4_aaaa_break_dnssec = 2
  181. } dns_v4_aaaa_t;
  182. /*
  183. * These are generated by gen.c.
  184. */
  185. #include <dns/enumtype.h> /* Provides dns_rdatatype_t. */
  186. #include <dns/enumclass.h> /* Provides dns_rdataclass_t. */
  187. /*%
  188. * rcodes.
  189. */
  190. enum {
  191. /*
  192. * Standard rcodes.
  193. */
  194. dns_rcode_noerror = 0,
  195. #define dns_rcode_noerror ((dns_rcode_t)dns_rcode_noerror)
  196. dns_rcode_formerr = 1,
  197. #define dns_rcode_formerr ((dns_rcode_t)dns_rcode_formerr)
  198. dns_rcode_servfail = 2,
  199. #define dns_rcode_servfail ((dns_rcode_t)dns_rcode_servfail)
  200. dns_rcode_nxdomain = 3,
  201. #define dns_rcode_nxdomain ((dns_rcode_t)dns_rcode_nxdomain)
  202. dns_rcode_notimp = 4,
  203. #define dns_rcode_notimp ((dns_rcode_t)dns_rcode_notimp)
  204. dns_rcode_refused = 5,
  205. #define dns_rcode_refused ((dns_rcode_t)dns_rcode_refused)
  206. dns_rcode_yxdomain = 6,
  207. #define dns_rcode_yxdomain ((dns_rcode_t)dns_rcode_yxdomain)
  208. dns_rcode_yxrrset = 7,
  209. #define dns_rcode_yxrrset ((dns_rcode_t)dns_rcode_yxrrset)
  210. dns_rcode_nxrrset = 8,
  211. #define dns_rcode_nxrrset ((dns_rcode_t)dns_rcode_nxrrset)
  212. dns_rcode_notauth = 9,
  213. #define dns_rcode_notauth ((dns_rcode_t)dns_rcode_notauth)
  214. dns_rcode_notzone = 10,
  215. #define dns_rcode_notzone ((dns_rcode_t)dns_rcode_notzone)
  216. /*
  217. * Extended rcodes.
  218. */
  219. dns_rcode_badvers = 16
  220. #define dns_rcode_badvers ((dns_rcode_t)dns_rcode_badvers)
  221. };
  222. /*%
  223. * TSIG errors.
  224. */
  225. enum {
  226. dns_tsigerror_badsig = 16,
  227. dns_tsigerror_badkey = 17,
  228. dns_tsigerror_badtime = 18,
  229. dns_tsigerror_badmode = 19,
  230. dns_tsigerror_badname = 20,
  231. dns_tsigerror_badalg = 21,
  232. dns_tsigerror_badtrunc = 22
  233. };
  234. /*%
  235. * Opcodes.
  236. */
  237. enum {
  238. dns_opcode_query = 0,
  239. #define dns_opcode_query ((dns_opcode_t)dns_opcode_query)
  240. dns_opcode_iquery = 1,
  241. #define dns_opcode_iquery ((dns_opcode_t)dns_opcode_iquery)
  242. dns_opcode_status = 2,
  243. #define dns_opcode_status ((dns_opcode_t)dns_opcode_status)
  244. dns_opcode_notify = 4,
  245. #define dns_opcode_notify ((dns_opcode_t)dns_opcode_notify)
  246. dns_opcode_update = 5 /* dynamic update */
  247. #define dns_opcode_update ((dns_opcode_t)dns_opcode_update)
  248. };
  249. /*%
  250. * Trust levels. Must be kept in sync with trustnames[] in masterdump.c.
  251. */
  252. enum {
  253. /* Sentinel value; no data should have this trust level. */
  254. dns_trust_none = 0,
  255. #define dns_trust_none ((dns_trust_t)dns_trust_none)
  256. /*%
  257. * Subject to DNSSEC validation but has not yet been validated
  258. * dns_trust_pending_additional (from the additional section).
  259. */
  260. dns_trust_pending_additional = 1,
  261. #define dns_trust_pending_additional \
  262. ((dns_trust_t)dns_trust_pending_additional)
  263. dns_trust_pending_answer = 2,
  264. #define dns_trust_pending_answer ((dns_trust_t)dns_trust_pending_answer)
  265. /*% Received in the additional section of a response. */
  266. dns_trust_additional = 3,
  267. #define dns_trust_additional ((dns_trust_t)dns_trust_additional)
  268. /* Received in a referral response. */
  269. dns_trust_glue = 4,
  270. #define dns_trust_glue ((dns_trust_t)dns_trust_glue)
  271. /* Answer from a non-authoritative server */
  272. dns_trust_answer = 5,
  273. #define dns_trust_answer ((dns_trust_t)dns_trust_answer)
  274. /* Received in the authority section as part of an
  275. authoritative response */
  276. dns_trust_authauthority = 6,
  277. #define dns_trust_authauthority ((dns_trust_t)dns_trust_authauthority)
  278. /* Answer from an authoritative server */
  279. dns_trust_authanswer = 7,
  280. #define dns_trust_authanswer ((dns_trust_t)dns_trust_authanswer)
  281. /* Successfully DNSSEC validated */
  282. dns_trust_secure = 8,
  283. #define dns_trust_secure ((dns_trust_t)dns_trust_secure)
  284. /* This server is authoritative */
  285. dns_trust_ultimate = 9
  286. #define dns_trust_ultimate ((dns_trust_t)dns_trust_ultimate)
  287. };
  288. #define DNS_TRUST_PENDING(x) ((x) == dns_trust_pending_answer || \
  289. (x) == dns_trust_pending_additional)
  290. #define DNS_TRUST_ADDITIONAL(x) ((x) == dns_trust_additional || \
  291. (x) == dns_trust_pending_additional)
  292. #define DNS_TRUST_GLUE(x) ((x) == dns_trust_glue)
  293. #define DNS_TRUST_ANSWER(x) ((x) == dns_trust_answer)
  294. /*%
  295. * Name checking severities.
  296. */
  297. typedef enum {
  298. dns_severity_ignore,
  299. dns_severity_warn,
  300. dns_severity_fail
  301. } dns_severity_t;
  302. /*
  303. * Functions.
  304. */
  305. typedef void
  306. (*dns_dumpdonefunc_t)(void *, isc_result_t);
  307. typedef void
  308. (*dns_loaddonefunc_t)(void *, isc_result_t);
  309. typedef isc_result_t
  310. (*dns_addrdatasetfunc_t)(void *, dns_name_t *, dns_rdataset_t *);
  311. typedef isc_result_t
  312. (*dns_additionaldatafunc_t)(void *, dns_name_t *, dns_rdatatype_t);
  313. typedef isc_result_t
  314. (*dns_digestfunc_t)(void *, isc_region_t *);
  315. typedef void
  316. (*dns_xfrindone_t)(dns_zone_t *, isc_result_t);
  317. typedef void
  318. (*dns_updatecallback_t)(void *, isc_result_t, dns_message_t *);
  319. typedef int
  320. (*dns_rdatasetorderfunc_t)(const dns_rdata_t *, const void *);
  321. typedef isc_boolean_t
  322. (*dns_checkmxfunc_t)(dns_zone_t *, dns_name_t *, dns_name_t *);
  323. typedef isc_boolean_t
  324. (*dns_checksrvfunc_t)(dns_zone_t *, dns_name_t *, dns_name_t *);
  325. typedef isc_boolean_t
  326. (*dns_checknsfunc_t)(dns_zone_t *, dns_name_t *, dns_name_t *,
  327. dns_rdataset_t *, dns_rdataset_t *);
  328. typedef isc_boolean_t
  329. (*dns_isselffunc_t)(dns_view_t *, dns_tsigkey_t *, isc_sockaddr_t *,
  330. isc_sockaddr_t *, dns_rdataclass_t, void *);
  331. #endif /* DNS_TYPES_H */