1 /* $NetBSD: zone.h,v 1.16 2015/07/08 17:28:59 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") 5 * Copyright (C) 1999-2003 Internet Software Consortium. 6 * 7 * Permission to use, copy, modify, and/or distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /* Id */ 21 22 #ifndef DNS_ZONE_H 23 #define DNS_ZONE_H 1 24 25 /*! \file dns/zone.h */ 26 27 /*** 28 *** Imports 29 ***/ 30 31 #include <stdio.h> 32 33 #include <isc/formatcheck.h> 34 #include <isc/lang.h> 35 #include <isc/rwlock.h> 36 37 #include <dns/master.h> 38 #include <dns/masterdump.h> 39 #include <dns/rdatastruct.h> 40 #include <dns/rpz.h> 41 #include <dns/types.h> 42 #include <dns/zt.h> 43 44 typedef enum { 45 dns_zone_none, 46 dns_zone_master, 47 dns_zone_slave, 48 dns_zone_stub, 49 dns_zone_staticstub, 50 dns_zone_key, 51 dns_zone_dlz, 52 dns_zone_redirect 53 } dns_zonetype_t; 54 55 typedef enum { 56 dns_zonestat_none = 0, 57 dns_zonestat_terse, 58 dns_zonestat_full 59 } dns_zonestat_level_t; 60 61 #define DNS_ZONEOPT_SERVERS 0x00000001U /*%< perform server checks */ 62 #define DNS_ZONEOPT_PARENTS 0x00000002U /*%< perform parent checks */ 63 #define DNS_ZONEOPT_CHILDREN 0x00000004U /*%< perform child checks */ 64 #define DNS_ZONEOPT_NOTIFY 0x00000008U /*%< perform NOTIFY */ 65 #define DNS_ZONEOPT_MANYERRORS 0x00000010U /*%< return many errors on load */ 66 #define DNS_ZONEOPT_IXFRFROMDIFFS 0x00000020U /*%< calculate differences */ 67 #define DNS_ZONEOPT_NOMERGE 0x00000040U /*%< don't merge journal */ 68 #define DNS_ZONEOPT_CHECKNS 0x00000080U /*%< check if NS's are addresses */ 69 #define DNS_ZONEOPT_FATALNS 0x00000100U /*%< DNS_ZONEOPT_CHECKNS is fatal */ 70 #define DNS_ZONEOPT_MULTIMASTER 0x00000200U /*%< this zone has multiple masters */ 71 #define DNS_ZONEOPT_USEALTXFRSRC 0x00000400U /*%< use alternate transfer sources */ 72 #define DNS_ZONEOPT_CHECKNAMES 0x00000800U /*%< check-names */ 73 #define DNS_ZONEOPT_CHECKNAMESFAIL 0x00001000U /*%< fatal check-name failures */ 74 #define DNS_ZONEOPT_CHECKWILDCARD 0x00002000U /*%< check for internal wildcards */ 75 #define DNS_ZONEOPT_CHECKMX 0x00004000U /*%< check-mx */ 76 #define DNS_ZONEOPT_CHECKMXFAIL 0x00008000U /*%< fatal check-mx failures */ 77 #define DNS_ZONEOPT_CHECKINTEGRITY 0x00010000U /*%< perform integrity checks */ 78 #define DNS_ZONEOPT_CHECKSIBLING 0x00020000U /*%< perform sibling glue checks */ 79 #define DNS_ZONEOPT_NOCHECKNS 0x00040000U /*%< disable IN NS address checks */ 80 #define DNS_ZONEOPT_WARNMXCNAME 0x00080000U /*%< warn on MX CNAME check */ 81 #define DNS_ZONEOPT_IGNOREMXCNAME 0x00100000U /*%< ignore MX CNAME check */ 82 #define DNS_ZONEOPT_WARNSRVCNAME 0x00200000U /*%< warn on SRV CNAME check */ 83 #define DNS_ZONEOPT_IGNORESRVCNAME 0x00400000U /*%< ignore SRV CNAME check */ 84 #define DNS_ZONEOPT_UPDATECHECKKSK 0x00800000U /*%< check dnskey KSK flag */ 85 #define DNS_ZONEOPT_TRYTCPREFRESH 0x01000000U /*%< try tcp refresh on udp failure */ 86 #define DNS_ZONEOPT_NOTIFYTOSOA 0x02000000U /*%< Notify the SOA MNAME */ 87 #define DNS_ZONEOPT_NSEC3TESTZONE 0x04000000U /*%< nsec3-test-zone */ 88 #define DNS_ZONEOPT_SECURETOINSECURE 0x08000000U /*%< dnssec-secure-to-insecure */ 89 #define DNS_ZONEOPT_DNSKEYKSKONLY 0x10000000U /*%< dnssec-dnskey-kskonly */ 90 #define DNS_ZONEOPT_CHECKDUPRR 0x20000000U /*%< check-dup-records */ 91 #define DNS_ZONEOPT_CHECKDUPRRFAIL 0x40000000U /*%< fatal check-dup-records failures */ 92 #define DNS_ZONEOPT_CHECKSPF 0x80000000U /*%< check SPF records */ 93 94 /* 95 * The following zone options are shifted left into the 96 * higher-order 32 bits of the options. 97 */ 98 #define DNS_ZONEOPT2_CHECKTTL 0x00000001 /*%< check max-zone-ttl */ 99 100 #ifndef NOMINUM_PUBLIC 101 /* 102 * Nominum specific options build down. 103 */ 104 #define DNS_ZONEOPT_NOTIFYFORWARD 0x80000000U /* forward notify to master */ 105 #endif /* NOMINUM_PUBLIC */ 106 107 /* 108 * Zone key maintenance options 109 */ 110 #define DNS_ZONEKEY_ALLOW 0x00000001U /*%< fetch keys on command */ 111 #define DNS_ZONEKEY_MAINTAIN 0x00000002U /*%< publish/sign on schedule */ 112 #define DNS_ZONEKEY_CREATE 0x00000004U /*%< make keys when needed */ 113 #define DNS_ZONEKEY_FULLSIGN 0x00000008U /*%< roll to new keys immediately */ 114 #define DNS_ZONEKEY_NORESIGN 0x00000010U /*%< no automatic resigning */ 115 116 #ifndef DNS_ZONE_MINREFRESH 117 #define DNS_ZONE_MINREFRESH 300 /*%< 5 minutes */ 118 #endif 119 #ifndef DNS_ZONE_MAXREFRESH 120 #define DNS_ZONE_MAXREFRESH 2419200 /*%< 4 weeks */ 121 #endif 122 #ifndef DNS_ZONE_DEFAULTREFRESH 123 #define DNS_ZONE_DEFAULTREFRESH 3600 /*%< 1 hour */ 124 #endif 125 #ifndef DNS_ZONE_MINRETRY 126 #define DNS_ZONE_MINRETRY 300 /*%< 5 minutes */ 127 #endif 128 #ifndef DNS_ZONE_MAXRETRY 129 #define DNS_ZONE_MAXRETRY 1209600 /*%< 2 weeks */ 130 #endif 131 #ifndef DNS_ZONE_DEFAULTRETRY 132 #define DNS_ZONE_DEFAULTRETRY 60 /*%< 1 minute, subject to 133 exponential backoff */ 134 #endif 135 136 #define DNS_ZONESTATE_XFERRUNNING 1 137 #define DNS_ZONESTATE_XFERDEFERRED 2 138 #define DNS_ZONESTATE_SOAQUERY 3 139 #define DNS_ZONESTATE_ANY 4 140 141 ISC_LANG_BEGINDECLS 142 143 /*** 144 *** Functions 145 ***/ 146 147 isc_result_t 148 dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx); 149 /*%< 150 * Creates a new empty zone and attach '*zonep' to it. 151 * 152 * Requires: 153 *\li 'zonep' to point to a NULL pointer. 154 *\li 'mctx' to be a valid memory context. 155 * 156 * Ensures: 157 *\li '*zonep' refers to a valid zone. 158 * 159 * Returns: 160 *\li #ISC_R_SUCCESS 161 *\li #ISC_R_NOMEMORY 162 *\li #ISC_R_UNEXPECTED 163 */ 164 165 void 166 dns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass); 167 /*%< 168 * Sets the class of a zone. This operation can only be performed 169 * once on a zone. 170 * 171 * Require: 172 *\li 'zone' to be a valid zone. 173 *\li dns_zone_setclass() not to have been called since the zone was 174 * created. 175 *\li 'rdclass' != dns_rdataclass_none. 176 */ 177 178 dns_rdataclass_t 179 dns_zone_getclass(dns_zone_t *zone); 180 /*%< 181 * Returns the current zone class. 182 * 183 * Requires: 184 *\li 'zone' to be a valid zone. 185 */ 186 187 isc_result_t 188 dns_zone_getserial2(dns_zone_t *zone, isc_uint32_t *serialp); 189 190 isc_uint32_t 191 dns_zone_getserial(dns_zone_t *zone); 192 /*%< 193 * Returns the current serial number of the zone. On success, the SOA 194 * serial of the zone will be copied into '*serialp'. 195 * dns_zone_getserial() cannot catch failure cases and is deprecated by 196 * dns_zone_getserial2(). 197 * 198 * Requires: 199 *\li 'zone' to be a valid zone. 200 *\li 'serialp' to be non NULL 201 * 202 * Returns: 203 *\li #ISC_R_SUCCESS 204 *\li #DNS_R_NOTLOADED zone DB is not loaded 205 */ 206 207 void 208 dns_zone_settype(dns_zone_t *zone, dns_zonetype_t type); 209 /*%< 210 * Sets the zone type. This operation can only be performed once on 211 * a zone. 212 * 213 * Requires: 214 *\li 'zone' to be a valid zone. 215 *\li dns_zone_settype() not to have been called since the zone was 216 * created. 217 *\li 'type' != dns_zone_none 218 */ 219 220 void 221 dns_zone_setview(dns_zone_t *zone, dns_view_t *view); 222 /*%< 223 * Associate the zone with a view. 224 * 225 * Require: 226 *\li 'zone' to be a valid zone. 227 */ 228 229 dns_view_t * 230 dns_zone_getview(dns_zone_t *zone); 231 /*%< 232 * Returns the zone's associated view. 233 * 234 * Requires: 235 *\li 'zone' to be a valid zone. 236 */ 237 238 isc_result_t 239 dns_zone_setorigin(dns_zone_t *zone, const dns_name_t *origin); 240 /*%< 241 * Sets the zones origin to 'origin'. 242 * 243 * Require: 244 *\li 'zone' to be a valid zone. 245 *\li 'origin' to be non NULL. 246 * 247 * Returns: 248 *\li #ISC_R_SUCCESS 249 *\li #ISC_R_NOMEMORY 250 */ 251 252 dns_name_t * 253 dns_zone_getorigin(dns_zone_t *zone); 254 /*%< 255 * Returns the value of the origin. 256 * 257 * Require: 258 *\li 'zone' to be a valid zone. 259 */ 260 261 isc_result_t 262 dns_zone_setfile(dns_zone_t *zone, const char *file); 263 264 isc_result_t 265 dns_zone_setfile2(dns_zone_t *zone, const char *file, 266 dns_masterformat_t format); 267 /*%< 268 * Sets the name of the master file in the format of 'format' from which 269 * the zone loads its database to 'file'. 270 * 271 * For zones that have no associated master file, 'file' will be NULL. 272 * 273 * For zones with persistent databases, the file name 274 * setting is ignored. 275 * 276 * dns_zone_setfile() is a backward-compatible form of 277 * dns_zone_setfile2(), which always specifies the 278 * dns_masterformat_text (RFC1035) format. 279 * 280 * Require: 281 *\li 'zone' to be a valid zone. 282 * 283 * Returns: 284 *\li #ISC_R_NOMEMORY 285 *\li #ISC_R_SUCCESS 286 */ 287 288 const char * 289 dns_zone_getfile(dns_zone_t *zone); 290 /*%< 291 * Gets the name of the zone's master file, if any. 292 * 293 * Requires: 294 *\li 'zone' to be valid initialised zone. 295 * 296 * Returns: 297 *\li Pointer to null-terminated file name, or NULL. 298 */ 299 300 void 301 dns_zone_setmaxttl(dns_zone_t *zone, isc_uint32_t maxttl); 302 /*%< 303 * Sets the max ttl of the zone. 304 * 305 * Requires: 306 *\li 'zone' to be valid initialised zone. 307 * 308 * Returns: 309 *\li void 310 */ 311 312 dns_ttl_t 313 dns_zone_getmaxttl(dns_zone_t *zone); 314 /*%< 315 * Gets the max ttl of the zone. 316 * 317 * Requires: 318 *\li 'zone' to be valid initialised zone. 319 * 320 * Returns: 321 *\li isc_uint32_t maxttl. 322 */ 323 324 isc_result_t 325 dns_zone_load(dns_zone_t *zone); 326 327 isc_result_t 328 dns_zone_loadnew(dns_zone_t *zone); 329 330 isc_result_t 331 dns_zone_loadandthaw(dns_zone_t *zone); 332 333 /*%< 334 * Cause the database to be loaded from its backing store. 335 * Confirm that the minimum requirements for the zone type are 336 * met, otherwise DNS_R_BADZONE is returned. 337 * 338 * dns_zone_loadnew() only loads zones that are not yet loaded. 339 * dns_zone_load() also loads zones that are already loaded and 340 * and whose master file has changed since the last load. 341 * dns_zone_loadandthaw() is similar to dns_zone_load() but will 342 * also re-enable DNS UPDATEs when the load completes. 343 * 344 * Require: 345 *\li 'zone' to be a valid zone. 346 * 347 * Returns: 348 *\li #ISC_R_UNEXPECTED 349 *\li #ISC_R_SUCCESS 350 *\li DNS_R_CONTINUE Incremental load has been queued. 351 *\li DNS_R_UPTODATE The zone has already been loaded based on 352 * file system timestamps. 353 *\li DNS_R_BADZONE 354 *\li Any result value from dns_db_load(). 355 */ 356 357 isc_result_t 358 dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg); 359 /*%< 360 * Cause the database to be loaded from its backing store asynchronously. 361 * Other zone maintenance functions are suspended until this is complete. 362 * When finished, 'done' is called to inform the caller, with 'arg' as 363 * its first argument and 'zone' as its second. (Normally, 'arg' is 364 * expected to point to the zone table but is left undefined for testing 365 * purposes.) 366 * 367 * Require: 368 *\li 'zone' to be a valid zone. 369 * 370 * Returns: 371 *\li #ISC_R_ALREADYRUNNING 372 *\li #ISC_R_SUCCESS 373 *\li #ISC_R_FAILURE 374 *\li #ISC_R_NOMEMORY 375 */ 376 377 isc_boolean_t 378 dns__zone_loadpending(dns_zone_t *zone); 379 /*%< 380 * Indicates whether the zone is waiting to be loaded asynchronously. 381 * (Not currently intended for use outside of this module and associated 382 * tests.) 383 */ 384 385 void 386 dns_zone_attach(dns_zone_t *source, dns_zone_t **target); 387 /*%< 388 * Attach '*target' to 'source' incrementing its external 389 * reference count. 390 * 391 * Require: 392 *\li 'zone' to be a valid zone. 393 *\li 'target' to be non NULL and '*target' to be NULL. 394 */ 395 396 void 397 dns_zone_detach(dns_zone_t **zonep); 398 /*%< 399 * Detach from a zone decrementing its external reference count. 400 * If this was the last external reference to the zone it will be 401 * shut down and eventually freed. 402 * 403 * Require: 404 *\li 'zonep' to point to a valid zone. 405 */ 406 407 void 408 dns_zone_iattach(dns_zone_t *source, dns_zone_t **target); 409 /*%< 410 * Attach '*target' to 'source' incrementing its internal 411 * reference count. This is intended for use by operations 412 * such as zone transfers that need to prevent the zone 413 * object from being freed but not from shutting down. 414 * 415 * Require: 416 *\li The caller is running in the context of the zone's task. 417 *\li 'zone' to be a valid zone. 418 *\li 'target' to be non NULL and '*target' to be NULL. 419 */ 420 421 void 422 dns_zone_idetach(dns_zone_t **zonep); 423 /*%< 424 * Detach from a zone decrementing its internal reference count. 425 * If there are no more internal or external references to the 426 * zone, it will be freed. 427 * 428 * Require: 429 *\li The caller is running in the context of the zone's task. 430 *\li 'zonep' to point to a valid zone. 431 */ 432 433 void 434 dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value); 435 /*%< 436 * Sets ('value' == 'ISC_TRUE') / clears ('value' == 'IS_FALSE') 437 * zone flags. Valid flag bits are DNS_ZONE_F_*. 438 * 439 * Requires 440 *\li 'zone' to be a valid zone. 441 */ 442 443 isc_result_t 444 dns_zone_getdb(dns_zone_t *zone, dns_db_t **dbp); 445 /*%< 446 * Attach '*dbp' to the database to if it exists otherwise 447 * return DNS_R_NOTLOADED. 448 * 449 * Require: 450 *\li 'zone' to be a valid zone. 451 *\li 'dbp' to be != NULL && '*dbp' == NULL. 452 * 453 * Returns: 454 *\li #ISC_R_SUCCESS 455 *\li DNS_R_NOTLOADED 456 */ 457 458 void 459 dns_zone_setdb(dns_zone_t *zone, dns_db_t *db); 460 /*%< 461 * Sets the zone database to 'db'. 462 * 463 * This function is expected to be used to configure a zone with a 464 * database which is not loaded from a file or zone transfer. 465 * It can be used for a general purpose zone, but right now its use 466 * is limited to static-stub zones to avoid possible undiscovered 467 * problems in the general cases. 468 * 469 * Require: 470 *\li 'zone' to be a valid zone of static-stub. 471 *\li zone doesn't have a database. 472 */ 473 474 isc_result_t 475 dns_zone_setdbtype(dns_zone_t *zone, 476 unsigned int dbargc, const char * const *dbargv); 477 /*%< 478 * Sets the database type to dbargv[0] and database arguments 479 * to subsequent dbargv elements. 480 * 'db_type' is not checked to see if it is a valid database type. 481 * 482 * Require: 483 *\li 'zone' to be a valid zone. 484 *\li 'database' to be non NULL. 485 *\li 'dbargc' to be >= 1 486 *\li 'dbargv' to point to dbargc NULL-terminated strings 487 * 488 * Returns: 489 *\li #ISC_R_NOMEMORY 490 *\li #ISC_R_SUCCESS 491 */ 492 493 isc_result_t 494 dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx); 495 /*%< 496 * Returns the current dbtype. isc_mem_free() should be used 497 * to free 'argv' after use. 498 * 499 * Require: 500 *\li 'zone' to be a valid zone. 501 *\li 'argv' to be non NULL and *argv to be NULL. 502 *\li 'mctx' to be valid. 503 * 504 * Returns: 505 *\li #ISC_R_NOMEMORY 506 *\li #ISC_R_SUCCESS 507 */ 508 509 void 510 dns_zone_markdirty(dns_zone_t *zone); 511 /*%< 512 * Mark a zone as 'dirty'. 513 * 514 * Require: 515 *\li 'zone' to be a valid zone. 516 */ 517 518 void 519 dns_zone_expire(dns_zone_t *zone); 520 /*%< 521 * Mark the zone as expired. If the zone requires dumping cause it to 522 * be initiated. Set the refresh and retry intervals to there default 523 * values and unload the zone. 524 * 525 * Require 526 *\li 'zone' to be a valid zone. 527 */ 528 529 void 530 dns_zone_refresh(dns_zone_t *zone); 531 /*%< 532 * Initiate zone up to date checks. The zone must already be being 533 * managed. 534 * 535 * Require 536 *\li 'zone' to be a valid zone. 537 */ 538 539 isc_result_t 540 dns_zone_flush(dns_zone_t *zone); 541 /*%< 542 * Write the zone to database if there are uncommitted changes. 543 * 544 * Require: 545 *\li 'zone' to be a valid zone. 546 */ 547 548 isc_result_t 549 dns_zone_dump(dns_zone_t *zone); 550 /*%< 551 * Write the zone to database. 552 * 553 * Require: 554 *\li 'zone' to be a valid zone. 555 */ 556 557 isc_result_t 558 dns_zone_dumptostream(dns_zone_t *zone, FILE *fd); 559 560 isc_result_t 561 dns_zone_dumptostream2(dns_zone_t *zone, FILE *fd, dns_masterformat_t format, 562 const dns_master_style_t *style); 563 isc_result_t 564 dns_zone_dumptostream3(dns_zone_t *zone, FILE *fd, dns_masterformat_t format, 565 const dns_master_style_t *style, 566 const isc_uint32_t rawversion); 567 /*%< 568 * Write the zone to stream 'fd' in the specified 'format'. 569 * If the 'format' is dns_masterformat_text (RFC1035), 'style' also 570 * specifies the file style (e.g., &dns_master_style_default). 571 * 572 * dns_zone_dumptostream() is a backward-compatible form of 573 * dns_zone_dumptostream2(), which always uses the dns_masterformat_text 574 * format and the dns_master_style_default style. 575 * 576 * dns_zone_dumptostream2() is a backward-compatible form of 577 * dns_zone_dumptostream3(), which always uses the current 578 * default raw file format version. 579 * 580 * Note that dns_zone_dumptostream3() is the most flexible form. It 581 * can also provide the functionality of dns_zone_fulldumptostream(). 582 * 583 * Require: 584 *\li 'zone' to be a valid zone. 585 *\li 'fd' to be a stream open for writing. 586 */ 587 588 isc_result_t 589 dns_zone_fulldumptostream(dns_zone_t *zone, FILE *fd); 590 /*%< 591 * The same as dns_zone_dumptostream, but dumps the zone with 592 * different dump settings (dns_master_style_full). 593 * 594 * Require: 595 *\li 'zone' to be a valid zone. 596 *\li 'fd' to be a stream open for writing. 597 */ 598 599 void 600 dns_zone_maintenance(dns_zone_t *zone); 601 /*%< 602 * Perform regular maintenance on the zone. This is called as a 603 * result of a zone being managed. 604 * 605 * Require 606 *\li 'zone' to be a valid zone. 607 */ 608 609 isc_result_t 610 dns_zone_setmasters(dns_zone_t *zone, const isc_sockaddr_t *masters, 611 isc_uint32_t count); 612 isc_result_t 613 dns_zone_setmasterswithkeys(dns_zone_t *zone, 614 const isc_sockaddr_t *masters, 615 dns_name_t **keynames, 616 isc_uint32_t count); 617 /*%< 618 * Set the list of master servers for the zone. 619 * 620 * Require: 621 *\li 'zone' to be a valid zone. 622 *\li 'masters' array of isc_sockaddr_t with port set or NULL. 623 *\li 'count' the number of masters. 624 *\li 'keynames' array of dns_name_t's for tsig keys or NULL. 625 * 626 * \li dns_zone_setmasters() is just a wrapper to setmasterswithkeys(), 627 * passing NULL in the keynames field. 628 * 629 * \li If 'masters' is NULL then 'count' must be zero. 630 * 631 * Returns: 632 *\li #ISC_R_SUCCESS 633 *\li #ISC_R_NOMEMORY 634 *\li Any result dns_name_dup() can return, if keynames!=NULL 635 */ 636 637 isc_result_t 638 dns_zone_setalsonotify(dns_zone_t *zone, const isc_sockaddr_t *notify, 639 isc_uint32_t count); 640 isc_result_t 641 dns_zone_setalsonotifywithkeys(dns_zone_t *zone, const isc_sockaddr_t *notify, 642 dns_name_t **keynames, isc_uint32_t count); 643 isc_result_t 644 dns_zone_setalsonotifydscpkeys(dns_zone_t *zone, const isc_sockaddr_t *notify, 645 const isc_dscp_t *dscps, dns_name_t **keynames, 646 isc_uint32_t count); 647 /*%< 648 * Set the list of additional servers to be notified when 649 * a zone changes. To clear the list use 'count = 0'. 650 * 651 * dns_zone_alsonotifywithkeys() allows each notify address to 652 * be associated with a TSIG key. 653 * 654 * Require: 655 *\li 'zone' to be a valid zone. 656 *\li 'notify' to be non-NULL if count != 0. 657 *\li 'count' to be the number of notifiees. 658 * 659 * Returns: 660 *\li #ISC_R_SUCCESS 661 *\li #ISC_R_NOMEMORY 662 */ 663 664 void 665 dns_zone_unload(dns_zone_t *zone); 666 /*%< 667 * detach the database from the zone structure. 668 * 669 * Require: 670 *\li 'zone' to be a valid zone. 671 */ 672 673 void 674 dns_zone_setoption(dns_zone_t *zone, unsigned int option, 675 isc_boolean_t value); 676 void 677 dns_zone_setoption2(dns_zone_t *zone, unsigned int option, 678 isc_boolean_t value); 679 /*%< 680 * Set the given options on ('value' == ISC_TRUE) or off 681 * ('value' == #ISC_FALSE). 682 * 683 * dns_zone_setoption2() has been introduced because the number 684 * of options needed now exceeds the 32 bits in the zone->options 685 * field; it should be used set options with names beginning 686 * with DNS_ZONEOPT2_. 687 * 688 * Require: 689 *\li 'zone' to be a valid zone. 690 */ 691 692 unsigned int 693 dns_zone_getoptions(dns_zone_t *zone); 694 unsigned int 695 dns_zone_getoptions2(dns_zone_t *zone); 696 /*%< 697 * Returns the current zone options. 698 * 699 * Callers should be aware there is now more than one set of zone 700 * options. dns_zone_getoptions2() has been introduced because the 701 * number of options needed now exceeds the 32 bits in the 702 * zone->options field. It returns the options whose names begin 703 * with DNS_ZONEOPT2_. 704 * 705 * Require: 706 *\li 'zone' to be a valid zone. 707 */ 708 709 void 710 dns_zone_setkeyopt(dns_zone_t *zone, unsigned int option, isc_boolean_t value); 711 /*%< 712 * Set key options on ('value' == ISC_TRUE) or off ('value' == 713 * #ISC_FALSE). 714 * 715 * Require: 716 *\li 'zone' to be a valid zone. 717 */ 718 719 unsigned int 720 dns_zone_getkeyopts(dns_zone_t *zone); 721 /*%< 722 * Returns the current zone key options. 723 * 724 * Require: 725 *\li 'zone' to be a valid zone. 726 */ 727 728 void 729 dns_zone_setminrefreshtime(dns_zone_t *zone, isc_uint32_t val); 730 /*%< 731 * Set the minimum refresh time. 732 * 733 * Requires: 734 *\li 'zone' is valid. 735 *\li val > 0. 736 */ 737 738 void 739 dns_zone_setmaxrefreshtime(dns_zone_t *zone, isc_uint32_t val); 740 /*%< 741 * Set the maximum refresh time. 742 * 743 * Requires: 744 *\li 'zone' is valid. 745 *\li val > 0. 746 */ 747 748 void 749 dns_zone_setminretrytime(dns_zone_t *zone, isc_uint32_t val); 750 /*%< 751 * Set the minimum retry time. 752 * 753 * Requires: 754 *\li 'zone' is valid. 755 *\li val > 0. 756 */ 757 758 void 759 dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val); 760 /*%< 761 * Set the maximum retry time. 762 * 763 * Requires: 764 *\li 'zone' is valid. 765 * val > 0. 766 */ 767 768 isc_result_t 769 dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); 770 isc_result_t 771 dns_zone_setaltxfrsource4(dns_zone_t *zone, 772 const isc_sockaddr_t *xfrsource); 773 /*%< 774 * Set the source address to be used in IPv4 zone transfers. 775 * 776 * Require: 777 *\li 'zone' to be a valid zone. 778 *\li 'xfrsource' to contain the address. 779 * 780 * Returns: 781 *\li #ISC_R_SUCCESS 782 */ 783 784 isc_sockaddr_t * 785 dns_zone_getxfrsource4(dns_zone_t *zone); 786 isc_sockaddr_t * 787 dns_zone_getaltxfrsource4(dns_zone_t *zone); 788 /*%< 789 * Returns the source address set by a previous dns_zone_setxfrsource4 790 * call, or the default of inaddr_any, port 0. 791 * 792 * Require: 793 *\li 'zone' to be a valid zone. 794 */ 795 796 isc_result_t 797 dns_zone_setxfrsource4dscp(dns_zone_t *zone, isc_dscp_t dscp); 798 isc_result_t 799 dns_zone_setaltxfrsource4dscp(dns_zone_t *zone, isc_dscp_t dscp); 800 /*%< 801 * Set the DSCP value associated with the transfer/alt-transfer source. 802 * 803 * Require: 804 *\li 'zone' to be a valid zone. 805 * 806 * Returns: 807 *\li #ISC_R_SUCCESS 808 */ 809 810 isc_dscp_t 811 dns_zone_getxfrsource4dscp(dns_zone_t *zone); 812 isc_dscp_t 813 dns_zone_getaltxfrsource4dscp(dns_zone_t *zone); 814 /*%/ 815 * Get the DSCP value associated with the transfer/alt-transfer source. 816 * 817 * Require: 818 *\li 'zone' to be a valid zone. 819 */ 820 821 822 isc_result_t 823 dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); 824 isc_result_t 825 dns_zone_setaltxfrsource6(dns_zone_t *zone, 826 const isc_sockaddr_t *xfrsource); 827 /*%< 828 * Set the source address to be used in IPv6 zone transfers. 829 * 830 * Require: 831 *\li 'zone' to be a valid zone. 832 *\li 'xfrsource' to contain the address. 833 * 834 * Returns: 835 *\li #ISC_R_SUCCESS 836 */ 837 838 isc_sockaddr_t * 839 dns_zone_getxfrsource6(dns_zone_t *zone); 840 isc_sockaddr_t * 841 dns_zone_getaltxfrsource6(dns_zone_t *zone); 842 /*%< 843 * Returns the source address set by a previous dns_zone_setxfrsource6 844 * call, or the default of in6addr_any, port 0. 845 * 846 * Require: 847 *\li 'zone' to be a valid zone. 848 */ 849 850 isc_dscp_t 851 dns_zone_getxfrsource6dscp(dns_zone_t *zone); 852 isc_dscp_t 853 dns_zone_getaltxfrsource6dscp(dns_zone_t *zone); 854 /*%/ 855 * Get the DSCP value associated with the transfer/alt-transfer source. 856 * 857 * Require: 858 *\li 'zone' to be a valid zone. 859 */ 860 861 isc_result_t 862 dns_zone_setxfrsource6dscp(dns_zone_t *zone, isc_dscp_t dscp); 863 isc_result_t 864 dns_zone_setaltxfrsource6dscp(dns_zone_t *zone, isc_dscp_t dscp); 865 /*%< 866 * Set the DSCP value associated with the transfer/alt-transfer source. 867 * 868 * Require: 869 *\li 'zone' to be a valid zone. 870 * 871 * Returns: 872 *\li #ISC_R_SUCCESS 873 */ 874 875 isc_result_t 876 dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc); 877 /*%< 878 * Set the source address to be used with IPv4 NOTIFY messages. 879 * 880 * Require: 881 *\li 'zone' to be a valid zone. 882 *\li 'notifysrc' to contain the address. 883 * 884 * Returns: 885 *\li #ISC_R_SUCCESS 886 */ 887 888 isc_sockaddr_t * 889 dns_zone_getnotifysrc4(dns_zone_t *zone); 890 /*%< 891 * Returns the source address set by a previous dns_zone_setnotifysrc4 892 * call, or the default of inaddr_any, port 0. 893 * 894 * Require: 895 *\li 'zone' to be a valid zone. 896 */ 897 898 isc_dscp_t 899 dns_zone_getnotifysrc4dscp(dns_zone_t *zone); 900 /*%/ 901 * Get the DCSP value associated with the notify source. 902 * 903 * Require: 904 *\li 'zone' to be a valid zone. 905 */ 906 907 isc_result_t 908 dns_zone_setnotifysrc4dscp(dns_zone_t *zone, isc_dscp_t dscp); 909 /*%< 910 * Set the DSCP value associated with the notify source. 911 * 912 * Require: 913 *\li 'zone' to be a valid zone. 914 * 915 * Returns: 916 *\li #ISC_R_SUCCESS 917 */ 918 919 isc_dscp_t 920 dns_zone_getnotifysrc4dscp(dns_zone_t *zone); 921 /*%/ 922 * Get the DSCP value associated with the notify source. 923 * 924 * Require: 925 *\li 'zone' to be a valid zone. 926 */ 927 928 isc_result_t 929 dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc); 930 /*%< 931 * Set the source address to be used with IPv6 NOTIFY messages. 932 * 933 * Require: 934 *\li 'zone' to be a valid zone. 935 *\li 'notifysrc' to contain the address. 936 * 937 * Returns: 938 *\li #ISC_R_SUCCESS 939 */ 940 941 isc_sockaddr_t * 942 dns_zone_getnotifysrc6(dns_zone_t *zone); 943 /*%< 944 * Returns the source address set by a previous dns_zone_setnotifysrc6 945 * call, or the default of in6addr_any, port 0. 946 * 947 * Require: 948 *\li 'zone' to be a valid zone. 949 */ 950 951 isc_dscp_t 952 dns_zone_getnotifysrc6dscp(dns_zone_t *zone); 953 /*%/ 954 * Get the DCSP value associated with the notify source. 955 * 956 * Require: 957 *\li 'zone' to be a valid zone. 958 */ 959 960 isc_result_t 961 dns_zone_setnotifysrc6dscp(dns_zone_t *zone, isc_dscp_t dscp); 962 /*%< 963 * Set the DSCP value associated with the notify source. 964 * 965 * Require: 966 *\li 'zone' to be a valid zone. 967 * 968 * Returns: 969 *\li #ISC_R_SUCCESS 970 */ 971 972 isc_dscp_t 973 dns_zone_getnotifysrc6dscp(dns_zone_t *zone); 974 /*%/ 975 * Get the DSCP value associated with the notify source. 976 * 977 * Require: 978 *\li 'zone' to be a valid zone. 979 */ 980 981 void 982 dns_zone_setnotifyacl(dns_zone_t *zone, dns_acl_t *acl); 983 /*%< 984 * Sets the notify acl list for the zone. 985 * 986 * Require: 987 *\li 'zone' to be a valid zone. 988 *\li 'acl' to be a valid acl. 989 */ 990 991 void 992 dns_zone_setqueryacl(dns_zone_t *zone, dns_acl_t *acl); 993 /*%< 994 * Sets the query acl list for the zone. 995 * 996 * Require: 997 *\li 'zone' to be a valid zone. 998 *\li 'acl' to be a valid acl. 999 */ 1000 1001 void 1002 dns_zone_setqueryonacl(dns_zone_t *zone, dns_acl_t *acl); 1003 /*%< 1004 * Sets the query-on acl list for the zone. 1005 * 1006 * Require: 1007 *\li 'zone' to be a valid zone. 1008 *\li 'acl' to be a valid acl. 1009 */ 1010 1011 void 1012 dns_zone_setupdateacl(dns_zone_t *zone, dns_acl_t *acl); 1013 /*%< 1014 * Sets the update acl list for the zone. 1015 * 1016 * Require: 1017 *\li 'zone' to be a valid zone. 1018 *\li 'acl' to be valid acl. 1019 */ 1020 1021 void 1022 dns_zone_setforwardacl(dns_zone_t *zone, dns_acl_t *acl); 1023 /*%< 1024 * Sets the forward unsigned updates acl list for the zone. 1025 * 1026 * Require: 1027 *\li 'zone' to be a valid zone. 1028 *\li 'acl' to be valid acl. 1029 */ 1030 1031 void 1032 dns_zone_setxfracl(dns_zone_t *zone, dns_acl_t *acl); 1033 /*%< 1034 * Sets the transfer acl list for the zone. 1035 * 1036 * Require: 1037 *\li 'zone' to be a valid zone. 1038 *\li 'acl' to be valid acl. 1039 */ 1040 1041 dns_acl_t * 1042 dns_zone_getnotifyacl(dns_zone_t *zone); 1043 /*%< 1044 * Returns the current notify acl or NULL. 1045 * 1046 * Require: 1047 *\li 'zone' to be a valid zone. 1048 * 1049 * Returns: 1050 *\li acl a pointer to the acl. 1051 *\li NULL 1052 */ 1053 1054 dns_acl_t * 1055 dns_zone_getqueryacl(dns_zone_t *zone); 1056 /*%< 1057 * Returns the current query acl or NULL. 1058 * 1059 * Require: 1060 *\li 'zone' to be a valid zone. 1061 * 1062 * Returns: 1063 *\li acl a pointer to the acl. 1064 *\li NULL 1065 */ 1066 1067 dns_acl_t * 1068 dns_zone_getqueryonacl(dns_zone_t *zone); 1069 /*%< 1070 * Returns the current query-on acl or NULL. 1071 * 1072 * Require: 1073 *\li 'zone' to be a valid zone. 1074 * 1075 * Returns: 1076 *\li acl a pointer to the acl. 1077 *\li NULL 1078 */ 1079 1080 dns_acl_t * 1081 dns_zone_getupdateacl(dns_zone_t *zone); 1082 /*%< 1083 * Returns the current update acl or NULL. 1084 * 1085 * Require: 1086 *\li 'zone' to be a valid zone. 1087 * 1088 * Returns: 1089 *\li acl a pointer to the acl. 1090 *\li NULL 1091 */ 1092 1093 dns_acl_t * 1094 dns_zone_getforwardacl(dns_zone_t *zone); 1095 /*%< 1096 * Returns the current forward unsigned updates acl or NULL. 1097 * 1098 * Require: 1099 *\li 'zone' to be a valid zone. 1100 * 1101 * Returns: 1102 *\li acl a pointer to the acl. 1103 *\li NULL 1104 */ 1105 1106 dns_acl_t * 1107 dns_zone_getxfracl(dns_zone_t *zone); 1108 /*%< 1109 * Returns the current transfer acl or NULL. 1110 * 1111 * Require: 1112 *\li 'zone' to be a valid zone. 1113 * 1114 * Returns: 1115 *\li acl a pointer to the acl. 1116 *\li NULL 1117 */ 1118 1119 void 1120 dns_zone_clearupdateacl(dns_zone_t *zone); 1121 /*%< 1122 * Clear the current update acl. 1123 * 1124 * Require: 1125 *\li 'zone' to be a valid zone. 1126 */ 1127 1128 void 1129 dns_zone_clearforwardacl(dns_zone_t *zone); 1130 /*%< 1131 * Clear the current forward unsigned updates acl. 1132 * 1133 * Require: 1134 *\li 'zone' to be a valid zone. 1135 */ 1136 1137 void 1138 dns_zone_clearnotifyacl(dns_zone_t *zone); 1139 /*%< 1140 * Clear the current notify acl. 1141 * 1142 * Require: 1143 *\li 'zone' to be a valid zone. 1144 */ 1145 1146 void 1147 dns_zone_clearqueryacl(dns_zone_t *zone); 1148 /*%< 1149 * Clear the current query acl. 1150 * 1151 * Require: 1152 *\li 'zone' to be a valid zone. 1153 */ 1154 1155 void 1156 dns_zone_clearqueryonacl(dns_zone_t *zone); 1157 /*%< 1158 * Clear the current query-on acl. 1159 * 1160 * Require: 1161 *\li 'zone' to be a valid zone. 1162 */ 1163 1164 void 1165 dns_zone_clearxfracl(dns_zone_t *zone); 1166 /*%< 1167 * Clear the current transfer acl. 1168 * 1169 * Require: 1170 *\li 'zone' to be a valid zone. 1171 */ 1172 1173 isc_boolean_t 1174 dns_zone_getupdatedisabled(dns_zone_t *zone); 1175 /*%< 1176 * Return update disabled. 1177 * Transient unless called when running in isc_task_exclusive() mode. 1178 */ 1179 1180 void 1181 dns_zone_setupdatedisabled(dns_zone_t *zone, isc_boolean_t state); 1182 /*%< 1183 * Set update disabled. 1184 * Should only be called only when running in isc_task_exclusive() mode. 1185 * Failure to do so may result in updates being committed after the 1186 * call has been made. 1187 */ 1188 1189 isc_boolean_t 1190 dns_zone_getzeronosoattl(dns_zone_t *zone); 1191 /*%< 1192 * Return zero-no-soa-ttl status. 1193 */ 1194 1195 void 1196 dns_zone_setzeronosoattl(dns_zone_t *zone, isc_boolean_t state); 1197 /*%< 1198 * Set zero-no-soa-ttl status. 1199 */ 1200 1201 void 1202 dns_zone_setchecknames(dns_zone_t *zone, dns_severity_t severity); 1203 /*%< 1204 * Set the severity of name checking when loading a zone. 1205 * 1206 * Require: 1207 * \li 'zone' to be a valid zone. 1208 */ 1209 1210 dns_severity_t 1211 dns_zone_getchecknames(dns_zone_t *zone); 1212 /*%< 1213 * Return the current severity of name checking. 1214 * 1215 * Require: 1216 *\li 'zone' to be a valid zone. 1217 */ 1218 1219 void 1220 dns_zone_setjournalsize(dns_zone_t *zone, isc_int32_t size); 1221 /*%< 1222 * Sets the journal size for the zone. 1223 * 1224 * Requires: 1225 *\li 'zone' to be a valid zone. 1226 */ 1227 1228 isc_int32_t 1229 dns_zone_getjournalsize(dns_zone_t *zone); 1230 /*%< 1231 * Return the journal size as set with a previous call to 1232 * dns_zone_setjournalsize(). 1233 * 1234 * Requires: 1235 *\li 'zone' to be a valid zone. 1236 */ 1237 1238 isc_result_t 1239 dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from, 1240 dns_message_t *msg); 1241 /*%< 1242 * Tell the zone that it has received a NOTIFY message from another 1243 * server. This may cause some zone maintenance activity to occur. 1244 * 1245 * Requires: 1246 *\li 'zone' to be a valid zone. 1247 *\li '*from' to contain the address of the server from which 'msg' 1248 * was received. 1249 *\li 'msg' a message with opcode NOTIFY and qr clear. 1250 * 1251 * Returns: 1252 *\li DNS_R_REFUSED 1253 *\li DNS_R_NOTIMP 1254 *\li DNS_R_FORMERR 1255 *\li DNS_R_SUCCESS 1256 */ 1257 1258 void 1259 dns_zone_setmaxxfrin(dns_zone_t *zone, isc_uint32_t maxxfrin); 1260 /*%< 1261 * Set the maximum time (in seconds) that a zone transfer in (AXFR/IXFR) 1262 * of this zone will use before being aborted. 1263 * 1264 * Requires: 1265 * \li 'zone' to be valid initialised zone. 1266 */ 1267 1268 isc_uint32_t 1269 dns_zone_getmaxxfrin(dns_zone_t *zone); 1270 /*%< 1271 * Returns the maximum transfer time for this zone. This will be 1272 * either the value set by the last call to dns_zone_setmaxxfrin() or 1273 * the default value of 1 hour. 1274 * 1275 * Requires: 1276 *\li 'zone' to be valid initialised zone. 1277 */ 1278 1279 void 1280 dns_zone_setmaxxfrout(dns_zone_t *zone, isc_uint32_t maxxfrout); 1281 /*%< 1282 * Set the maximum time (in seconds) that a zone transfer out (AXFR/IXFR) 1283 * of this zone will use before being aborted. 1284 * 1285 * Requires: 1286 * \li 'zone' to be valid initialised zone. 1287 */ 1288 1289 isc_uint32_t 1290 dns_zone_getmaxxfrout(dns_zone_t *zone); 1291 /*%< 1292 * Returns the maximum transfer time for this zone. This will be 1293 * either the value set by the last call to dns_zone_setmaxxfrout() or 1294 * the default value of 1 hour. 1295 * 1296 * Requires: 1297 *\li 'zone' to be valid initialised zone. 1298 */ 1299 1300 isc_result_t 1301 dns_zone_setjournal(dns_zone_t *zone, const char *journal); 1302 /*%< 1303 * Sets the filename used for journaling updates / IXFR transfers. 1304 * The default journal name is set by dns_zone_setfile() to be 1305 * "file.jnl". If 'journal' is NULL, the zone will have no 1306 * journal name. 1307 * 1308 * Requires: 1309 *\li 'zone' to be a valid zone. 1310 * 1311 * Returns: 1312 *\li #ISC_R_SUCCESS 1313 *\li #ISC_R_NOMEMORY 1314 */ 1315 1316 char * 1317 dns_zone_getjournal(dns_zone_t *zone); 1318 /*%< 1319 * Returns the journal name associated with this zone. 1320 * If no journal has been set this will be NULL. 1321 * 1322 * Requires: 1323 *\li 'zone' to be valid initialised zone. 1324 */ 1325 1326 dns_zonetype_t 1327 dns_zone_gettype(dns_zone_t *zone); 1328 /*%< 1329 * Returns the type of the zone (master/slave/etc.) 1330 * 1331 * Requires: 1332 *\li 'zone' to be valid initialised zone. 1333 */ 1334 1335 void 1336 dns_zone_settask(dns_zone_t *zone, isc_task_t *task); 1337 /*%< 1338 * Give a zone a task to work with. Any current task will be detached. 1339 * 1340 * Requires: 1341 *\li 'zone' to be valid. 1342 *\li 'task' to be valid. 1343 */ 1344 1345 void 1346 dns_zone_gettask(dns_zone_t *zone, isc_task_t **target); 1347 /*%< 1348 * Attach '*target' to the zone's task. 1349 * 1350 * Requires: 1351 *\li 'zone' to be valid initialised zone. 1352 *\li 'zone' to have a task. 1353 *\li 'target' to be != NULL && '*target' == NULL. 1354 */ 1355 1356 void 1357 dns_zone_notify(dns_zone_t *zone); 1358 /*%< 1359 * Generate notify events for this zone. 1360 * 1361 * Requires: 1362 *\li 'zone' to be a valid zone. 1363 */ 1364 1365 isc_result_t 1366 dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump); 1367 /*%< 1368 * Replace the database of "zone" with a new database "db". 1369 * 1370 * If "dump" is ISC_TRUE, then the new zone contents are dumped 1371 * into to the zone's master file for persistence. When replacing 1372 * a zone database by one just loaded from a master file, set 1373 * "dump" to ISC_FALSE to avoid a redundant redump of the data just 1374 * loaded. Otherwise, it should be set to ISC_TRUE. 1375 * 1376 * If the "diff-on-reload" option is enabled in the configuration file, 1377 * the differences between the old and the new database are added to the 1378 * journal file, and the master file dump is postponed. 1379 * 1380 * Requires: 1381 * \li 'zone' to be a valid zone. 1382 * 1383 * Returns: 1384 * \li DNS_R_SUCCESS 1385 * \li DNS_R_BADZONE zone failed basic consistency checks: 1386 * * a single SOA must exist 1387 * * some NS records must exist. 1388 * Others 1389 */ 1390 1391 isc_uint32_t 1392 dns_zone_getidlein(dns_zone_t *zone); 1393 /*%< 1394 * Requires: 1395 * \li 'zone' to be a valid zone. 1396 * 1397 * Returns: 1398 * \li number of seconds of idle time before we abort the transfer in. 1399 */ 1400 1401 void 1402 dns_zone_setidlein(dns_zone_t *zone, isc_uint32_t idlein); 1403 /*%< 1404 * \li Set the idle timeout for transfer the. 1405 * \li Zero set the default value, 1 hour. 1406 * 1407 * Requires: 1408 * \li 'zone' to be a valid zone. 1409 */ 1410 1411 isc_uint32_t 1412 dns_zone_getidleout(dns_zone_t *zone); 1413 /*%< 1414 * 1415 * Requires: 1416 * \li 'zone' to be a valid zone. 1417 * 1418 * Returns: 1419 * \li number of seconds of idle time before we abort a transfer out. 1420 */ 1421 1422 void 1423 dns_zone_setidleout(dns_zone_t *zone, isc_uint32_t idleout); 1424 /*%< 1425 * \li Set the idle timeout for transfers out. 1426 * \li Zero set the default value, 1 hour. 1427 * 1428 * Requires: 1429 * \li 'zone' to be a valid zone. 1430 */ 1431 1432 void 1433 dns_zone_getssutable(dns_zone_t *zone, dns_ssutable_t **table); 1434 /*%< 1435 * Get the simple-secure-update policy table. 1436 * 1437 * Requires: 1438 * \li 'zone' to be a valid zone. 1439 */ 1440 1441 void 1442 dns_zone_setssutable(dns_zone_t *zone, dns_ssutable_t *table); 1443 /*%< 1444 * Set / clear the simple-secure-update policy table. 1445 * 1446 * Requires: 1447 * \li 'zone' to be a valid zone. 1448 */ 1449 1450 isc_mem_t * 1451 dns_zone_getmctx(dns_zone_t *zone); 1452 /*%< 1453 * Get the memory context of a zone. 1454 * 1455 * Requires: 1456 * \li 'zone' to be a valid zone. 1457 */ 1458 1459 dns_zonemgr_t * 1460 dns_zone_getmgr(dns_zone_t *zone); 1461 /*%< 1462 * If 'zone' is managed return the zone manager otherwise NULL. 1463 * 1464 * Requires: 1465 * \li 'zone' to be a valid zone. 1466 */ 1467 1468 void 1469 dns_zone_setsigvalidityinterval(dns_zone_t *zone, isc_uint32_t interval); 1470 /*%< 1471 * Set the zone's RRSIG validity interval. This is the length of time 1472 * for which DNSSEC signatures created as a result of dynamic updates 1473 * to secure zones will remain valid, in seconds. 1474 * 1475 * Requires: 1476 * \li 'zone' to be a valid zone. 1477 */ 1478 1479 isc_uint32_t 1480 dns_zone_getsigvalidityinterval(dns_zone_t *zone); 1481 /*%< 1482 * Get the zone's RRSIG validity interval. 1483 * 1484 * Requires: 1485 * \li 'zone' to be a valid zone. 1486 */ 1487 1488 void 1489 dns_zone_setsigresigninginterval(dns_zone_t *zone, isc_uint32_t interval); 1490 /*%< 1491 * Set the zone's RRSIG re-signing interval. A dynamic zone's RRSIG's 1492 * will be re-signed 'interval' amount of time before they expire. 1493 * 1494 * Requires: 1495 * \li 'zone' to be a valid zone. 1496 */ 1497 1498 isc_uint32_t 1499 dns_zone_getsigresigninginterval(dns_zone_t *zone); 1500 /*%< 1501 * Get the zone's RRSIG re-signing interval. 1502 * 1503 * Requires: 1504 * \li 'zone' to be a valid zone. 1505 */ 1506 1507 void 1508 dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype); 1509 /*%< 1510 * Sets zone notify method to "notifytype" 1511 */ 1512 1513 isc_result_t 1514 dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg, 1515 dns_updatecallback_t callback, void *callback_arg); 1516 /*%< 1517 * Forward 'msg' to each master in turn until we get an answer or we 1518 * have exhausted the list of masters. 'callback' will be called with 1519 * ISC_R_SUCCESS if we get an answer and the returned message will be 1520 * passed as 'answer_message', otherwise a non ISC_R_SUCCESS result code 1521 * will be passed and answer_message will be NULL. The callback function 1522 * is responsible for destroying 'answer_message'. 1523 * (callback)(callback_arg, result, answer_message); 1524 * 1525 * Require: 1526 *\li 'zone' to be valid 1527 *\li 'msg' to be valid. 1528 *\li 'callback' to be non NULL. 1529 * Returns: 1530 *\li #ISC_R_SUCCESS if the message has been forwarded, 1531 *\li #ISC_R_NOMEMORY 1532 *\li Others 1533 */ 1534 1535 isc_result_t 1536 dns_zone_next(dns_zone_t *zone, dns_zone_t **next); 1537 /*%< 1538 * Find the next zone in the list of managed zones. 1539 * 1540 * Requires: 1541 *\li 'zone' to be valid 1542 *\li The zone manager for the indicated zone MUST be locked 1543 * by the caller. This is not checked. 1544 *\li 'next' be non-NULL, and '*next' be NULL. 1545 * 1546 * Ensures: 1547 *\li 'next' points to a valid zone (result ISC_R_SUCCESS) or to NULL 1548 * (result ISC_R_NOMORE). 1549 */ 1550 1551 1552 1553 isc_result_t 1554 dns_zone_first(dns_zonemgr_t *zmgr, dns_zone_t **first); 1555 /*%< 1556 * Find the first zone in the list of managed zones. 1557 * 1558 * Requires: 1559 *\li 'zonemgr' to be valid 1560 *\li The zone manager for the indicated zone MUST be locked 1561 * by the caller. This is not checked. 1562 *\li 'first' be non-NULL, and '*first' be NULL 1563 * 1564 * Ensures: 1565 *\li 'first' points to a valid zone (result ISC_R_SUCCESS) or to NULL 1566 * (result ISC_R_NOMORE). 1567 */ 1568 1569 isc_result_t 1570 dns_zone_setkeydirectory(dns_zone_t *zone, const char *directory); 1571 /*%< 1572 * Sets the name of the directory where private keys used for 1573 * online signing of dynamic zones are found. 1574 * 1575 * Require: 1576 *\li 'zone' to be a valid zone. 1577 * 1578 * Returns: 1579 *\li #ISC_R_NOMEMORY 1580 *\li #ISC_R_SUCCESS 1581 */ 1582 1583 const char * 1584 dns_zone_getkeydirectory(dns_zone_t *zone); 1585 /*%< 1586 * Gets the name of the directory where private keys used for 1587 * online signing of dynamic zones are found. 1588 * 1589 * Requires: 1590 *\li 'zone' to be valid initialised zone. 1591 * 1592 * Returns: 1593 * Pointer to null-terminated file name, or NULL. 1594 */ 1595 1596 1597 isc_result_t 1598 dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr, 1599 isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, 1600 dns_zonemgr_t **zmgrp); 1601 /*%< 1602 * Create a zone manager. Note: the zone manager will not be able to 1603 * manage any zones until dns_zonemgr_setsize() has been run. 1604 * 1605 * Requires: 1606 *\li 'mctx' to be a valid memory context. 1607 *\li 'taskmgr' to be a valid task manager. 1608 *\li 'timermgr' to be a valid timer manager. 1609 *\li 'zmgrp' to point to a NULL pointer. 1610 */ 1611 1612 isc_result_t 1613 dns_zonemgr_setsize(dns_zonemgr_t *zmgr, int num_zones); 1614 /*%< 1615 * Set the size of the zone manager task pool. This must be run 1616 * before zmgr can be used for managing zones. Currently, it can only 1617 * be run once; the task pool cannot be resized. 1618 * 1619 * Requires: 1620 *\li zmgr is a valid zone manager. 1621 *\li zmgr->zonetasks has been initialized. 1622 */ 1623 1624 isc_result_t 1625 dns_zonemgr_createzone(dns_zonemgr_t *zmgr, dns_zone_t **zonep); 1626 /*%< 1627 * Allocate a new zone using a memory context from the 1628 * zone manager's memory context pool. 1629 * 1630 * Require: 1631 *\li 'zmgr' to be a valid zone manager. 1632 *\li 'zonep' != NULL and '*zonep' == NULL. 1633 */ 1634 1635 1636 isc_result_t 1637 dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone); 1638 /*%< 1639 * Bring the zone under control of a zone manager. 1640 * 1641 * Require: 1642 *\li 'zmgr' to be a valid zone manager. 1643 *\li 'zone' to be a valid zone. 1644 */ 1645 1646 isc_result_t 1647 dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr); 1648 /*%< 1649 * Force zone maintenance of all loaded zones managed by 'zmgr' 1650 * to take place at the system's earliest convenience. 1651 */ 1652 1653 void 1654 dns__zonemgr_run(isc_task_t *task, isc_event_t *event); 1655 /*%< 1656 * Event handler to call dns_zonemgr_forcemaint(); used to start 1657 * zone operations from a unit test. Not intended for use outside 1658 * libdns or related tests. 1659 */ 1660 1661 void 1662 dns_zonemgr_resumexfrs(dns_zonemgr_t *zmgr); 1663 /*%< 1664 * Attempt to start any stalled zone transfers. 1665 */ 1666 1667 void 1668 dns_zonemgr_shutdown(dns_zonemgr_t *zmgr); 1669 /*%< 1670 * Shut down the zone manager. 1671 * 1672 * Requires: 1673 *\li 'zmgr' to be a valid zone manager. 1674 */ 1675 1676 void 1677 dns_zonemgr_attach(dns_zonemgr_t *source, dns_zonemgr_t **target); 1678 /*%< 1679 * Attach '*target' to 'source' incrementing its external 1680 * reference count. 1681 * 1682 * Require: 1683 *\li 'zone' to be a valid zone. 1684 *\li 'target' to be non NULL and '*target' to be NULL. 1685 */ 1686 1687 void 1688 dns_zonemgr_detach(dns_zonemgr_t **zmgrp); 1689 /*%< 1690 * Detach from a zone manager. 1691 * 1692 * Requires: 1693 *\li '*zmgrp' is a valid, non-NULL zone manager pointer. 1694 * 1695 * Ensures: 1696 *\li '*zmgrp' is NULL. 1697 */ 1698 1699 void 1700 dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone); 1701 /*%< 1702 * Release 'zone' from the managed by 'zmgr'. 'zmgr' is implicitly 1703 * detached from 'zone'. 1704 * 1705 * Requires: 1706 *\li 'zmgr' to be a valid zone manager. 1707 *\li 'zone' to be a valid zone. 1708 *\li 'zmgr' == 'zone->zmgr' 1709 * 1710 * Ensures: 1711 *\li 'zone->zmgr' == NULL; 1712 */ 1713 1714 void 1715 dns_zonemgr_settransfersin(dns_zonemgr_t *zmgr, isc_uint32_t value); 1716 /*%< 1717 * Set the maximum number of simultaneous transfers in allowed by 1718 * the zone manager. 1719 * 1720 * Requires: 1721 *\li 'zmgr' to be a valid zone manager. 1722 */ 1723 1724 isc_uint32_t 1725 dns_zonemgr_getttransfersin(dns_zonemgr_t *zmgr); 1726 /*%< 1727 * Return the maximum number of simultaneous transfers in allowed. 1728 * 1729 * Requires: 1730 *\li 'zmgr' to be a valid zone manager. 1731 */ 1732 1733 void 1734 dns_zonemgr_settransfersperns(dns_zonemgr_t *zmgr, isc_uint32_t value); 1735 /*%< 1736 * Set the number of zone transfers allowed per nameserver. 1737 * 1738 * Requires: 1739 *\li 'zmgr' to be a valid zone manager 1740 */ 1741 1742 isc_uint32_t 1743 dns_zonemgr_getttransfersperns(dns_zonemgr_t *zmgr); 1744 /*%< 1745 * Return the number of transfers allowed per nameserver. 1746 * 1747 * Requires: 1748 *\li 'zmgr' to be a valid zone manager. 1749 */ 1750 1751 void 1752 dns_zonemgr_setiolimit(dns_zonemgr_t *zmgr, isc_uint32_t iolimit); 1753 /*%< 1754 * Set the number of simultaneous file descriptors available for 1755 * reading and writing masterfiles. 1756 * 1757 * Requires: 1758 *\li 'zmgr' to be a valid zone manager. 1759 *\li 'iolimit' to be positive. 1760 */ 1761 1762 isc_uint32_t 1763 dns_zonemgr_getiolimit(dns_zonemgr_t *zmgr); 1764 /*%< 1765 * Get the number of simultaneous file descriptors available for 1766 * reading and writing masterfiles. 1767 * 1768 * Requires: 1769 *\li 'zmgr' to be a valid zone manager. 1770 */ 1771 1772 void 1773 dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value); 1774 /*%< 1775 * Set the number of SOA queries sent per second. 1776 * 1777 * Requires: 1778 *\li 'zmgr' to be a valid zone manager 1779 */ 1780 1781 unsigned int 1782 dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr); 1783 /*%< 1784 * Return the number of SOA queries sent per second. 1785 * 1786 * Requires: 1787 *\li 'zmgr' to be a valid zone manager. 1788 */ 1789 1790 unsigned int 1791 dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state); 1792 /*%< 1793 * Returns the number of zones in the specified state. 1794 * 1795 * Requires: 1796 *\li 'zmgr' to be a valid zone manager. 1797 *\li 'state' to be a valid DNS_ZONESTATE_ constant. 1798 */ 1799 1800 void 1801 dns_zonemgr_unreachableadd(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, 1802 isc_sockaddr_t *local, isc_time_t *now); 1803 /*%< 1804 * Add the pair of addresses to the unreachable cache. 1805 * 1806 * Requires: 1807 *\li 'zmgr' to be a valid zone manager. 1808 *\li 'remote' to be a valid sockaddr. 1809 *\li 'local' to be a valid sockaddr. 1810 */ 1811 1812 isc_boolean_t 1813 dns_zonemgr_unreachable(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, 1814 isc_sockaddr_t *local, isc_time_t *now); 1815 /*%< 1816 * Returns ISC_TRUE if the given local/remote address pair 1817 * is found in the zone maanger's unreachable cache. 1818 * 1819 * Requires: 1820 *\li 'zmgr' to be a valid zone manager. 1821 *\li 'remote' to be a valid sockaddr. 1822 *\li 'local' to be a valid sockaddr. 1823 *\li 'now' != NULL 1824 */ 1825 1826 void 1827 dns_zonemgr_unreachabledel(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, 1828 isc_sockaddr_t *local); 1829 /*%< 1830 * Remove the pair of addresses from the unreachable cache. 1831 * 1832 * Requires: 1833 *\li 'zmgr' to be a valid zone manager. 1834 *\li 'remote' to be a valid sockaddr. 1835 *\li 'local' to be a valid sockaddr. 1836 */ 1837 1838 void 1839 dns_zone_forcereload(dns_zone_t *zone); 1840 /*%< 1841 * Force a reload of specified zone. 1842 * 1843 * Requires: 1844 *\li 'zone' to be a valid zone. 1845 */ 1846 1847 isc_boolean_t 1848 dns_zone_isforced(dns_zone_t *zone); 1849 /*%< 1850 * Check if the zone is waiting a forced reload. 1851 * 1852 * Requires: 1853 * \li 'zone' to be a valid zone. 1854 */ 1855 1856 isc_result_t 1857 dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on); 1858 /*%< 1859 * This function is obsoleted by dns_zone_setrequeststats(). 1860 */ 1861 1862 isc_uint64_t * 1863 dns_zone_getstatscounters(dns_zone_t *zone); 1864 /*%< 1865 * This function is obsoleted by dns_zone_getrequeststats(). 1866 */ 1867 1868 void 1869 dns_zone_setstats(dns_zone_t *zone, isc_stats_t *stats); 1870 /*%< 1871 * Set a general zone-maintenance statistics set 'stats' for 'zone'. This 1872 * function is expected to be called only on zone creation (when necessary). 1873 * Once installed, it cannot be removed or replaced. Also, there is no 1874 * interface to get the installed stats from the zone; the caller must keep the 1875 * stats to reference (e.g. dump) it later. 1876 * 1877 * Requires: 1878 * \li 'zone' to be a valid zone and does not have a statistics set already 1879 * installed. 1880 * 1881 *\li stats is a valid statistics supporting zone statistics counters 1882 * (see dns/stats.h). 1883 */ 1884 1885 void 1886 dns_zone_setrequeststats(dns_zone_t *zone, isc_stats_t *stats); 1887 1888 void 1889 dns_zone_setrcvquerystats(dns_zone_t *zone, dns_stats_t *stats); 1890 /*%< 1891 * Set additional statistics sets to zone. These are attached to the zone 1892 * but are not counted in the zone module; only the caller updates the 1893 * counters. 1894 * 1895 * Requires: 1896 * \li 'zone' to be a valid zone. 1897 * 1898 *\li stats is a valid statistics. 1899 */ 1900 1901 isc_stats_t * 1902 dns_zone_getrequeststats(dns_zone_t *zone); 1903 1904 dns_stats_t * 1905 dns_zone_getrcvquerystats(dns_zone_t *zone); 1906 /*%< 1907 * Get the additional statistics for zone, if one is installed. 1908 * 1909 * Requires: 1910 * \li 'zone' to be a valid zone. 1911 * 1912 * Returns: 1913 * \li when available, a pointer to the statistics set installed in zone; 1914 * otherwise NULL. 1915 */ 1916 1917 void 1918 dns_zone_dialup(dns_zone_t *zone); 1919 /*%< 1920 * Perform dialup-time maintenance on 'zone'. 1921 */ 1922 1923 void 1924 dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup); 1925 /*%< 1926 * Set the dialup type of 'zone' to 'dialup'. 1927 * 1928 * Requires: 1929 * \li 'zone' to be valid initialised zone. 1930 *\li 'dialup' to be a valid dialup type. 1931 */ 1932 1933 void 1934 dns_zone_log(dns_zone_t *zone, int level, const char *msg, ...) 1935 ISC_FORMAT_PRINTF(3, 4); 1936 /*%< 1937 * Log the message 'msg...' at 'level', including text that identifies 1938 * the message as applying to 'zone'. 1939 */ 1940 1941 void 1942 dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category, int level, 1943 const char *msg, ...) ISC_FORMAT_PRINTF(4, 5); 1944 /*%< 1945 * Log the message 'msg...' at 'level', including text that identifies 1946 * the message as applying to 'zone'. 1947 */ 1948 1949 void 1950 dns_zone_name(dns_zone_t *zone, char *buf, size_t len); 1951 /*%< 1952 * Return the name of the zone with class and view. 1953 * 1954 * Requires: 1955 *\li 'zone' to be valid. 1956 *\li 'buf' to be non NULL. 1957 */ 1958 1959 isc_result_t 1960 dns_zone_checknames(dns_zone_t *zone, dns_name_t *name, dns_rdata_t *rdata); 1961 /*%< 1962 * Check if this record meets the check-names policy. 1963 * 1964 * Requires: 1965 * 'zone' to be valid. 1966 * 'name' to be valid. 1967 * 'rdata' to be valid. 1968 * 1969 * Returns: 1970 * DNS_R_SUCCESS passed checks. 1971 * DNS_R_BADOWNERNAME failed ownername checks. 1972 * DNS_R_BADNAME failed rdata checks. 1973 */ 1974 1975 void 1976 dns_zone_setacache(dns_zone_t *zone, dns_acache_t *acache); 1977 /*%< 1978 * Associate the zone with an additional cache. 1979 * 1980 * Require: 1981 * 'zone' to be a valid zone. 1982 * 'acache' to be a non NULL pointer. 1983 * 1984 * Ensures: 1985 * 'zone' will have a reference to 'acache' 1986 */ 1987 1988 void 1989 dns_zone_setcheckmx(dns_zone_t *zone, dns_checkmxfunc_t checkmx); 1990 /*%< 1991 * Set the post load integrity callback function 'checkmx'. 1992 * 'checkmx' will be called if the MX TARGET is not within the zone. 1993 * 1994 * Require: 1995 * 'zone' to be a valid zone. 1996 */ 1997 1998 void 1999 dns_zone_setchecksrv(dns_zone_t *zone, dns_checkmxfunc_t checksrv); 2000 /*%< 2001 * Set the post load integrity callback function 'checksrv'. 2002 * 'checksrv' will be called if the SRV TARGET is not within the zone. 2003 * 2004 * Require: 2005 * 'zone' to be a valid zone. 2006 */ 2007 2008 void 2009 dns_zone_setcheckns(dns_zone_t *zone, dns_checknsfunc_t checkns); 2010 /*%< 2011 * Set the post load integrity callback function 'checkns'. 2012 * 'checkns' will be called if the NS TARGET is not within the zone. 2013 * 2014 * Require: 2015 * 'zone' to be a valid zone. 2016 */ 2017 2018 void 2019 dns_zone_setnotifydelay(dns_zone_t *zone, isc_uint32_t delay); 2020 /*%< 2021 * Set the minimum delay between sets of notify messages. 2022 * 2023 * Requires: 2024 * 'zone' to be valid. 2025 */ 2026 2027 isc_uint32_t 2028 dns_zone_getnotifydelay(dns_zone_t *zone); 2029 /*%< 2030 * Get the minimum delay between sets of notify messages. 2031 * 2032 * Requires: 2033 * 'zone' to be valid. 2034 */ 2035 2036 void 2037 dns_zone_setisself(dns_zone_t *zone, dns_isselffunc_t isself, void *arg); 2038 /*%< 2039 * Set the isself callback function and argument. 2040 * 2041 * isc_boolean_t 2042 * isself(dns_view_t *myview, dns_tsigkey_t *mykey, isc_netaddr_t *srcaddr, 2043 * isc_netaddr_t *destaddr, dns_rdataclass_t rdclass, void *arg); 2044 * 2045 * 'isself' returns ISC_TRUE if a non-recursive query from 'srcaddr' to 2046 * 'destaddr' with optional key 'mykey' for class 'rdclass' would be 2047 * delivered to 'myview'. 2048 */ 2049 2050 void 2051 dns_zone_setnodes(dns_zone_t *zone, isc_uint32_t nodes); 2052 /*%< 2053 * Set the number of nodes that will be checked per quantum. 2054 */ 2055 2056 void 2057 dns_zone_setsignatures(dns_zone_t *zone, isc_uint32_t signatures); 2058 /*%< 2059 * Set the number of signatures that will be generated per quantum. 2060 */ 2061 2062 isc_result_t 2063 dns_zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, 2064 isc_uint16_t keyid, isc_boolean_t deleteit); 2065 /*%< 2066 * Initiate/resume signing of the entire zone with the zone DNSKEY(s) 2067 * that match the given algorithm and keyid. 2068 */ 2069 2070 isc_result_t 2071 dns_zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param); 2072 /*%< 2073 * Incrementally add a NSEC3 chain that corresponds to 'nsec3param'. 2074 */ 2075 2076 void 2077 dns_zone_setprivatetype(dns_zone_t *zone, dns_rdatatype_t type); 2078 dns_rdatatype_t 2079 dns_zone_getprivatetype(dns_zone_t *zone); 2080 /* 2081 * Get/Set the private record type. It is expected that these interfaces 2082 * will not be permanent. 2083 */ 2084 2085 void 2086 dns_zone_rekey(dns_zone_t *zone, isc_boolean_t fullsign); 2087 /*%< 2088 * Update the zone's DNSKEY set from the key repository. 2089 * 2090 * If 'fullsign' is true, trigger an immediate full signing of 2091 * the zone with the new key. Otherwise, if there are no keys or 2092 * if the new keys are for algorithms that have already signed the 2093 * zone, then the zone can be re-signed incrementally. 2094 */ 2095 2096 isc_result_t 2097 dns_zone_nscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, 2098 unsigned int *errors); 2099 /*% 2100 * Check if the name servers for the zone are sane (have address, don't 2101 * refer to CNAMEs/DNAMEs. The number of constiancy errors detected in 2102 * returned in '*errors' 2103 * 2104 * Requires: 2105 * \li 'zone' to be valid. 2106 * \li 'db' to be valid. 2107 * \li 'version' to be valid or NULL. 2108 * \li 'errors' to be non NULL. 2109 * 2110 * Returns: 2111 * ISC_R_SUCCESS if there were no errors examining the zone contents. 2112 */ 2113 2114 void 2115 dns_zone_setadded(dns_zone_t *zone, isc_boolean_t added); 2116 /*% 2117 * Sets the value of zone->added, which should be ISC_TRUE for 2118 * zones that were originally added by "rndc addzone". 2119 * 2120 * Requires: 2121 * \li 'zone' to be valid. 2122 */ 2123 2124 isc_boolean_t 2125 dns_zone_getadded(dns_zone_t *zone); 2126 /*% 2127 * Returns ISC_TRUE if the zone was originally added at runtime 2128 * using "rndc addzone". 2129 * 2130 * Requires: 2131 * \li 'zone' to be valid. 2132 */ 2133 2134 isc_result_t 2135 dns_zone_dlzpostload(dns_zone_t *zone, dns_db_t *db); 2136 /*% 2137 * Load the origin names for a writeable DLZ database. 2138 */ 2139 2140 isc_boolean_t 2141 dns_zone_isdynamic(dns_zone_t *zone, isc_boolean_t ignore_freeze); 2142 /*% 2143 * Return true iff the zone is "dynamic", in the sense that the zone's 2144 * master file (if any) is written by the server, rather than being 2145 * updated manually and read by the server. 2146 * 2147 * This is true for slave zones, stub zones, key zones, and zones that 2148 * allow dynamic updates either by having an update policy ("ssutable") 2149 * or an "allow-update" ACL with a value other than exactly "{ none; }". 2150 * 2151 * If 'ignore_freeze' is true, then the zone which has had updates disabled 2152 * will still report itself to be dynamic. 2153 * 2154 * Requires: 2155 * \li 'zone' to be valid. 2156 */ 2157 2158 isc_result_t 2159 dns_zone_setrefreshkeyinterval(dns_zone_t *zone, isc_uint32_t interval); 2160 /*% 2161 * Sets the frequency, in minutes, with which the key repository will be 2162 * checked to see if the keys for this zone have been updated. Any value 2163 * higher than 1440 minutes (24 hours) will be silently reduced. A 2164 * value of zero will return an out-of-range error. 2165 * 2166 * Requires: 2167 * \li 'zone' to be valid. 2168 */ 2169 2170 isc_boolean_t 2171 dns_zone_getrequestixfr(dns_zone_t *zone); 2172 /*% 2173 * Returns the true/false value of the request-ixfr option in the zone. 2174 * 2175 * Requires: 2176 * \li 'zone' to be valid. 2177 */ 2178 2179 void 2180 dns_zone_setrequestixfr(dns_zone_t *zone, isc_boolean_t flag); 2181 /*% 2182 * Sets the request-ixfr option for the zone. Either true or false. The 2183 * default value is determined by the setting of this option in the view. 2184 * 2185 * Requires: 2186 * \li 'zone' to be valid. 2187 */ 2188 2189 void 2190 dns_zone_setserialupdatemethod(dns_zone_t *zone, dns_updatemethod_t method); 2191 /*% 2192 * Sets the update method to use when incrementing the zone serial number 2193 * due to a DDNS update. Valid options are dns_updatemethod_increment 2194 * and dns_updatemethod_unixtime. 2195 * 2196 * Requires: 2197 * \li 'zone' to be valid. 2198 */ 2199 2200 dns_updatemethod_t 2201 dns_zone_getserialupdatemethod(dns_zone_t *zone); 2202 /*% 2203 * Returns the update method to be used when incrementing the zone serial 2204 * number due to a DDNS update. 2205 * 2206 * Requires: 2207 * \li 'zone' to be valid. 2208 */ 2209 2210 isc_result_t 2211 dns_zone_link(dns_zone_t *zone, dns_zone_t *raw); 2212 2213 void 2214 dns_zone_getraw(dns_zone_t *zone, dns_zone_t **raw); 2215 2216 isc_result_t 2217 dns_zone_keydone(dns_zone_t *zone, const char *data); 2218 2219 isc_result_t 2220 dns_zone_setnsec3param(dns_zone_t *zone, isc_uint8_t hash, isc_uint8_t flags, 2221 isc_uint16_t iter, isc_uint8_t saltlen, 2222 unsigned char *salt, isc_boolean_t replace); 2223 /*% 2224 * Set the NSEC3 parameters for the zone. 2225 * 2226 * If 'replace' is ISC_TRUE, then the existing NSEC3 chain, if any, will 2227 * be replaced with the new one. If 'hash' is zero, then the replacement 2228 * chain will be NSEC rather than NSEC3. 2229 * 2230 * Requires: 2231 * \li 'zone' to be valid. 2232 */ 2233 2234 void 2235 dns_zone_setrawdata(dns_zone_t *zone, dns_masterrawheader_t *header); 2236 /*% 2237 * Set the data to be included in the header when the zone is dumped in 2238 * binary format. 2239 */ 2240 2241 isc_result_t 2242 dns_zone_synckeyzone(dns_zone_t *zone); 2243 /*% 2244 * Force the managed key zone to synchronize, and start the key 2245 * maintenance timer. 2246 */ 2247 2248 isc_result_t 2249 dns_zone_getloadtime(dns_zone_t *zone, isc_time_t *loadtime); 2250 /*% 2251 * Return the time when the zone was last loaded. 2252 */ 2253 2254 isc_result_t 2255 dns_zone_getrefreshtime(dns_zone_t *zone, isc_time_t *refreshtime); 2256 /*% 2257 * Return the time when the (slave) zone will need to be refreshed. 2258 */ 2259 2260 isc_result_t 2261 dns_zone_getexpiretime(dns_zone_t *zone, isc_time_t *expiretime); 2262 /*% 2263 * Return the time when the (slave) zone will expire. 2264 */ 2265 2266 isc_result_t 2267 dns_zone_getrefreshkeytime(dns_zone_t *zone, isc_time_t *refreshkeytime); 2268 /*% 2269 * Return the time of the next scheduled DNSSEC key event. 2270 */ 2271 2272 unsigned int 2273 dns_zone_getincludes(dns_zone_t *zone, char ***includesp); 2274 /*% 2275 * Return the number include files that were encountered 2276 * during load. If the number is greater than zero, 'includesp' 2277 * will point to an array containing the filenames. 2278 * 2279 * The array and its contents need to be freed using isc_mem_free. 2280 */ 2281 2282 isc_result_t 2283 dns_zone_rpz_enable(dns_zone_t *zone, dns_rpz_zones_t *rpzs, 2284 dns_rpz_num_t rpz_num); 2285 /*% 2286 * Set the response policy associated with a zone. 2287 */ 2288 2289 void 2290 dns_zone_rpz_enable_db(dns_zone_t *zone, dns_db_t *db); 2291 /*% 2292 * If a zone is a response policy zone, mark its new database. 2293 */ 2294 2295 dns_rpz_num_t 2296 dns_zone_get_rpz_num(dns_zone_t *zone); 2297 2298 void 2299 dns_zone_setstatlevel(dns_zone_t *zone, dns_zonestat_level_t level); 2300 2301 dns_zonestat_level_t 2302 dns_zone_getstatlevel(dns_zone_t *zone); 2303 /*% 2304 * Set and get the statistics reporting level for the zone; 2305 * full, terse, or none. 2306 */ 2307 2308 ISC_LANG_ENDDECLS 2309 2310 2311 #endif /* DNS_ZONE_H */ 2312