1*c0b5d9fbSchristos /*	$NetBSD: types.h,v 1.7 2022/09/23 12:15:30 christos Exp $	*/
2e2b1b9c0Schristos 
3e2b1b9c0Schristos /*
4e2b1b9c0Schristos  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5e2b1b9c0Schristos  *
6*c0b5d9fbSchristos  * SPDX-License-Identifier: MPL-2.0
7*c0b5d9fbSchristos  *
8e2b1b9c0Schristos  * This Source Code Form is subject to the terms of the Mozilla Public
9e2b1b9c0Schristos  * License, v. 2.0. If a copy of the MPL was not distributed with this
1073584a28Schristos  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11e2b1b9c0Schristos  *
12e2b1b9c0Schristos  * See the COPYRIGHT file distributed with this work for additional
13e2b1b9c0Schristos  * information regarding copyright ownership.
14e2b1b9c0Schristos  */
15e2b1b9c0Schristos 
16e2b1b9c0Schristos #ifndef DNS_TYPES_H
17e2b1b9c0Schristos #define DNS_TYPES_H 1
18e2b1b9c0Schristos 
19e2b1b9c0Schristos /*! \file dns/types.h
20e2b1b9c0Schristos  * \brief
21e2b1b9c0Schristos  * Including this file gives you type declarations suitable for use in
22e2b1b9c0Schristos  * .h files, which lets us avoid circular type reference problems.
23e2b1b9c0Schristos  * \brief
24e2b1b9c0Schristos  * To actually use a type or get declarations of its methods, you must
25e2b1b9c0Schristos  * include the appropriate .h file too.
26e2b1b9c0Schristos  */
27e2b1b9c0Schristos 
289742fdb4Schristos #include <inttypes.h>
29f2e20987Schristos #include <stdbool.h>
30e2b1b9c0Schristos #include <stdio.h>
31e2b1b9c0Schristos 
32e2b1b9c0Schristos #include <isc/types.h>
33e2b1b9c0Schristos 
34e2b1b9c0Schristos typedef struct dns_acl	       dns_acl_t;
35e2b1b9c0Schristos typedef struct dns_aclelement  dns_aclelement_t;
36e2b1b9c0Schristos typedef struct dns_aclenv      dns_aclenv_t;
37e2b1b9c0Schristos typedef struct dns_adb	       dns_adb_t;
38e2b1b9c0Schristos typedef struct dns_adbaddrinfo dns_adbaddrinfo_t;
39e2b1b9c0Schristos typedef ISC_LIST(dns_adbaddrinfo_t) dns_adbaddrinfolist_t;
40e2b1b9c0Schristos typedef struct dns_adbentry dns_adbentry_t;
41e2b1b9c0Schristos typedef struct dns_adbfind  dns_adbfind_t;
42e2b1b9c0Schristos typedef ISC_LIST(dns_adbfind_t) dns_adbfindlist_t;
43e2b1b9c0Schristos typedef struct dns_badcache	       dns_badcache_t;
44e2b1b9c0Schristos typedef struct dns_byaddr	       dns_byaddr_t;
45e2b1b9c0Schristos typedef struct dns_catz_zonemodmethods dns_catz_zonemodmethods_t;
46e2b1b9c0Schristos typedef struct dns_catz_entry_options  dns_catz_options_t;
47e2b1b9c0Schristos typedef struct dns_catz_entry	       dns_catz_entry_t;
48e2b1b9c0Schristos typedef struct dns_catz_zone	       dns_catz_zone_t;
49e2b1b9c0Schristos typedef struct dns_catz_changed	       dns_catz_changed_t;
50e2b1b9c0Schristos typedef struct dns_catz_zones	       dns_catz_zones_t;
51e2b1b9c0Schristos typedef struct dns_client	       dns_client_t;
52e2b1b9c0Schristos typedef void			       dns_clientrestrans_t;
53e2b1b9c0Schristos typedef void			       dns_clientreqtrans_t;
54e2b1b9c0Schristos typedef void			       dns_clientupdatetrans_t;
55e2b1b9c0Schristos typedef struct dns_cache	       dns_cache_t;
56f2e20987Schristos typedef uint16_t		       dns_cert_t;
57e2b1b9c0Schristos typedef struct dns_compress	       dns_compress_t;
58e2b1b9c0Schristos typedef struct dns_db		       dns_db_t;
59e2b1b9c0Schristos typedef struct dns_dbimplementation    dns_dbimplementation_t;
60e2b1b9c0Schristos typedef struct dns_dbiterator	       dns_dbiterator_t;
61e2b1b9c0Schristos typedef void			       dns_dbload_t;
62e2b1b9c0Schristos typedef void			       dns_dbnode_t;
63e2b1b9c0Schristos typedef struct dns_dbonupdatelistener  dns_dbonupdatelistener_t;
64e2b1b9c0Schristos typedef struct dns_dbtable	       dns_dbtable_t;
65e2b1b9c0Schristos typedef void			       dns_dbversion_t;
66e2b1b9c0Schristos typedef struct dns_dlzimplementation   dns_dlzimplementation_t;
67e2b1b9c0Schristos typedef struct dns_dlzdb	       dns_dlzdb_t;
68e2b1b9c0Schristos typedef ISC_LIST(dns_dlzdb_t) dns_dlzdblist_t;
69e2b1b9c0Schristos typedef struct dns_dyndbctx	      dns_dyndbctx_t;
70e2b1b9c0Schristos typedef struct dns_sdlzimplementation dns_sdlzimplementation_t;
71e2b1b9c0Schristos typedef struct dns_decompress	      dns_decompress_t;
72e2b1b9c0Schristos typedef struct dns_dispatch	      dns_dispatch_t;
73e2b1b9c0Schristos typedef struct dns_dispatchevent      dns_dispatchevent_t;
74e2b1b9c0Schristos typedef struct dns_dispatchlist	      dns_dispatchlist_t;
75e2b1b9c0Schristos typedef struct dns_dispatchset	      dns_dispatchset_t;
76e2b1b9c0Schristos typedef struct dns_dispatchmgr	      dns_dispatchmgr_t;
77e2b1b9c0Schristos typedef struct dns_dispentry	      dns_dispentry_t;
78e2b1b9c0Schristos typedef struct dns_dns64	      dns_dns64_t;
79e2b1b9c0Schristos typedef ISC_LIST(dns_dns64_t) dns_dns64list_t;
80e2b1b9c0Schristos typedef struct dns_dnsseckey dns_dnsseckey_t;
81e2b1b9c0Schristos typedef ISC_LIST(dns_dnsseckey_t) dns_dnsseckeylist_t;
82f2e20987Schristos typedef uint8_t			   dns_dsdigest_t;
83e2b1b9c0Schristos typedef struct dns_dtdata	   dns_dtdata_t;
84e2b1b9c0Schristos typedef struct dns_dtenv	   dns_dtenv_t;
85e2b1b9c0Schristos typedef struct dns_dtmsg	   dns_dtmsg_t;
86f2e20987Schristos typedef uint16_t		   dns_dtmsgtype_t;
87e2b1b9c0Schristos typedef struct dns_dumpctx	   dns_dumpctx_t;
88e2b1b9c0Schristos typedef struct dns_ecs		   dns_ecs_t;
89e2b1b9c0Schristos typedef struct dns_ednsopt	   dns_ednsopt_t;
90e2b1b9c0Schristos typedef struct dns_fetch	   dns_fetch_t;
91e2b1b9c0Schristos typedef struct dns_fixedname	   dns_fixedname_t;
92e2b1b9c0Schristos typedef struct dns_forwarders	   dns_forwarders_t;
93e2b1b9c0Schristos typedef struct dns_forwarder	   dns_forwarder_t;
94e2b1b9c0Schristos typedef struct dns_fwdtable	   dns_fwdtable_t;
959ad14dd7Schristos typedef struct dns_geoip_databases dns_geoip_databases_t;
96e2b1b9c0Schristos typedef struct dns_iptable	   dns_iptable_t;
97f2e20987Schristos typedef uint32_t		   dns_iterations_t;
989742fdb4Schristos typedef struct dns_kasp		   dns_kasp_t;
999742fdb4Schristos typedef ISC_LIST(dns_kasp_t) dns_kasplist_t;
1009742fdb4Schristos typedef struct dns_kasp_key dns_kasp_key_t;
1019742fdb4Schristos typedef ISC_LIST(dns_kasp_key_t) dns_kasp_keylist_t;
10273584a28Schristos typedef struct dns_kasp_nsec3param dns_kasp_nsec3param_t;
103f2e20987Schristos typedef uint16_t		   dns_keyflags_t;
104e2b1b9c0Schristos typedef struct dns_keynode	   dns_keynode_t;
105e2b1b9c0Schristos typedef ISC_LIST(dns_keynode_t) dns_keynodelist_t;
106e2b1b9c0Schristos typedef struct dns_keytable	   dns_keytable_t;
107f2e20987Schristos typedef uint16_t		   dns_keytag_t;
108e2b1b9c0Schristos typedef struct dns_loadctx	   dns_loadctx_t;
109e2b1b9c0Schristos typedef struct dns_loadmgr	   dns_loadmgr_t;
110e2b1b9c0Schristos typedef struct dns_masterrawheader dns_masterrawheader_t;
111f2e20987Schristos typedef uint64_t		   dns_masterstyle_flags_t;
112e2b1b9c0Schristos typedef struct dns_message	   dns_message_t;
113f2e20987Schristos typedef uint16_t		   dns_messageid_t;
114e2b1b9c0Schristos typedef isc_region_t		   dns_label_t;
115e2b1b9c0Schristos typedef struct dns_lookup	   dns_lookup_t;
116e2b1b9c0Schristos typedef struct dns_name		   dns_name_t;
117e2b1b9c0Schristos typedef ISC_LIST(dns_name_t) dns_namelist_t;
118e2b1b9c0Schristos typedef struct dns_nta		  dns_nta_t;
119e2b1b9c0Schristos typedef struct dns_ntatable	  dns_ntatable_t;
120f2e20987Schristos typedef uint16_t		  dns_opcode_t;
121e2b1b9c0Schristos typedef unsigned char		  dns_offsets_t[128];
122e2b1b9c0Schristos typedef struct dns_order	  dns_order_t;
123e2b1b9c0Schristos typedef struct dns_peer		  dns_peer_t;
124e2b1b9c0Schristos typedef struct dns_peerlist	  dns_peerlist_t;
125e2b1b9c0Schristos typedef struct dns_portlist	  dns_portlist_t;
126e2b1b9c0Schristos typedef struct dns_rbt		  dns_rbt_t;
127f2e20987Schristos typedef uint16_t		  dns_rcode_t;
128e2b1b9c0Schristos typedef struct dns_rdata	  dns_rdata_t;
129e2b1b9c0Schristos typedef struct dns_rdatacallbacks dns_rdatacallbacks_t;
130f2e20987Schristos typedef uint16_t		  dns_rdataclass_t;
131e2b1b9c0Schristos typedef struct dns_rdatalist	  dns_rdatalist_t;
132e2b1b9c0Schristos typedef struct dns_rdataset	  dns_rdataset_t;
133e2b1b9c0Schristos typedef ISC_LIST(dns_rdataset_t) dns_rdatasetlist_t;
134e2b1b9c0Schristos typedef struct dns_rdatasetiter	     dns_rdatasetiter_t;
135f2e20987Schristos typedef uint16_t		     dns_rdatatype_t;
136e2b1b9c0Schristos typedef struct dns_request	     dns_request_t;
137e2b1b9c0Schristos typedef struct dns_requestmgr	     dns_requestmgr_t;
138e2b1b9c0Schristos typedef struct dns_resolver	     dns_resolver_t;
139e2b1b9c0Schristos typedef struct dns_sdbimplementation dns_sdbimplementation_t;
140f2e20987Schristos typedef uint8_t			     dns_secalg_t;
141f2e20987Schristos typedef uint8_t			     dns_secproto_t;
142e2b1b9c0Schristos typedef struct dns_signature	     dns_signature_t;
143e2b1b9c0Schristos typedef struct dns_sortlist_arg	     dns_sortlist_arg_t;
144e2b1b9c0Schristos typedef struct dns_ssurule	     dns_ssurule_t;
145e2b1b9c0Schristos typedef struct dns_ssutable	     dns_ssutable_t;
146e2b1b9c0Schristos typedef struct dns_stats	     dns_stats_t;
147f2e20987Schristos typedef uint32_t		     dns_rdatastatstype_t;
148e2b1b9c0Schristos typedef struct dns_tkeyctx	     dns_tkeyctx_t;
149f2e20987Schristos typedef uint16_t		     dns_trust_t;
150e2b1b9c0Schristos typedef struct dns_tsec		     dns_tsec_t;
151e2b1b9c0Schristos typedef struct dns_tsig_keyring	     dns_tsig_keyring_t;
152e2b1b9c0Schristos typedef struct dns_tsigkey	     dns_tsigkey_t;
153f2e20987Schristos typedef uint32_t		     dns_ttl_t;
154e2b1b9c0Schristos typedef struct dns_update_state	     dns_update_state_t;
155e2b1b9c0Schristos typedef struct dns_validator	     dns_validator_t;
156e2b1b9c0Schristos typedef struct dns_view		     dns_view_t;
157e2b1b9c0Schristos typedef ISC_LIST(dns_view_t) dns_viewlist_t;
158e2b1b9c0Schristos typedef struct dns_zone dns_zone_t;
159e2b1b9c0Schristos typedef ISC_LIST(dns_zone_t) dns_zonelist_t;
160e2b1b9c0Schristos typedef struct dns_zonemgr   dns_zonemgr_t;
161e2b1b9c0Schristos typedef struct dns_zt	     dns_zt_t;
162e2b1b9c0Schristos typedef struct dns_ipkeylist dns_ipkeylist_t;
163e2b1b9c0Schristos 
164e2b1b9c0Schristos /*
165e2b1b9c0Schristos  * If we are not using GSSAPI, define the types we use as opaque types here.
166e2b1b9c0Schristos  */
167e2b1b9c0Schristos #ifndef GSSAPI
168e2b1b9c0Schristos typedef struct not_defined_gss_cred_id *gss_cred_id_t;
169e2b1b9c0Schristos typedef struct not_defined_gss_ctx     *gss_ctx_id_t;
1709742fdb4Schristos #endif /* ifndef GSSAPI */
171e2b1b9c0Schristos typedef struct dst_gssapi_signverifyctx dst_gssapi_signverifyctx_t;
172e2b1b9c0Schristos 
1739742fdb4Schristos typedef enum { dns_hash_sha1 = 1 } dns_hash_t;
174e2b1b9c0Schristos 
175e2b1b9c0Schristos typedef enum {
176e2b1b9c0Schristos 	dns_fwdpolicy_none = 0,
177e2b1b9c0Schristos 	dns_fwdpolicy_first = 1,
178e2b1b9c0Schristos 	dns_fwdpolicy_only = 2
179e2b1b9c0Schristos } dns_fwdpolicy_t;
180e2b1b9c0Schristos 
181e2b1b9c0Schristos typedef enum {
182e2b1b9c0Schristos 	dns_namereln_none = 0,
183e2b1b9c0Schristos 	dns_namereln_contains = 1,
184e2b1b9c0Schristos 	dns_namereln_subdomain = 2,
185e2b1b9c0Schristos 	dns_namereln_equal = 3,
186e2b1b9c0Schristos 	dns_namereln_commonancestor = 4
187e2b1b9c0Schristos } dns_namereln_t;
188e2b1b9c0Schristos 
1899742fdb4Schristos typedef enum { dns_one_answer, dns_many_answers } dns_transfer_format_t;
190e2b1b9c0Schristos 
191e2b1b9c0Schristos typedef enum {
1929742fdb4Schristos 	dns_dbtype_zone = 0,
1939742fdb4Schristos 	dns_dbtype_cache = 1,
1949742fdb4Schristos 	dns_dbtype_stub = 3
195e2b1b9c0Schristos } dns_dbtype_t;
196e2b1b9c0Schristos 
197e2b1b9c0Schristos typedef enum {
198e2b1b9c0Schristos 	dns_notifytype_no = 0,
199e2b1b9c0Schristos 	dns_notifytype_yes = 1,
200e2b1b9c0Schristos 	dns_notifytype_explicit = 2,
201e2b1b9c0Schristos 	dns_notifytype_masteronly = 3
202e2b1b9c0Schristos } dns_notifytype_t;
203e2b1b9c0Schristos 
204e2b1b9c0Schristos typedef enum {
205e2b1b9c0Schristos 	dns_minimal_no = 0,
206e2b1b9c0Schristos 	dns_minimal_yes = 1,
207e2b1b9c0Schristos 	dns_minimal_noauth = 2,
208e2b1b9c0Schristos 	dns_minimal_noauthrec = 3
209e2b1b9c0Schristos } dns_minimaltype_t;
210e2b1b9c0Schristos 
211e2b1b9c0Schristos typedef enum {
212e2b1b9c0Schristos 	dns_dialuptype_no = 0,
213e2b1b9c0Schristos 	dns_dialuptype_yes = 1,
214e2b1b9c0Schristos 	dns_dialuptype_notify = 2,
215e2b1b9c0Schristos 	dns_dialuptype_notifypassive = 3,
216e2b1b9c0Schristos 	dns_dialuptype_refresh = 4,
217e2b1b9c0Schristos 	dns_dialuptype_passive = 5
218e2b1b9c0Schristos } dns_dialuptype_t;
219e2b1b9c0Schristos 
220e2b1b9c0Schristos typedef enum {
221e2b1b9c0Schristos 	dns_masterformat_none = 0,
222e2b1b9c0Schristos 	dns_masterformat_text = 1,
223e2b1b9c0Schristos 	dns_masterformat_raw = 2,
224e2b1b9c0Schristos 	dns_masterformat_map = 3
225e2b1b9c0Schristos } dns_masterformat_t;
226e2b1b9c0Schristos 
227e2b1b9c0Schristos /*
228e2b1b9c0Schristos  * These are generated by gen.c.
229e2b1b9c0Schristos  */
230e2b1b9c0Schristos #include <dns/enumclass.h> /* Provides dns_rdataclass_t. */
2319742fdb4Schristos #include <dns/enumtype.h>  /* Provides dns_rdatatype_t. */
232e2b1b9c0Schristos 
233e2b1b9c0Schristos /*%
234e2b1b9c0Schristos  * rcodes.
235e2b1b9c0Schristos  */
236e2b1b9c0Schristos enum {
237e2b1b9c0Schristos 	/*
238e2b1b9c0Schristos 	 * Standard rcodes.
239e2b1b9c0Schristos 	 */
240e2b1b9c0Schristos 	dns_rcode_noerror = 0,
241e2b1b9c0Schristos #define dns_rcode_noerror ((dns_rcode_t)dns_rcode_noerror)
242e2b1b9c0Schristos 	dns_rcode_formerr = 1,
243e2b1b9c0Schristos #define dns_rcode_formerr ((dns_rcode_t)dns_rcode_formerr)
244e2b1b9c0Schristos 	dns_rcode_servfail = 2,
245e2b1b9c0Schristos #define dns_rcode_servfail ((dns_rcode_t)dns_rcode_servfail)
246e2b1b9c0Schristos 	dns_rcode_nxdomain = 3,
247e2b1b9c0Schristos #define dns_rcode_nxdomain ((dns_rcode_t)dns_rcode_nxdomain)
248e2b1b9c0Schristos 	dns_rcode_notimp = 4,
249e2b1b9c0Schristos #define dns_rcode_notimp ((dns_rcode_t)dns_rcode_notimp)
250e2b1b9c0Schristos 	dns_rcode_refused = 5,
251e2b1b9c0Schristos #define dns_rcode_refused ((dns_rcode_t)dns_rcode_refused)
252e2b1b9c0Schristos 	dns_rcode_yxdomain = 6,
253e2b1b9c0Schristos #define dns_rcode_yxdomain ((dns_rcode_t)dns_rcode_yxdomain)
254e2b1b9c0Schristos 	dns_rcode_yxrrset = 7,
255e2b1b9c0Schristos #define dns_rcode_yxrrset ((dns_rcode_t)dns_rcode_yxrrset)
256e2b1b9c0Schristos 	dns_rcode_nxrrset = 8,
257e2b1b9c0Schristos #define dns_rcode_nxrrset ((dns_rcode_t)dns_rcode_nxrrset)
258e2b1b9c0Schristos 	dns_rcode_notauth = 9,
259e2b1b9c0Schristos #define dns_rcode_notauth ((dns_rcode_t)dns_rcode_notauth)
260e2b1b9c0Schristos 	dns_rcode_notzone = 10,
261e2b1b9c0Schristos #define dns_rcode_notzone ((dns_rcode_t)dns_rcode_notzone)
262e2b1b9c0Schristos 	/*
263e2b1b9c0Schristos 	 * Extended rcodes.
264e2b1b9c0Schristos 	 */
265e2b1b9c0Schristos 	dns_rcode_badvers = 16,
266e2b1b9c0Schristos #define dns_rcode_badvers ((dns_rcode_t)dns_rcode_badvers)
267e2b1b9c0Schristos 	dns_rcode_badcookie = 23
268e2b1b9c0Schristos #define dns_rcode_badcookie ((dns_rcode_t)dns_rcode_badcookie)
269e2b1b9c0Schristos 	/*
2709742fdb4Schristos 	 * Update dns_rcodestats_create() and
2719742fdb4Schristos 	 *dns_rcodestats_increment()
2729742fdb4Schristos 	 * and this comment if a rcode >
2739742fdb4Schristos 	 *dns_rcode_badcookie is assigned.
274e2b1b9c0Schristos 	 */
275e2b1b9c0Schristos 	/* Private space [3841..4095] */
276e2b1b9c0Schristos };
277e2b1b9c0Schristos 
278e2b1b9c0Schristos /*%
279e2b1b9c0Schristos  * TSIG errors.
280e2b1b9c0Schristos  */
28173584a28Schristos enum {
28273584a28Schristos 	dns_tsigerror_badsig = 16,
283e2b1b9c0Schristos 	dns_tsigerror_badkey = 17,
284e2b1b9c0Schristos 	dns_tsigerror_badtime = 18,
285e2b1b9c0Schristos 	dns_tsigerror_badmode = 19,
286e2b1b9c0Schristos 	dns_tsigerror_badname = 20,
287e2b1b9c0Schristos 	dns_tsigerror_badalg = 21,
28873584a28Schristos 	dns_tsigerror_badtrunc = 22
28973584a28Schristos };
290e2b1b9c0Schristos 
291e2b1b9c0Schristos /*%
292e2b1b9c0Schristos  * Opcodes.
293e2b1b9c0Schristos  */
29473584a28Schristos enum {
29573584a28Schristos 	dns_opcode_query = 0,
296e2b1b9c0Schristos #define dns_opcode_query ((dns_opcode_t)dns_opcode_query)
297e2b1b9c0Schristos 	dns_opcode_iquery = 1,
298e2b1b9c0Schristos #define dns_opcode_iquery ((dns_opcode_t)dns_opcode_iquery)
299e2b1b9c0Schristos 	dns_opcode_status = 2,
300e2b1b9c0Schristos #define dns_opcode_status ((dns_opcode_t)dns_opcode_status)
301e2b1b9c0Schristos 	dns_opcode_notify = 4,
302e2b1b9c0Schristos #define dns_opcode_notify ((dns_opcode_t)dns_opcode_notify)
303e2b1b9c0Schristos 	dns_opcode_update = 5 /* dynamic update */
304e2b1b9c0Schristos #define dns_opcode_update ((dns_opcode_t)dns_opcode_update)
305e2b1b9c0Schristos };
306e2b1b9c0Schristos 
307e2b1b9c0Schristos /*%
308e2b1b9c0Schristos  * Trust levels.  Must be kept in sync with trustnames[] in masterdump.c.
309e2b1b9c0Schristos  */
310e2b1b9c0Schristos enum {
311e2b1b9c0Schristos 	/* Sentinel value; no data should have this trust level. */
312e2b1b9c0Schristos 	dns_trust_none = 0,
313e2b1b9c0Schristos #define dns_trust_none ((dns_trust_t)dns_trust_none)
314e2b1b9c0Schristos 
315e2b1b9c0Schristos 	/*%
316e2b1b9c0Schristos 	 * Subject to DNSSEC validation but has not yet been validated
317e2b1b9c0Schristos 	 * dns_trust_pending_additional (from the additional section).
318e2b1b9c0Schristos 	 */
319e2b1b9c0Schristos 	dns_trust_pending_additional = 1,
3209742fdb4Schristos #define dns_trust_pending_additional ((dns_trust_t)dns_trust_pending_additional)
321e2b1b9c0Schristos 
322e2b1b9c0Schristos 	dns_trust_pending_answer = 2,
323e2b1b9c0Schristos #define dns_trust_pending_answer ((dns_trust_t)dns_trust_pending_answer)
324e2b1b9c0Schristos 
325e2b1b9c0Schristos 	/*% Received in the additional section of a response. */
326e2b1b9c0Schristos 	dns_trust_additional = 3,
327e2b1b9c0Schristos #define dns_trust_additional ((dns_trust_t)dns_trust_additional)
328e2b1b9c0Schristos 
329e2b1b9c0Schristos 	/* Received in a referral response. */
330e2b1b9c0Schristos 	dns_trust_glue = 4,
331e2b1b9c0Schristos #define dns_trust_glue ((dns_trust_t)dns_trust_glue)
332e2b1b9c0Schristos 
333e2b1b9c0Schristos 	/* Answer from a non-authoritative server */
334e2b1b9c0Schristos 	dns_trust_answer = 5,
335e2b1b9c0Schristos #define dns_trust_answer ((dns_trust_t)dns_trust_answer)
336e2b1b9c0Schristos 
337e2b1b9c0Schristos 	/*  Received in the authority section as part of an
3389742fdb4Schristos 	 *  authoritative response */
339e2b1b9c0Schristos 	dns_trust_authauthority = 6,
340e2b1b9c0Schristos #define dns_trust_authauthority ((dns_trust_t)dns_trust_authauthority)
341e2b1b9c0Schristos 
342e2b1b9c0Schristos 	/* Answer from an authoritative server */
343e2b1b9c0Schristos 	dns_trust_authanswer = 7,
344e2b1b9c0Schristos #define dns_trust_authanswer ((dns_trust_t)dns_trust_authanswer)
345e2b1b9c0Schristos 
346e2b1b9c0Schristos 	/* Successfully DNSSEC validated */
347e2b1b9c0Schristos 	dns_trust_secure = 8,
348e2b1b9c0Schristos #define dns_trust_secure ((dns_trust_t)dns_trust_secure)
349e2b1b9c0Schristos 
350e2b1b9c0Schristos 	/* This server is authoritative */
351e2b1b9c0Schristos 	dns_trust_ultimate = 9
352e2b1b9c0Schristos #define dns_trust_ultimate ((dns_trust_t)dns_trust_ultimate)
353e2b1b9c0Schristos };
354e2b1b9c0Schristos 
3559742fdb4Schristos #define DNS_TRUST_PENDING(x) \
3569742fdb4Schristos 	((x) == dns_trust_pending_answer || (x) == dns_trust_pending_additional)
3579742fdb4Schristos #define DNS_TRUST_ADDITIONAL(x) \
3589742fdb4Schristos 	((x) == dns_trust_additional || (x) == dns_trust_pending_additional)
359e2b1b9c0Schristos #define DNS_TRUST_GLUE(x)   ((x) == dns_trust_glue)
360e2b1b9c0Schristos #define DNS_TRUST_ANSWER(x) ((x) == dns_trust_answer)
361e2b1b9c0Schristos 
362e2b1b9c0Schristos /*%
363e2b1b9c0Schristos  * Name checking severities.
364e2b1b9c0Schristos  */
365e2b1b9c0Schristos typedef enum {
366e2b1b9c0Schristos 	dns_severity_ignore,
367e2b1b9c0Schristos 	dns_severity_warn,
368e2b1b9c0Schristos 	dns_severity_fail
369e2b1b9c0Schristos } dns_severity_t;
370e2b1b9c0Schristos 
371e2b1b9c0Schristos /*%
372e2b1b9c0Schristos  * DNS Serial Number Update Method.
373e2b1b9c0Schristos  *
374e2b1b9c0Schristos  * \li	_none:		Keep the current serial.
375e2b1b9c0Schristos  * \li	_increment:	Add one to the current serial, skipping 0.
376e2b1b9c0Schristos  * \li	_unixtime:	Set to the seconds since 00:00 Jan 1, 1970,
377e2b1b9c0Schristos  *			if possible.
378e2b1b9c0Schristos  * \li	_date:		Set to today's date in YYYYMMDDVV format:
379e2b1b9c0Schristos  *                      (Year, Month, Day, Version)
380e2b1b9c0Schristos  */
381e2b1b9c0Schristos typedef enum {
382e2b1b9c0Schristos 	dns_updatemethod_none = 0,
383e2b1b9c0Schristos 	dns_updatemethod_increment,
384e2b1b9c0Schristos 	dns_updatemethod_unixtime,
385e2b1b9c0Schristos 	dns_updatemethod_date
386e2b1b9c0Schristos } dns_updatemethod_t;
387e2b1b9c0Schristos 
388e2b1b9c0Schristos typedef enum {
389e2b1b9c0Schristos 	dns_stale_answer_no,
390e2b1b9c0Schristos 	dns_stale_answer_yes,
391e2b1b9c0Schristos 	dns_stale_answer_conf
392e2b1b9c0Schristos } dns_stale_answer_t;
393e2b1b9c0Schristos 
3949742fdb4Schristos typedef struct {
3959742fdb4Schristos 	const char *string;
3969742fdb4Schristos 	size_t	    count;
3979742fdb4Schristos } dns_indent_t;
3989742fdb4Schristos 
399e2b1b9c0Schristos /*
400e2b1b9c0Schristos  * Functions.
401e2b1b9c0Schristos  */
4029742fdb4Schristos typedef void (*dns_dumpdonefunc_t)(void *, isc_result_t);
403e2b1b9c0Schristos 
4049742fdb4Schristos typedef void (*dns_loaddonefunc_t)(void *, isc_result_t);
405e2b1b9c0Schristos 
4069742fdb4Schristos typedef void (*dns_rawdatafunc_t)(dns_zone_t *, dns_masterrawheader_t *);
407e2b1b9c0Schristos 
4089742fdb4Schristos typedef isc_result_t (*dns_addrdatasetfunc_t)(void *, const dns_name_t *,
4099742fdb4Schristos 					      dns_rdataset_t *);
410e2b1b9c0Schristos 
4119742fdb4Schristos typedef isc_result_t (*dns_additionaldatafunc_t)(void *, const dns_name_t *,
4129742fdb4Schristos 						 dns_rdatatype_t);
413e2b1b9c0Schristos 
4149742fdb4Schristos typedef isc_result_t (*dns_digestfunc_t)(void *, isc_region_t *);
415e2b1b9c0Schristos 
4169742fdb4Schristos typedef void (*dns_xfrindone_t)(dns_zone_t *, isc_result_t);
417e2b1b9c0Schristos 
4189742fdb4Schristos typedef void (*dns_updatecallback_t)(void *, isc_result_t, dns_message_t *);
419e2b1b9c0Schristos 
4209742fdb4Schristos typedef int (*dns_rdatasetorderfunc_t)(const dns_rdata_t *, const void *);
421e2b1b9c0Schristos 
4229742fdb4Schristos typedef bool (*dns_checkmxfunc_t)(dns_zone_t *, const dns_name_t *,
4239742fdb4Schristos 				  const dns_name_t *);
424e2b1b9c0Schristos 
4259742fdb4Schristos typedef bool (*dns_checksrvfunc_t)(dns_zone_t *, const dns_name_t *,
4269742fdb4Schristos 				   const dns_name_t *);
427e2b1b9c0Schristos 
4289742fdb4Schristos typedef bool (*dns_checknsfunc_t)(dns_zone_t *, const dns_name_t *,
4299742fdb4Schristos 				  const dns_name_t *, dns_rdataset_t *,
4309742fdb4Schristos 				  dns_rdataset_t *);
431e2b1b9c0Schristos 
4329742fdb4Schristos typedef bool (*dns_isselffunc_t)(dns_view_t *, dns_tsigkey_t *,
4339742fdb4Schristos 				 const isc_sockaddr_t *, const isc_sockaddr_t *,
4349742fdb4Schristos 				 dns_rdataclass_t, void *);
435e2b1b9c0Schristos 
4369742fdb4Schristos typedef isc_result_t (*dns_deserializefunc_t)(void *, FILE *, off_t);
437e2b1b9c0Schristos 
4389742fdb4Schristos typedef void (*dns_nseclog_t)(void *val, int, const char *, ...);
439e2b1b9c0Schristos 
440e2b1b9c0Schristos #endif /* DNS_TYPES_H */
441