types.h 13.5 KB
Newer Older
Bob Halley's avatar
Bob Halley committed
1
/*
2
 * Copyright (C) 1998-2016  Internet Systems Consortium, Inc. ("ISC")
3
 *
4 5 6
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
Bob Halley's avatar
Bob Halley committed
7
 */
Bob Halley's avatar
add  
Bob Halley committed
8 9 10 11

#ifndef DNS_TYPES_H
#define DNS_TYPES_H 1

12
/*! \file dns/types.h
13
 * \brief
Bob Halley's avatar
Bob Halley committed
14 15
 * Including this file gives you type declarations suitable for use in
 * .h files, which lets us avoid circular type reference problems.
16
 * \brief
Bob Halley's avatar
Bob Halley committed
17 18 19 20
 * To actually use a type or get declarations of its methods, you must
 * include the appropriate .h file too.
 */

21 22
#include <stdio.h>

23
#include <isc/types.h>
Bob Halley's avatar
add  
Bob Halley committed
24

25 26
typedef struct dns_acache			dns_acache_t;
typedef struct dns_acacheentry			dns_acacheentry_t;
Shane Kerr's avatar
Shane Kerr committed
27
typedef struct dns_acachestats			dns_acachestats_t;
28 29 30 31 32 33 34 35 36
typedef struct dns_acl 				dns_acl_t;
typedef struct dns_aclelement 			dns_aclelement_t;
typedef struct dns_aclenv			dns_aclenv_t;
typedef struct dns_adb				dns_adb_t;
typedef struct dns_adbaddrinfo			dns_adbaddrinfo_t;
typedef ISC_LIST(dns_adbaddrinfo_t)		dns_adbaddrinfolist_t;
typedef struct dns_adbentry			dns_adbentry_t;
typedef struct dns_adbfind			dns_adbfind_t;
typedef ISC_LIST(dns_adbfind_t)			dns_adbfindlist_t;
Evan Hunt's avatar
Evan Hunt committed
37
typedef struct dns_badcache 			dns_badcache_t;
38
typedef struct dns_byaddr			dns_byaddr_t;
39 40 41 42 43 44
typedef struct dns_catz_zonemodmethods		dns_catz_zonemodmethods_t;
typedef struct dns_catz_entry_options		dns_catz_options_t;
typedef struct dns_catz_entry			dns_catz_entry_t;
typedef struct dns_catz_zone			dns_catz_zone_t;
typedef struct dns_catz_changed			dns_catz_changed_t;
typedef struct dns_catz_zones			dns_catz_zones_t;
45 46 47 48
typedef struct dns_client			dns_client_t;
typedef void					dns_clientrestrans_t;
typedef void					dns_clientreqtrans_t;
typedef void					dns_clientupdatetrans_t;
49 50 51
typedef struct dns_cache			dns_cache_t;
typedef isc_uint16_t				dns_cert_t;
typedef struct dns_compress			dns_compress_t;
Bob Halley's avatar
Bob Halley committed
52
typedef struct dns_db				dns_db_t;
53
typedef struct dns_dbimplementation		dns_dbimplementation_t;
54
typedef struct dns_dbiterator			dns_dbiterator_t;
55
typedef void					dns_dbload_t;
56
typedef void					dns_dbnode_t;
57
typedef struct dns_dbonupdatelistener		dns_dbonupdatelistener_t;
58
typedef struct dns_dbtable			dns_dbtable_t;
Bob Halley's avatar
Bob Halley committed
59
typedef void					dns_dbversion_t;
60 61
typedef struct dns_dlzimplementation		dns_dlzimplementation_t;
typedef struct dns_dlzdb			dns_dlzdb_t;
Evan Hunt's avatar
Evan Hunt committed
62
typedef ISC_LIST(dns_dlzdb_t)			dns_dlzdblist_t;
Evan Hunt's avatar
Evan Hunt committed
63
typedef struct dns_dyndbctx			dns_dyndbctx_t;
64
typedef struct dns_sdlzimplementation		dns_sdlzimplementation_t;
Bob Halley's avatar
Bob Halley committed
65
typedef struct dns_decompress			dns_decompress_t;
66 67
typedef struct dns_dispatch			dns_dispatch_t;
typedef struct dns_dispatchevent		dns_dispatchevent_t;
68
typedef struct dns_dispatchlist			dns_dispatchlist_t;
69
typedef struct dns_dispatchset			dns_dispatchset_t;
70
typedef struct dns_dispatchmgr			dns_dispatchmgr_t;
71
typedef struct dns_dispentry			dns_dispentry_t;
72 73
typedef struct dns_dns64			dns_dns64_t;
typedef ISC_LIST(dns_dns64_t)			dns_dns64list_t;
74 75
typedef struct dns_dnsseckey			dns_dnsseckey_t;
typedef ISC_LIST(dns_dnsseckey_t)		dns_dnsseckeylist_t;
76
typedef isc_uint8_t				dns_dsdigest_t;
Evan Hunt's avatar
Evan Hunt committed
77 78 79 80
typedef struct dns_dtdata			dns_dtdata_t;
typedef struct dns_dtenv			dns_dtenv_t;
typedef struct dns_dtmsg			dns_dtmsg_t;
typedef isc_uint16_t 				dns_dtmsgtype_t;
81
typedef struct dns_dumpctx			dns_dumpctx_t;
82
typedef struct dns_ednsopt			dns_ednsopt_t;
83 84 85
typedef struct dns_fetch			dns_fetch_t;
typedef struct dns_fixedname			dns_fixedname_t;
typedef struct dns_forwarders			dns_forwarders_t;
Evan Hunt's avatar
Evan Hunt committed
86
typedef struct dns_forwarder			dns_forwarder_t;
87
typedef struct dns_fwdtable			dns_fwdtable_t;
88
typedef struct dns_iptable			dns_iptable_t;
89
typedef isc_uint32_t				dns_iterations_t;
90
typedef isc_uint16_t				dns_keyflags_t;
91
typedef struct dns_keynode			dns_keynode_t;
92
typedef ISC_LIST(dns_keynode_t)			dns_keynodelist_t;
93
typedef struct dns_keytable			dns_keytable_t;
94
typedef isc_uint16_t				dns_keytag_t;
95 96
typedef struct dns_loadctx			dns_loadctx_t;
typedef struct dns_loadmgr			dns_loadmgr_t;
97
typedef struct dns_masterrawheader		dns_masterrawheader_t;
98 99 100
typedef struct dns_message			dns_message_t;
typedef isc_uint16_t				dns_messageid_t;
typedef isc_region_t				dns_label_t;
Mark Andrews's avatar
Mark Andrews committed
101
typedef struct dns_lookup			dns_lookup_t;
102 103
typedef struct dns_name				dns_name_t;
typedef ISC_LIST(dns_name_t)			dns_namelist_t;
Evan Hunt's avatar
Evan Hunt committed
104 105
typedef struct dns_nta				dns_nta_t;
typedef struct dns_ntatable			dns_ntatable_t;
106
typedef isc_uint16_t				dns_opcode_t;
107
typedef unsigned char				dns_offsets_t[128];
108
typedef struct dns_order			dns_order_t;
109 110
typedef struct dns_peer				dns_peer_t;
typedef struct dns_peerlist			dns_peerlist_t;
111
typedef struct dns_portlist			dns_portlist_t;
112 113
typedef struct dns_rbt				dns_rbt_t;
typedef isc_uint16_t				dns_rcode_t;
Bob Halley's avatar
Bob Halley committed
114
typedef struct dns_rdata			dns_rdata_t;
115 116
typedef struct dns_rdatacallbacks		dns_rdatacallbacks_t;
typedef isc_uint16_t				dns_rdataclass_t;
Bob Halley's avatar
Bob Halley committed
117
typedef struct dns_rdatalist			dns_rdatalist_t;
118
typedef struct dns_rdataset			dns_rdataset_t;
Bob Halley's avatar
Bob Halley committed
119
typedef ISC_LIST(dns_rdataset_t)		dns_rdatasetlist_t;
120
typedef struct dns_rdatasetiter			dns_rdatasetiter_t;
121 122 123
typedef isc_uint16_t				dns_rdatatype_t;
typedef struct dns_request			dns_request_t;
typedef struct dns_requestmgr			dns_requestmgr_t;
Bob Halley's avatar
Bob Halley committed
124
typedef struct dns_resolver			dns_resolver_t;
125
typedef struct dns_sdbimplementation		dns_sdbimplementation_t;
126 127 128 129 130
typedef isc_uint8_t				dns_secalg_t;
typedef isc_uint8_t				dns_secproto_t;
typedef struct dns_signature			dns_signature_t;
typedef struct dns_ssurule			dns_ssurule_t;
typedef struct dns_ssutable			dns_ssutable_t;
131
typedef struct dns_stats			dns_stats_t;
132
typedef isc_uint32_t				dns_rdatastatstype_t;
133
typedef struct dns_tkeyctx			dns_tkeyctx_t;
Bob Halley's avatar
Bob Halley committed
134
typedef isc_uint16_t				dns_trust_t;
135
typedef struct dns_tsec				dns_tsec_t;
Brian Wellington's avatar
Brian Wellington committed
136
typedef struct dns_tsig_keyring			dns_tsig_keyring_t;
137 138
typedef struct dns_tsigkey			dns_tsigkey_t;
typedef isc_uint32_t				dns_ttl_t;
139
typedef struct dns_update_state			dns_update_state_t;
140
typedef struct dns_validator			dns_validator_t;
141 142
typedef struct dns_view				dns_view_t;
typedef ISC_LIST(dns_view_t)			dns_viewlist_t;
143
typedef struct dns_zone				dns_zone_t;
144
typedef ISC_LIST(dns_zone_t)			dns_zonelist_t;
145
typedef struct dns_zonemgr			dns_zonemgr_t;
146
typedef struct dns_zt				dns_zt_t;
147
typedef struct dns_ipkeylist 			dns_ipkeylist_t;
Bob Halley's avatar
Bob Halley committed
148

149 150 151 152 153 154 155 156 157
/*
 * If we are not using GSSAPI, define the types we use as opaque types here.
 */
#ifndef GSSAPI
typedef struct not_defined_gss_cred_id *gss_cred_id_t;
typedef struct not_defined_gss_ctx *gss_ctx_id_t;
#endif
typedef struct dst_gssapi_signverifyctx dst_gssapi_signverifyctx_t;

158 159 160 161
typedef enum {
	dns_hash_sha1 = 1
} dns_hash_t;

Mark Andrews's avatar
Mark Andrews committed
162
typedef enum {
163 164 165 166 167
	dns_fwdpolicy_none = 0,
	dns_fwdpolicy_first = 1,
	dns_fwdpolicy_only = 2
} dns_fwdpolicy_t;

Bob Halley's avatar
Bob Halley committed
168 169 170 171 172 173 174 175
typedef enum {
	dns_namereln_none = 0,
	dns_namereln_contains = 1,
	dns_namereln_subdomain = 2,
	dns_namereln_equal = 3,
	dns_namereln_commonancestor = 4
} dns_namereln_t;

Bob Halley's avatar
Bob Halley committed
176
typedef enum {
177 178
	dns_one_answer, dns_many_answers
} dns_transfer_format_t;
Bob Halley's avatar
Bob Halley committed
179

180 181 182 183
typedef enum {
	dns_dbtype_zone = 0, dns_dbtype_cache = 1, dns_dbtype_stub = 3
} dns_dbtype_t;

184 185 186
typedef enum {
	dns_notifytype_no = 0,
	dns_notifytype_yes = 1,
187 188
	dns_notifytype_explicit = 2,
	dns_notifytype_masteronly = 3
189 190
} dns_notifytype_t;

191 192 193 194 195 196 197
typedef enum {
	dns_minimal_no = 0,
	dns_minimal_yes = 1,
	dns_minimal_noauth = 2,
	dns_minimal_noauthrec = 3
} dns_minimaltype_t;

Mark Andrews's avatar
Mark Andrews committed
198 199 200 201 202 203 204 205 206
typedef enum {
	dns_dialuptype_no = 0,
	dns_dialuptype_yes = 1,
	dns_dialuptype_notify = 2,
	dns_dialuptype_notifypassive = 3,
	dns_dialuptype_refresh = 4,
	dns_dialuptype_passive = 5
} dns_dialuptype_t;

207 208 209
typedef enum {
	dns_masterformat_none = 0,
	dns_masterformat_text = 1,
210
	dns_masterformat_raw  = 2,
Evan Hunt's avatar
Evan Hunt committed
211
	dns_masterformat_map = 3
212 213
} dns_masterformat_t;

214
typedef enum {
Evan Hunt's avatar
Evan Hunt committed
215 216 217 218
	dns_aaaa_ok = 0,
	dns_aaaa_filter = 1,
	dns_aaaa_break_dnssec = 2
} dns_aaaa_t;
219

220
/*
David Lawrence's avatar
David Lawrence committed
221
 * These are generated by gen.c.
222
 */
David Lawrence's avatar
David Lawrence committed
223 224
#include <dns/enumtype.h>	/* Provides dns_rdatatype_t. */
#include <dns/enumclass.h>	/* Provides dns_rdataclass_t. */
225

226
/*%
227
 * rcodes.
228
 */
Mark Andrews's avatar
Mark Andrews committed
229
enum {
230 231 232
	/*
	 * Standard rcodes.
	 */
233
	dns_rcode_noerror = 0,
234
#define dns_rcode_noerror		((dns_rcode_t)dns_rcode_noerror)
235
	dns_rcode_formerr = 1,
236
#define dns_rcode_formerr		((dns_rcode_t)dns_rcode_formerr)
237
	dns_rcode_servfail = 2,
238
#define dns_rcode_servfail		((dns_rcode_t)dns_rcode_servfail)
239
	dns_rcode_nxdomain = 3,
240
#define dns_rcode_nxdomain		((dns_rcode_t)dns_rcode_nxdomain)
241
	dns_rcode_notimp = 4,
242
#define dns_rcode_notimp		((dns_rcode_t)dns_rcode_notimp)
243
	dns_rcode_refused = 5,
244
#define dns_rcode_refused		((dns_rcode_t)dns_rcode_refused)
245
	dns_rcode_yxdomain = 6,
246
#define dns_rcode_yxdomain		((dns_rcode_t)dns_rcode_yxdomain)
247
	dns_rcode_yxrrset = 7,
248
#define dns_rcode_yxrrset		((dns_rcode_t)dns_rcode_yxrrset)
249
	dns_rcode_nxrrset = 8,
250
#define dns_rcode_nxrrset		((dns_rcode_t)dns_rcode_nxrrset)
251
	dns_rcode_notauth = 9,
252
#define dns_rcode_notauth		((dns_rcode_t)dns_rcode_notauth)
253
	dns_rcode_notzone = 10,
254
#define dns_rcode_notzone		((dns_rcode_t)dns_rcode_notzone)
255 256 257
	/*
	 * Extended rcodes.
	 */
258
	dns_rcode_badvers = 16,
259
#define dns_rcode_badvers		((dns_rcode_t)dns_rcode_badvers)
260
	dns_rcode_badcookie = 23
261
#define dns_rcode_badcookie		((dns_rcode_t)dns_rcode_badcookie)
262 263 264 265
	/*
	 * Update dns_rcodestats_create() and dns_rcodestats_increment()
	 * and this comment if a rcode > dns_rcode_badcookie is assigned.
	 */
266
	/* Private space [3841..4095] */
267 268
};

269
/*%
270
 * TSIG errors.
271 272 273 274 275
 */
enum {
	dns_tsigerror_badsig = 16,
	dns_tsigerror_badkey = 17,
	dns_tsigerror_badtime = 18,
276
	dns_tsigerror_badmode = 19,
277
	dns_tsigerror_badname = 20,
278 279
	dns_tsigerror_badalg = 21,
	dns_tsigerror_badtrunc = 22
Mark Andrews's avatar
Mark Andrews committed
280
};
Mark Andrews's avatar
Mark Andrews committed
281

282
/*%
283
 * Opcodes.
284 285 286
 */
enum {
	dns_opcode_query = 0,
287
#define dns_opcode_query		((dns_opcode_t)dns_opcode_query)
288
	dns_opcode_iquery = 1,
289
#define dns_opcode_iquery		((dns_opcode_t)dns_opcode_iquery)
290
	dns_opcode_status = 2,
291
#define dns_opcode_status		((dns_opcode_t)dns_opcode_status)
Andreas Gustafsson's avatar
Andreas Gustafsson committed
292
	dns_opcode_notify = 4,
293
#define dns_opcode_notify		((dns_opcode_t)dns_opcode_notify)
294
	dns_opcode_update = 5		/* dynamic update */
295
#define dns_opcode_update		((dns_opcode_t)dns_opcode_update)
296 297
};

298
/*%
299
 * Trust levels.  Must be kept in sync with trustnames[] in masterdump.c.
300 301
 */
enum {
Andreas Gustafsson's avatar
Andreas Gustafsson committed
302
	/* Sentinel value; no data should have this trust level. */
303
	dns_trust_none = 0,
304
#define dns_trust_none			((dns_trust_t)dns_trust_none)
Andreas Gustafsson's avatar
Andreas Gustafsson committed
305

306 307 308 309 310 311 312 313 314 315
	/*%
	 * Subject to DNSSEC validation but has not yet been validated
	 * dns_trust_pending_additional (from the additional section).
	 */
	dns_trust_pending_additional = 1,
#define dns_trust_pending_additional \
		 ((dns_trust_t)dns_trust_pending_additional)

	dns_trust_pending_answer = 2,
#define dns_trust_pending_answer	((dns_trust_t)dns_trust_pending_answer)
Andreas Gustafsson's avatar
Andreas Gustafsson committed
316

317
	/*% Received in the additional section of a response. */
318
	dns_trust_additional = 3,
319
#define dns_trust_additional		((dns_trust_t)dns_trust_additional)
Andreas Gustafsson's avatar
Andreas Gustafsson committed
320

Automatic Updater's avatar
Automatic Updater committed
321
	/* Received in a referral response. */
322
	dns_trust_glue = 4,
323
#define dns_trust_glue			((dns_trust_t)dns_trust_glue)
Andreas Gustafsson's avatar
Andreas Gustafsson committed
324

Francis Dupont's avatar
Francis Dupont committed
325
	/* Answer from a non-authoritative server */
326
	dns_trust_answer = 5,
327
#define dns_trust_answer		((dns_trust_t)dns_trust_answer)
Andreas Gustafsson's avatar
Andreas Gustafsson committed
328 329 330

	/*  Received in the authority section as part of an
	    authoritative response */
331
	dns_trust_authauthority = 6,
332
#define dns_trust_authauthority		((dns_trust_t)dns_trust_authauthority)
Andreas Gustafsson's avatar
Andreas Gustafsson committed
333

Francis Dupont's avatar
Francis Dupont committed
334
	/* Answer from an authoritative server */
335
	dns_trust_authanswer = 7,
336
#define dns_trust_authanswer		((dns_trust_t)dns_trust_authanswer)
Andreas Gustafsson's avatar
Andreas Gustafsson committed
337

Automatic Updater's avatar
Automatic Updater committed
338
	/* Successfully DNSSEC validated */
339
	dns_trust_secure = 8,
340
#define dns_trust_secure		((dns_trust_t)dns_trust_secure)
Andreas Gustafsson's avatar
Andreas Gustafsson committed
341 342

	/* This server is authoritative */
343
	dns_trust_ultimate = 9
344
#define dns_trust_ultimate		((dns_trust_t)dns_trust_ultimate)
345 346
};

347 348
#define DNS_TRUST_PENDING(x)		((x) == dns_trust_pending_answer || \
					 (x) == dns_trust_pending_additional)
349 350
#define DNS_TRUST_ADDITIONAL(x)		((x) == dns_trust_additional || \
					 (x) == dns_trust_pending_additional)
351
#define DNS_TRUST_GLUE(x)		((x) == dns_trust_glue)
352
#define DNS_TRUST_ANSWER(x)		((x) == dns_trust_answer)
353 354


355
/*%
Francis Dupont's avatar
Francis Dupont committed
356
 * Name checking severities.
Andreas Gustafsson's avatar
Andreas Gustafsson committed
357 358 359 360 361 362 363
 */
typedef enum {
	dns_severity_ignore,
	dns_severity_warn,
	dns_severity_fail
} dns_severity_t;

364 365 366
/*%
 * DNS Serial Number Update Method.
 *
Evan Hunt's avatar
Evan Hunt committed
367
 * \li	_none:		Keep the current serial.
368 369 370
 * \li	_increment:	Add one to the current serial, skipping 0.
 * \li	_unixtime:	Set to the seconds since 00:00 Jan 1, 1970,
 *			if possible.
Evan Hunt's avatar
Evan Hunt committed
371 372
 * \li	_date:		Set to today's date in YYYYMMDDVV format:
 *                      (Year, Month, Day, Version)
373 374
 */
typedef enum {
Evan Hunt's avatar
Evan Hunt committed
375 376
	dns_updatemethod_none = 0,
	dns_updatemethod_increment,
377 378
	dns_updatemethod_unixtime,
	dns_updatemethod_date
379 380
} dns_updatemethod_t;

381 382 383
/*
 * Functions.
 */
384 385 386
typedef void
(*dns_dumpdonefunc_t)(void *, isc_result_t);

387 388 389
typedef void
(*dns_loaddonefunc_t)(void *, isc_result_t);

390 391 392
typedef void
(*dns_rawdatafunc_t)(dns_zone_t *, dns_masterrawheader_t *);

393 394 395
typedef isc_result_t
(*dns_addrdatasetfunc_t)(void *, dns_name_t *, dns_rdataset_t *);

Bob Halley's avatar
Bob Halley committed
396
typedef isc_result_t
397
(*dns_additionaldatafunc_t)(void *, dns_name_t *, dns_rdatatype_t);
Bob Halley's avatar
Bob Halley committed
398

Bob Halley's avatar
Bob Halley committed
399 400 401
typedef isc_result_t
(*dns_digestfunc_t)(void *, isc_region_t *);

402 403 404
typedef void
(*dns_xfrindone_t)(dns_zone_t *, isc_result_t);

405 406 407
typedef void
(*dns_updatecallback_t)(void *, isc_result_t, dns_message_t *);

Automatic Updater's avatar
Automatic Updater committed
408
typedef int
409
(*dns_rdatasetorderfunc_t)(const dns_rdata_t *, const void *);
410 411 412 413 414 415 416 417 418 419

typedef isc_boolean_t
(*dns_checkmxfunc_t)(dns_zone_t *, dns_name_t *, dns_name_t *);

typedef isc_boolean_t
(*dns_checksrvfunc_t)(dns_zone_t *, dns_name_t *, dns_name_t *);

typedef isc_boolean_t
(*dns_checknsfunc_t)(dns_zone_t *, dns_name_t *, dns_name_t *,
		     dns_rdataset_t *, dns_rdataset_t *);
420

421 422 423 424
typedef isc_boolean_t
(*dns_isselffunc_t)(dns_view_t *, dns_tsigkey_t *, isc_sockaddr_t *,
		    isc_sockaddr_t *, dns_rdataclass_t, void *);

425 426 427
typedef isc_result_t
(*dns_deserializefunc_t)(void *, FILE *, off_t);

428 429 430
typedef void
(*dns_nseclog_t)(void *val, int , const char *, ...);

Bob Halley's avatar
add  
Bob Halley committed
431
#endif /* DNS_TYPES_H */