PageRenderTime 21ms CodeModel.GetById 2ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 1ms

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