00001 /* 00002 * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 1999-2003 Internet Software Consortium. 00004 * 00005 * Permission to use, copy, modify, and/or distribute this software for any 00006 * purpose with or without fee is hereby granted, provided that the above 00007 * copyright notice and this permission notice appear in all copies. 00008 * 00009 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00010 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00011 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00012 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00013 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00014 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00015 * PERFORMANCE OF THIS SOFTWARE. 00016 */ 00017 00018 /* $Id$ */ 00019 00020 #ifndef DNS_ZONE_H 00021 #define DNS_ZONE_H 1 00022 00023 /*! \file dns/zone.h */ 00024 00025 /*** 00026 *** Imports 00027 ***/ 00028 00029 #include <stdio.h> 00030 00031 #include <isc/formatcheck.h> 00032 #include <isc/lang.h> 00033 #include <isc/rwlock.h> 00034 00035 #include <dns/master.h> 00036 #include <dns/masterdump.h> 00037 #include <dns/rdatastruct.h> 00038 #include <dns/rpz.h> 00039 #include <dns/types.h> 00040 #include <dns/zt.h> 00041 00042 typedef enum { 00043 dns_zone_none, 00044 dns_zone_master, 00045 dns_zone_slave, 00046 dns_zone_stub, 00047 dns_zone_staticstub, 00048 dns_zone_key, 00049 dns_zone_dlz, 00050 dns_zone_redirect 00051 } dns_zonetype_t; 00052 00053 typedef enum { 00054 dns_zonestat_none = 0, 00055 dns_zonestat_terse, 00056 dns_zonestat_full 00057 } dns_zonestat_level_t; 00058 00059 #define DNS_ZONEOPT_SERVERS 0x00000001U /*%< perform server checks */ 00060 #define DNS_ZONEOPT_PARENTS 0x00000002U /*%< perform parent checks */ 00061 #define DNS_ZONEOPT_CHILDREN 0x00000004U /*%< perform child checks */ 00062 #define DNS_ZONEOPT_NOTIFY 0x00000008U /*%< perform NOTIFY */ 00063 #define DNS_ZONEOPT_MANYERRORS 0x00000010U /*%< return many errors on load */ 00064 #define DNS_ZONEOPT_IXFRFROMDIFFS 0x00000020U /*%< calculate differences */ 00065 #define DNS_ZONEOPT_NOMERGE 0x00000040U /*%< don't merge journal */ 00066 #define DNS_ZONEOPT_CHECKNS 0x00000080U /*%< check if NS's are addresses */ 00067 #define DNS_ZONEOPT_FATALNS 0x00000100U /*%< DNS_ZONEOPT_CHECKNS is fatal */ 00068 #define DNS_ZONEOPT_MULTIMASTER 0x00000200U /*%< this zone has multiple masters */ 00069 #define DNS_ZONEOPT_USEALTXFRSRC 0x00000400U /*%< use alternate transfer sources */ 00070 #define DNS_ZONEOPT_CHECKNAMES 0x00000800U /*%< check-names */ 00071 #define DNS_ZONEOPT_CHECKNAMESFAIL 0x00001000U /*%< fatal check-name failures */ 00072 #define DNS_ZONEOPT_CHECKWILDCARD 0x00002000U /*%< check for internal wildcards */ 00073 #define DNS_ZONEOPT_CHECKMX 0x00004000U /*%< check-mx */ 00074 #define DNS_ZONEOPT_CHECKMXFAIL 0x00008000U /*%< fatal check-mx failures */ 00075 #define DNS_ZONEOPT_CHECKINTEGRITY 0x00010000U /*%< perform integrity checks */ 00076 #define DNS_ZONEOPT_CHECKSIBLING 0x00020000U /*%< perform sibling glue checks */ 00077 #define DNS_ZONEOPT_NOCHECKNS 0x00040000U /*%< disable IN NS address checks */ 00078 #define DNS_ZONEOPT_WARNMXCNAME 0x00080000U /*%< warn on MX CNAME check */ 00079 #define DNS_ZONEOPT_IGNOREMXCNAME 0x00100000U /*%< ignore MX CNAME check */ 00080 #define DNS_ZONEOPT_WARNSRVCNAME 0x00200000U /*%< warn on SRV CNAME check */ 00081 #define DNS_ZONEOPT_IGNORESRVCNAME 0x00400000U /*%< ignore SRV CNAME check */ 00082 #define DNS_ZONEOPT_UPDATECHECKKSK 0x00800000U /*%< check dnskey KSK flag */ 00083 #define DNS_ZONEOPT_TRYTCPREFRESH 0x01000000U /*%< try tcp refresh on udp failure */ 00084 #define DNS_ZONEOPT_NOTIFYTOSOA 0x02000000U /*%< Notify the SOA MNAME */ 00085 #define DNS_ZONEOPT_NSEC3TESTZONE 0x04000000U /*%< nsec3-test-zone */ 00086 #define DNS_ZONEOPT_SECURETOINSECURE 0x08000000U /*%< dnssec-secure-to-insecure */ 00087 #define DNS_ZONEOPT_DNSKEYKSKONLY 0x10000000U /*%< dnssec-dnskey-kskonly */ 00088 #define DNS_ZONEOPT_CHECKDUPRR 0x20000000U /*%< check-dup-records */ 00089 #define DNS_ZONEOPT_CHECKDUPRRFAIL 0x40000000U /*%< fatal check-dup-records failures */ 00090 #define DNS_ZONEOPT_CHECKSPF 0x80000000U /*%< check SPF records */ 00091 00092 /* 00093 * The following zone options are shifted left into the 00094 * higher-order 32 bits of the options. 00095 */ 00096 #define DNS_ZONEOPT2_CHECKTTL 0x00000001 /*%< check max-zone-ttl */ 00097 00098 #ifndef NOMINUM_PUBLIC 00099 /* 00100 * Nominum specific options build down. 00101 */ 00102 #define DNS_ZONEOPT_NOTIFYFORWARD 0x80000000U /* forward notify to master */ 00103 #endif /* NOMINUM_PUBLIC */ 00104 00105 /* 00106 * Zone key maintenance options 00107 */ 00108 #define DNS_ZONEKEY_ALLOW 0x00000001U /*%< fetch keys on command */ 00109 #define DNS_ZONEKEY_MAINTAIN 0x00000002U /*%< publish/sign on schedule */ 00110 #define DNS_ZONEKEY_CREATE 0x00000004U /*%< make keys when needed */ 00111 #define DNS_ZONEKEY_FULLSIGN 0x00000008U /*%< roll to new keys immediately */ 00112 #define DNS_ZONEKEY_NORESIGN 0x00000010U /*%< no automatic resigning */ 00113 00114 #ifndef DNS_ZONE_MINREFRESH 00115 #define DNS_ZONE_MINREFRESH 300 /*%< 5 minutes */ 00116 #endif 00117 #ifndef DNS_ZONE_MAXREFRESH 00118 #define DNS_ZONE_MAXREFRESH 2419200 /*%< 4 weeks */ 00119 #endif 00120 #ifndef DNS_ZONE_DEFAULTREFRESH 00121 #define DNS_ZONE_DEFAULTREFRESH 3600 /*%< 1 hour */ 00122 #endif 00123 #ifndef DNS_ZONE_MINRETRY 00124 #define DNS_ZONE_MINRETRY 300 /*%< 5 minutes */ 00125 #endif 00126 #ifndef DNS_ZONE_MAXRETRY 00127 #define DNS_ZONE_MAXRETRY 1209600 /*%< 2 weeks */ 00128 #endif 00129 #ifndef DNS_ZONE_DEFAULTRETRY 00130 #define DNS_ZONE_DEFAULTRETRY 60 /*%< 1 minute, subject to 00131 exponential backoff */ 00132 #endif 00133 00134 #define DNS_ZONESTATE_XFERRUNNING 1 00135 #define DNS_ZONESTATE_XFERDEFERRED 2 00136 #define DNS_ZONESTATE_SOAQUERY 3 00137 #define DNS_ZONESTATE_ANY 4 00138 #define DNS_ZONESTATE_AUTOMATIC 5 00139 00140 ISC_LANG_BEGINDECLS 00141 00142 /*** 00143 *** Functions 00144 ***/ 00145 00146 isc_result_t 00147 dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx); 00148 /*%< 00149 * Creates a new empty zone and attach '*zonep' to it. 00150 * 00151 * Requires: 00152 *\li 'zonep' to point to a NULL pointer. 00153 *\li 'mctx' to be a valid memory context. 00154 * 00155 * Ensures: 00156 *\li '*zonep' refers to a valid zone. 00157 * 00158 * Returns: 00159 *\li #ISC_R_SUCCESS 00160 *\li #ISC_R_NOMEMORY 00161 *\li #ISC_R_UNEXPECTED 00162 */ 00163 00164 void 00165 dns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass); 00166 /*%< 00167 * Sets the class of a zone. This operation can only be performed 00168 * once on a zone. 00169 * 00170 * Require: 00171 *\li 'zone' to be a valid zone. 00172 *\li dns_zone_setclass() not to have been called since the zone was 00173 * created. 00174 *\li 'rdclass' != dns_rdataclass_none. 00175 */ 00176 00177 dns_rdataclass_t 00178 dns_zone_getclass(dns_zone_t *zone); 00179 /*%< 00180 * Returns the current zone class. 00181 * 00182 * Requires: 00183 *\li 'zone' to be a valid zone. 00184 */ 00185 00186 isc_result_t 00187 dns_zone_getserial2(dns_zone_t *zone, isc_uint32_t *serialp); 00188 00189 isc_uint32_t 00190 dns_zone_getserial(dns_zone_t *zone); 00191 /*%< 00192 * Returns the current serial number of the zone. On success, the SOA 00193 * serial of the zone will be copied into '*serialp'. 00194 * dns_zone_getserial() cannot catch failure cases and is deprecated by 00195 * dns_zone_getserial2(). 00196 * 00197 * Requires: 00198 *\li 'zone' to be a valid zone. 00199 *\li 'serialp' to be non NULL 00200 * 00201 * Returns: 00202 *\li #ISC_R_SUCCESS 00203 *\li #DNS_R_NOTLOADED zone DB is not loaded 00204 */ 00205 00206 void 00207 dns_zone_settype(dns_zone_t *zone, dns_zonetype_t type); 00208 /*%< 00209 * Sets the zone type. This operation can only be performed once on 00210 * a zone. 00211 * 00212 * Requires: 00213 *\li 'zone' to be a valid zone. 00214 *\li dns_zone_settype() not to have been called since the zone was 00215 * created. 00216 *\li 'type' != dns_zone_none 00217 */ 00218 00219 void 00220 dns_zone_setview(dns_zone_t *zone, dns_view_t *view); 00221 /*%< 00222 * Associate the zone with a view. 00223 * 00224 * Require: 00225 *\li 'zone' to be a valid zone. 00226 */ 00227 00228 dns_view_t * 00229 dns_zone_getview(dns_zone_t *zone); 00230 /*%< 00231 * Returns the zone's associated view. 00232 * 00233 * Requires: 00234 *\li 'zone' to be a valid zone. 00235 */ 00236 00237 isc_result_t 00238 dns_zone_setorigin(dns_zone_t *zone, const dns_name_t *origin); 00239 /*%< 00240 * Sets the zones origin to 'origin'. 00241 * 00242 * Require: 00243 *\li 'zone' to be a valid zone. 00244 *\li 'origin' to be non NULL. 00245 * 00246 * Returns: 00247 *\li #ISC_R_SUCCESS 00248 *\li #ISC_R_NOMEMORY 00249 */ 00250 00251 dns_name_t * 00252 dns_zone_getorigin(dns_zone_t *zone); 00253 /*%< 00254 * Returns the value of the origin. 00255 * 00256 * Require: 00257 *\li 'zone' to be a valid zone. 00258 */ 00259 00260 isc_result_t 00261 dns_zone_setfile(dns_zone_t *zone, const char *file); 00262 00263 isc_result_t 00264 dns_zone_setfile2(dns_zone_t *zone, const char *file, 00265 dns_masterformat_t format); 00266 isc_result_t 00267 dns_zone_setfile3(dns_zone_t *zone, const char *file, 00268 dns_masterformat_t format, const dns_master_style_t *style); 00269 /*%< 00270 * Sets the name of the master file in the format of 'format' from which 00271 * the zone loads its database to 'file'. 00272 * 00273 * For zones that have no associated master file, 'file' will be NULL. 00274 * 00275 * For zones with persistent databases, the file name 00276 * setting is ignored. 00277 * 00278 * dns_zone_setfile() is a backward-compatible form of 00279 * dns_zone_setfile2(), which always specifies the 00280 * dns_masterformat_text (RFC1035) format. 00281 * 00282 * dns_zone_setfile2() is a backward-compatible form of 00283 * dns_zone_setfile3(), which also specifies the style 00284 * that should be used if a zone using the 'text' 00285 * masterformat is ever dumped. 00286 * 00287 * Require: 00288 *\li 'zone' to be a valid zone. 00289 * 00290 * Returns: 00291 *\li #ISC_R_NOMEMORY 00292 *\li #ISC_R_SUCCESS 00293 */ 00294 00295 const char * 00296 dns_zone_getfile(dns_zone_t *zone); 00297 /*%< 00298 * Gets the name of the zone's master file, if any. 00299 * 00300 * Requires: 00301 *\li 'zone' to be valid initialised zone. 00302 * 00303 * Returns: 00304 *\li Pointer to null-terminated file name, or NULL. 00305 */ 00306 00307 void 00308 dns_zone_setmaxttl(dns_zone_t *zone, isc_uint32_t maxttl); 00309 /*%< 00310 * Sets the max ttl of the zone. 00311 * 00312 * Requires: 00313 *\li 'zone' to be valid initialised zone. 00314 * 00315 * Returns: 00316 *\li void 00317 */ 00318 00319 dns_ttl_t 00320 dns_zone_getmaxttl(dns_zone_t *zone); 00321 /*%< 00322 * Gets the max ttl of the zone. 00323 * 00324 * Requires: 00325 *\li 'zone' to be valid initialised zone. 00326 * 00327 * Returns: 00328 *\li isc_uint32_t maxttl. 00329 */ 00330 00331 isc_result_t 00332 dns_zone_load(dns_zone_t *zone); 00333 00334 isc_result_t 00335 dns_zone_loadnew(dns_zone_t *zone); 00336 00337 isc_result_t 00338 dns_zone_loadandthaw(dns_zone_t *zone); 00339 00340 /*%< 00341 * Cause the database to be loaded from its backing store. 00342 * Confirm that the minimum requirements for the zone type are 00343 * met, otherwise DNS_R_BADZONE is returned. 00344 * 00345 * dns_zone_loadnew() only loads zones that are not yet loaded. 00346 * dns_zone_load() also loads zones that are already loaded and 00347 * and whose master file has changed since the last load. 00348 * dns_zone_loadandthaw() is similar to dns_zone_load() but will 00349 * also re-enable DNS UPDATEs when the load completes. 00350 * 00351 * Require: 00352 *\li 'zone' to be a valid zone. 00353 * 00354 * Returns: 00355 *\li #ISC_R_UNEXPECTED 00356 *\li #ISC_R_SUCCESS 00357 *\li DNS_R_CONTINUE Incremental load has been queued. 00358 *\li DNS_R_UPTODATE The zone has already been loaded based on 00359 * file system timestamps. 00360 *\li DNS_R_BADZONE 00361 *\li Any result value from dns_db_load(). 00362 */ 00363 00364 isc_result_t 00365 dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg); 00366 /*%< 00367 * Cause the database to be loaded from its backing store asynchronously. 00368 * Other zone maintenance functions are suspended until this is complete. 00369 * When finished, 'done' is called to inform the caller, with 'arg' as 00370 * its first argument and 'zone' as its second. (Normally, 'arg' is 00371 * expected to point to the zone table but is left undefined for testing 00372 * purposes.) 00373 * 00374 * Require: 00375 *\li 'zone' to be a valid zone. 00376 * 00377 * Returns: 00378 *\li #ISC_R_ALREADYRUNNING 00379 *\li #ISC_R_SUCCESS 00380 *\li #ISC_R_FAILURE 00381 *\li #ISC_R_NOMEMORY 00382 */ 00383 00384 isc_boolean_t 00385 dns__zone_loadpending(dns_zone_t *zone); 00386 /*%< 00387 * Indicates whether the zone is waiting to be loaded asynchronously. 00388 * (Not currently intended for use outside of this module and associated 00389 * tests.) 00390 */ 00391 00392 void 00393 dns_zone_attach(dns_zone_t *source, dns_zone_t **target); 00394 /*%< 00395 * Attach '*target' to 'source' incrementing its external 00396 * reference count. 00397 * 00398 * Require: 00399 *\li 'zone' to be a valid zone. 00400 *\li 'target' to be non NULL and '*target' to be NULL. 00401 */ 00402 00403 void 00404 dns_zone_detach(dns_zone_t **zonep); 00405 /*%< 00406 * Detach from a zone decrementing its external reference count. 00407 * If this was the last external reference to the zone it will be 00408 * shut down and eventually freed. 00409 * 00410 * Require: 00411 *\li 'zonep' to point to a valid zone. 00412 */ 00413 00414 void 00415 dns_zone_iattach(dns_zone_t *source, dns_zone_t **target); 00416 /*%< 00417 * Attach '*target' to 'source' incrementing its internal 00418 * reference count. This is intended for use by operations 00419 * such as zone transfers that need to prevent the zone 00420 * object from being freed but not from shutting down. 00421 * 00422 * Require: 00423 *\li The caller is running in the context of the zone's task. 00424 *\li 'zone' to be a valid zone. 00425 *\li 'target' to be non NULL and '*target' to be NULL. 00426 */ 00427 00428 void 00429 dns_zone_idetach(dns_zone_t **zonep); 00430 /*%< 00431 * Detach from a zone decrementing its internal reference count. 00432 * If there are no more internal or external references to the 00433 * zone, it will be freed. 00434 * 00435 * Require: 00436 *\li The caller is running in the context of the zone's task. 00437 *\li 'zonep' to point to a valid zone. 00438 */ 00439 00440 void 00441 dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value); 00442 /*%< 00443 * Sets ('value' == 'ISC_TRUE') / clears ('value' == 'IS_FALSE') 00444 * zone flags. Valid flag bits are DNS_ZONE_F_*. 00445 * 00446 * Requires 00447 *\li 'zone' to be a valid zone. 00448 */ 00449 00450 isc_result_t 00451 dns_zone_getdb(dns_zone_t *zone, dns_db_t **dbp); 00452 /*%< 00453 * Attach '*dbp' to the database to if it exists otherwise 00454 * return DNS_R_NOTLOADED. 00455 * 00456 * Require: 00457 *\li 'zone' to be a valid zone. 00458 *\li 'dbp' to be != NULL && '*dbp' == NULL. 00459 * 00460 * Returns: 00461 *\li #ISC_R_SUCCESS 00462 *\li DNS_R_NOTLOADED 00463 */ 00464 00465 void 00466 dns_zone_setdb(dns_zone_t *zone, dns_db_t *db); 00467 /*%< 00468 * Sets the zone database to 'db'. 00469 * 00470 * This function is expected to be used to configure a zone with a 00471 * database which is not loaded from a file or zone transfer. 00472 * It can be used for a general purpose zone, but right now its use 00473 * is limited to static-stub zones to avoid possible undiscovered 00474 * problems in the general cases. 00475 * 00476 * Require: 00477 *\li 'zone' to be a valid zone of static-stub. 00478 *\li zone doesn't have a database. 00479 */ 00480 00481 isc_result_t 00482 dns_zone_setdbtype(dns_zone_t *zone, 00483 unsigned int dbargc, const char * const *dbargv); 00484 /*%< 00485 * Sets the database type to dbargv[0] and database arguments 00486 * to subsequent dbargv elements. 00487 * 'db_type' is not checked to see if it is a valid database type. 00488 * 00489 * Require: 00490 *\li 'zone' to be a valid zone. 00491 *\li 'database' to be non NULL. 00492 *\li 'dbargc' to be >= 1 00493 *\li 'dbargv' to point to dbargc NULL-terminated strings 00494 * 00495 * Returns: 00496 *\li #ISC_R_NOMEMORY 00497 *\li #ISC_R_SUCCESS 00498 */ 00499 00500 isc_result_t 00501 dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx); 00502 /*%< 00503 * Returns the current dbtype. isc_mem_free() should be used 00504 * to free 'argv' after use. 00505 * 00506 * Require: 00507 *\li 'zone' to be a valid zone. 00508 *\li 'argv' to be non NULL and *argv to be NULL. 00509 *\li 'mctx' to be valid. 00510 * 00511 * Returns: 00512 *\li #ISC_R_NOMEMORY 00513 *\li #ISC_R_SUCCESS 00514 */ 00515 00516 void 00517 dns_zone_markdirty(dns_zone_t *zone); 00518 /*%< 00519 * Mark a zone as 'dirty'. 00520 * 00521 * Require: 00522 *\li 'zone' to be a valid zone. 00523 */ 00524 00525 void 00526 dns_zone_expire(dns_zone_t *zone); 00527 /*%< 00528 * Mark the zone as expired. If the zone requires dumping cause it to 00529 * be initiated. Set the refresh and retry intervals to there default 00530 * values and unload the zone. 00531 * 00532 * Require 00533 *\li 'zone' to be a valid zone. 00534 */ 00535 00536 void 00537 dns_zone_refresh(dns_zone_t *zone); 00538 /*%< 00539 * Initiate zone up to date checks. The zone must already be being 00540 * managed. 00541 * 00542 * Require 00543 *\li 'zone' to be a valid zone. 00544 */ 00545 00546 isc_result_t 00547 dns_zone_flush(dns_zone_t *zone); 00548 /*%< 00549 * Write the zone to database if there are uncommitted changes. 00550 * 00551 * Require: 00552 *\li 'zone' to be a valid zone. 00553 */ 00554 00555 isc_result_t 00556 dns_zone_dump(dns_zone_t *zone); 00557 /*%< 00558 * Write the zone to database. 00559 * 00560 * Require: 00561 *\li 'zone' to be a valid zone. 00562 */ 00563 00564 isc_result_t 00565 dns_zone_dumptostream(dns_zone_t *zone, FILE *fd); 00566 00567 isc_result_t 00568 dns_zone_dumptostream2(dns_zone_t *zone, FILE *fd, dns_masterformat_t format, 00569 const dns_master_style_t *style); 00570 isc_result_t 00571 dns_zone_dumptostream3(dns_zone_t *zone, FILE *fd, dns_masterformat_t format, 00572 const dns_master_style_t *style, 00573 const isc_uint32_t rawversion); 00574 /*%< 00575 * Write the zone to stream 'fd' in the specified 'format'. 00576 * If the 'format' is dns_masterformat_text (RFC1035), 'style' also 00577 * specifies the file style (e.g., &dns_master_style_default). 00578 * 00579 * dns_zone_dumptostream() is a backward-compatible form of 00580 * dns_zone_dumptostream2(), which always uses the dns_masterformat_text 00581 * format and the dns_master_style_default style. 00582 * 00583 * dns_zone_dumptostream2() is a backward-compatible form of 00584 * dns_zone_dumptostream3(), which always uses the current 00585 * default raw file format version. 00586 * 00587 * Note that dns_zone_dumptostream3() is the most flexible form. It 00588 * can also provide the functionality of dns_zone_fulldumptostream(). 00589 * 00590 * Require: 00591 *\li 'zone' to be a valid zone. 00592 *\li 'fd' to be a stream open for writing. 00593 */ 00594 00595 isc_result_t 00596 dns_zone_fulldumptostream(dns_zone_t *zone, FILE *fd); 00597 /*%< 00598 * The same as dns_zone_dumptostream, but dumps the zone with 00599 * different dump settings (dns_master_style_full). 00600 * 00601 * Require: 00602 *\li 'zone' to be a valid zone. 00603 *\li 'fd' to be a stream open for writing. 00604 */ 00605 00606 void 00607 dns_zone_maintenance(dns_zone_t *zone); 00608 /*%< 00609 * Perform regular maintenance on the zone. This is called as a 00610 * result of a zone being managed. 00611 * 00612 * Require 00613 *\li 'zone' to be a valid zone. 00614 */ 00615 00616 isc_result_t 00617 dns_zone_setmasters(dns_zone_t *zone, const isc_sockaddr_t *masters, 00618 isc_uint32_t count); 00619 isc_result_t 00620 dns_zone_setmasterswithkeys(dns_zone_t *zone, 00621 const isc_sockaddr_t *masters, 00622 dns_name_t **keynames, 00623 isc_uint32_t count); 00624 /*%< 00625 * Set the list of master servers for the zone. 00626 * 00627 * Require: 00628 *\li 'zone' to be a valid zone. 00629 *\li 'masters' array of isc_sockaddr_t with port set or NULL. 00630 *\li 'count' the number of masters. 00631 *\li 'keynames' array of dns_name_t's for tsig keys or NULL. 00632 * 00633 * \li dns_zone_setmasters() is just a wrapper to setmasterswithkeys(), 00634 * passing NULL in the keynames field. 00635 * 00636 * \li If 'masters' is NULL then 'count' must be zero. 00637 * 00638 * Returns: 00639 *\li #ISC_R_SUCCESS 00640 *\li #ISC_R_NOMEMORY 00641 *\li Any result dns_name_dup() can return, if keynames!=NULL 00642 */ 00643 00644 isc_result_t 00645 dns_zone_setalsonotify(dns_zone_t *zone, const isc_sockaddr_t *notify, 00646 isc_uint32_t count); 00647 isc_result_t 00648 dns_zone_setalsonotifywithkeys(dns_zone_t *zone, const isc_sockaddr_t *notify, 00649 dns_name_t **keynames, isc_uint32_t count); 00650 isc_result_t 00651 dns_zone_setalsonotifydscpkeys(dns_zone_t *zone, const isc_sockaddr_t *notify, 00652 const isc_dscp_t *dscps, dns_name_t **keynames, 00653 isc_uint32_t count); 00654 /*%< 00655 * Set the list of additional servers to be notified when 00656 * a zone changes. To clear the list use 'count = 0'. 00657 * 00658 * dns_zone_alsonotifywithkeys() allows each notify address to 00659 * be associated with a TSIG key. 00660 * 00661 * Require: 00662 *\li 'zone' to be a valid zone. 00663 *\li 'notify' to be non-NULL if count != 0. 00664 *\li 'count' to be the number of notifiees. 00665 * 00666 * Returns: 00667 *\li #ISC_R_SUCCESS 00668 *\li #ISC_R_NOMEMORY 00669 */ 00670 00671 void 00672 dns_zone_unload(dns_zone_t *zone); 00673 /*%< 00674 * detach the database from the zone structure. 00675 * 00676 * Require: 00677 *\li 'zone' to be a valid zone. 00678 */ 00679 00680 void 00681 dns_zone_setoption(dns_zone_t *zone, unsigned int option, 00682 isc_boolean_t value); 00683 void 00684 dns_zone_setoption2(dns_zone_t *zone, unsigned int option, 00685 isc_boolean_t value); 00686 /*%< 00687 * Set the given options on ('value' == ISC_TRUE) or off 00688 * ('value' == #ISC_FALSE). 00689 * 00690 * dns_zone_setoption2() has been introduced because the number 00691 * of options needed now exceeds the 32 bits in the zone->options 00692 * field; it should be used set options with names beginning 00693 * with DNS_ZONEOPT2_. 00694 * 00695 * Require: 00696 *\li 'zone' to be a valid zone. 00697 */ 00698 00699 unsigned int 00700 dns_zone_getoptions(dns_zone_t *zone); 00701 unsigned int 00702 dns_zone_getoptions2(dns_zone_t *zone); 00703 /*%< 00704 * Returns the current zone options. 00705 * 00706 * Callers should be aware there is now more than one set of zone 00707 * options. dns_zone_getoptions2() has been introduced because the 00708 * number of options needed now exceeds the 32 bits in the 00709 * zone->options field. It returns the options whose names begin 00710 * with DNS_ZONEOPT2_. 00711 * 00712 * Require: 00713 *\li 'zone' to be a valid zone. 00714 */ 00715 00716 void 00717 dns_zone_setkeyopt(dns_zone_t *zone, unsigned int option, isc_boolean_t value); 00718 /*%< 00719 * Set key options on ('value' == ISC_TRUE) or off ('value' == 00720 * #ISC_FALSE). 00721 * 00722 * Require: 00723 *\li 'zone' to be a valid zone. 00724 */ 00725 00726 unsigned int 00727 dns_zone_getkeyopts(dns_zone_t *zone); 00728 /*%< 00729 * Returns the current zone key options. 00730 * 00731 * Require: 00732 *\li 'zone' to be a valid zone. 00733 */ 00734 00735 void 00736 dns_zone_setminrefreshtime(dns_zone_t *zone, isc_uint32_t val); 00737 /*%< 00738 * Set the minimum refresh time. 00739 * 00740 * Requires: 00741 *\li 'zone' is valid. 00742 *\li val > 0. 00743 */ 00744 00745 void 00746 dns_zone_setmaxrefreshtime(dns_zone_t *zone, isc_uint32_t val); 00747 /*%< 00748 * Set the maximum refresh time. 00749 * 00750 * Requires: 00751 *\li 'zone' is valid. 00752 *\li val > 0. 00753 */ 00754 00755 void 00756 dns_zone_setminretrytime(dns_zone_t *zone, isc_uint32_t val); 00757 /*%< 00758 * Set the minimum retry time. 00759 * 00760 * Requires: 00761 *\li 'zone' is valid. 00762 *\li val > 0. 00763 */ 00764 00765 void 00766 dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val); 00767 /*%< 00768 * Set the maximum retry time. 00769 * 00770 * Requires: 00771 *\li 'zone' is valid. 00772 * val > 0. 00773 */ 00774 00775 isc_result_t 00776 dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); 00777 isc_result_t 00778 dns_zone_setaltxfrsource4(dns_zone_t *zone, 00779 const isc_sockaddr_t *xfrsource); 00780 /*%< 00781 * Set the source address to be used in IPv4 zone transfers. 00782 * 00783 * Require: 00784 *\li 'zone' to be a valid zone. 00785 *\li 'xfrsource' to contain the address. 00786 * 00787 * Returns: 00788 *\li #ISC_R_SUCCESS 00789 */ 00790 00791 isc_sockaddr_t * 00792 dns_zone_getxfrsource4(dns_zone_t *zone); 00793 isc_sockaddr_t * 00794 dns_zone_getaltxfrsource4(dns_zone_t *zone); 00795 /*%< 00796 * Returns the source address set by a previous dns_zone_setxfrsource4 00797 * call, or the default of inaddr_any, port 0. 00798 * 00799 * Require: 00800 *\li 'zone' to be a valid zone. 00801 */ 00802 00803 isc_result_t 00804 dns_zone_setxfrsource4dscp(dns_zone_t *zone, isc_dscp_t dscp); 00805 isc_result_t 00806 dns_zone_setaltxfrsource4dscp(dns_zone_t *zone, isc_dscp_t dscp); 00807 /*%< 00808 * Set the DSCP value associated with the transfer/alt-transfer source. 00809 * 00810 * Require: 00811 *\li 'zone' to be a valid zone. 00812 * 00813 * Returns: 00814 *\li #ISC_R_SUCCESS 00815 */ 00816 00817 isc_dscp_t 00818 dns_zone_getxfrsource4dscp(dns_zone_t *zone); 00819 isc_dscp_t 00820 dns_zone_getaltxfrsource4dscp(dns_zone_t *zone); 00821 /*%/ 00822 * Get the DSCP value associated with the transfer/alt-transfer source. 00823 * 00824 * Require: 00825 *\li 'zone' to be a valid zone. 00826 */ 00827 00828 00829 isc_result_t 00830 dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); 00831 isc_result_t 00832 dns_zone_setaltxfrsource6(dns_zone_t *zone, 00833 const isc_sockaddr_t *xfrsource); 00834 /*%< 00835 * Set the source address to be used in IPv6 zone transfers. 00836 * 00837 * Require: 00838 *\li 'zone' to be a valid zone. 00839 *\li 'xfrsource' to contain the address. 00840 * 00841 * Returns: 00842 *\li #ISC_R_SUCCESS 00843 */ 00844 00845 isc_sockaddr_t * 00846 dns_zone_getxfrsource6(dns_zone_t *zone); 00847 isc_sockaddr_t * 00848 dns_zone_getaltxfrsource6(dns_zone_t *zone); 00849 /*%< 00850 * Returns the source address set by a previous dns_zone_setxfrsource6 00851 * call, or the default of in6addr_any, port 0. 00852 * 00853 * Require: 00854 *\li 'zone' to be a valid zone. 00855 */ 00856 00857 isc_dscp_t 00858 dns_zone_getxfrsource6dscp(dns_zone_t *zone); 00859 isc_dscp_t 00860 dns_zone_getaltxfrsource6dscp(dns_zone_t *zone); 00861 /*%/ 00862 * Get the DSCP value associated with the transfer/alt-transfer source. 00863 * 00864 * Require: 00865 *\li 'zone' to be a valid zone. 00866 */ 00867 00868 isc_result_t 00869 dns_zone_setxfrsource6dscp(dns_zone_t *zone, isc_dscp_t dscp); 00870 isc_result_t 00871 dns_zone_setaltxfrsource6dscp(dns_zone_t *zone, isc_dscp_t dscp); 00872 /*%< 00873 * Set the DSCP value associated with the transfer/alt-transfer source. 00874 * 00875 * Require: 00876 *\li 'zone' to be a valid zone. 00877 * 00878 * Returns: 00879 *\li #ISC_R_SUCCESS 00880 */ 00881 00882 isc_result_t 00883 dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc); 00884 /*%< 00885 * Set the source address to be used with IPv4 NOTIFY messages. 00886 * 00887 * Require: 00888 *\li 'zone' to be a valid zone. 00889 *\li 'notifysrc' to contain the address. 00890 * 00891 * Returns: 00892 *\li #ISC_R_SUCCESS 00893 */ 00894 00895 isc_sockaddr_t * 00896 dns_zone_getnotifysrc4(dns_zone_t *zone); 00897 /*%< 00898 * Returns the source address set by a previous dns_zone_setnotifysrc4 00899 * call, or the default of inaddr_any, port 0. 00900 * 00901 * Require: 00902 *\li 'zone' to be a valid zone. 00903 */ 00904 00905 isc_dscp_t 00906 dns_zone_getnotifysrc4dscp(dns_zone_t *zone); 00907 /*%/ 00908 * Get the DCSP value associated with the notify source. 00909 * 00910 * Require: 00911 *\li 'zone' to be a valid zone. 00912 */ 00913 00914 isc_result_t 00915 dns_zone_setnotifysrc4dscp(dns_zone_t *zone, isc_dscp_t dscp); 00916 /*%< 00917 * Set the DSCP value associated with the notify source. 00918 * 00919 * Require: 00920 *\li 'zone' to be a valid zone. 00921 * 00922 * Returns: 00923 *\li #ISC_R_SUCCESS 00924 */ 00925 00926 isc_dscp_t 00927 dns_zone_getnotifysrc4dscp(dns_zone_t *zone); 00928 /*%/ 00929 * Get the DSCP value associated with the notify source. 00930 * 00931 * Require: 00932 *\li 'zone' to be a valid zone. 00933 */ 00934 00935 isc_result_t 00936 dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc); 00937 /*%< 00938 * Set the source address to be used with IPv6 NOTIFY messages. 00939 * 00940 * Require: 00941 *\li 'zone' to be a valid zone. 00942 *\li 'notifysrc' to contain the address. 00943 * 00944 * Returns: 00945 *\li #ISC_R_SUCCESS 00946 */ 00947 00948 isc_sockaddr_t * 00949 dns_zone_getnotifysrc6(dns_zone_t *zone); 00950 /*%< 00951 * Returns the source address set by a previous dns_zone_setnotifysrc6 00952 * call, or the default of in6addr_any, port 0. 00953 * 00954 * Require: 00955 *\li 'zone' to be a valid zone. 00956 */ 00957 00958 isc_dscp_t 00959 dns_zone_getnotifysrc6dscp(dns_zone_t *zone); 00960 /*%/ 00961 * Get the DCSP value associated with the notify source. 00962 * 00963 * Require: 00964 *\li 'zone' to be a valid zone. 00965 */ 00966 00967 isc_result_t 00968 dns_zone_setnotifysrc6dscp(dns_zone_t *zone, isc_dscp_t dscp); 00969 /*%< 00970 * Set the DSCP value associated with the notify source. 00971 * 00972 * Require: 00973 *\li 'zone' to be a valid zone. 00974 * 00975 * Returns: 00976 *\li #ISC_R_SUCCESS 00977 */ 00978 00979 isc_dscp_t 00980 dns_zone_getnotifysrc6dscp(dns_zone_t *zone); 00981 /*%/ 00982 * Get the DSCP value associated with the notify source. 00983 * 00984 * Require: 00985 *\li 'zone' to be a valid zone. 00986 */ 00987 00988 void 00989 dns_zone_setnotifyacl(dns_zone_t *zone, dns_acl_t *acl); 00990 /*%< 00991 * Sets the notify acl list for the zone. 00992 * 00993 * Require: 00994 *\li 'zone' to be a valid zone. 00995 *\li 'acl' to be a valid acl. 00996 */ 00997 00998 void 00999 dns_zone_setqueryacl(dns_zone_t *zone, dns_acl_t *acl); 01000 /*%< 01001 * Sets the query acl list for the zone. 01002 * 01003 * Require: 01004 *\li 'zone' to be a valid zone. 01005 *\li 'acl' to be a valid acl. 01006 */ 01007 01008 void 01009 dns_zone_setqueryonacl(dns_zone_t *zone, dns_acl_t *acl); 01010 /*%< 01011 * Sets the query-on acl list for the zone. 01012 * 01013 * Require: 01014 *\li 'zone' to be a valid zone. 01015 *\li 'acl' to be a valid acl. 01016 */ 01017 01018 void 01019 dns_zone_setupdateacl(dns_zone_t *zone, dns_acl_t *acl); 01020 /*%< 01021 * Sets the update acl list for the zone. 01022 * 01023 * Require: 01024 *\li 'zone' to be a valid zone. 01025 *\li 'acl' to be valid acl. 01026 */ 01027 01028 void 01029 dns_zone_setforwardacl(dns_zone_t *zone, dns_acl_t *acl); 01030 /*%< 01031 * Sets the forward unsigned updates acl list for the zone. 01032 * 01033 * Require: 01034 *\li 'zone' to be a valid zone. 01035 *\li 'acl' to be valid acl. 01036 */ 01037 01038 void 01039 dns_zone_setxfracl(dns_zone_t *zone, dns_acl_t *acl); 01040 /*%< 01041 * Sets the transfer acl list for the zone. 01042 * 01043 * Require: 01044 *\li 'zone' to be a valid zone. 01045 *\li 'acl' to be valid acl. 01046 */ 01047 01048 dns_acl_t * 01049 dns_zone_getnotifyacl(dns_zone_t *zone); 01050 /*%< 01051 * Returns the current notify acl or NULL. 01052 * 01053 * Require: 01054 *\li 'zone' to be a valid zone. 01055 * 01056 * Returns: 01057 *\li acl a pointer to the acl. 01058 *\li NULL 01059 */ 01060 01061 dns_acl_t * 01062 dns_zone_getqueryacl(dns_zone_t *zone); 01063 /*%< 01064 * Returns the current query acl or NULL. 01065 * 01066 * Require: 01067 *\li 'zone' to be a valid zone. 01068 * 01069 * Returns: 01070 *\li acl a pointer to the acl. 01071 *\li NULL 01072 */ 01073 01074 dns_acl_t * 01075 dns_zone_getqueryonacl(dns_zone_t *zone); 01076 /*%< 01077 * Returns the current query-on acl or NULL. 01078 * 01079 * Require: 01080 *\li 'zone' to be a valid zone. 01081 * 01082 * Returns: 01083 *\li acl a pointer to the acl. 01084 *\li NULL 01085 */ 01086 01087 dns_acl_t * 01088 dns_zone_getupdateacl(dns_zone_t *zone); 01089 /*%< 01090 * Returns the current update acl or NULL. 01091 * 01092 * Require: 01093 *\li 'zone' to be a valid zone. 01094 * 01095 * Returns: 01096 *\li acl a pointer to the acl. 01097 *\li NULL 01098 */ 01099 01100 dns_acl_t * 01101 dns_zone_getforwardacl(dns_zone_t *zone); 01102 /*%< 01103 * Returns the current forward unsigned updates acl or NULL. 01104 * 01105 * Require: 01106 *\li 'zone' to be a valid zone. 01107 * 01108 * Returns: 01109 *\li acl a pointer to the acl. 01110 *\li NULL 01111 */ 01112 01113 dns_acl_t * 01114 dns_zone_getxfracl(dns_zone_t *zone); 01115 /*%< 01116 * Returns the current transfer acl or NULL. 01117 * 01118 * Require: 01119 *\li 'zone' to be a valid zone. 01120 * 01121 * Returns: 01122 *\li acl a pointer to the acl. 01123 *\li NULL 01124 */ 01125 01126 void 01127 dns_zone_clearupdateacl(dns_zone_t *zone); 01128 /*%< 01129 * Clear the current update acl. 01130 * 01131 * Require: 01132 *\li 'zone' to be a valid zone. 01133 */ 01134 01135 void 01136 dns_zone_clearforwardacl(dns_zone_t *zone); 01137 /*%< 01138 * Clear the current forward unsigned updates acl. 01139 * 01140 * Require: 01141 *\li 'zone' to be a valid zone. 01142 */ 01143 01144 void 01145 dns_zone_clearnotifyacl(dns_zone_t *zone); 01146 /*%< 01147 * Clear the current notify acl. 01148 * 01149 * Require: 01150 *\li 'zone' to be a valid zone. 01151 */ 01152 01153 void 01154 dns_zone_clearqueryacl(dns_zone_t *zone); 01155 /*%< 01156 * Clear the current query acl. 01157 * 01158 * Require: 01159 *\li 'zone' to be a valid zone. 01160 */ 01161 01162 void 01163 dns_zone_clearqueryonacl(dns_zone_t *zone); 01164 /*%< 01165 * Clear the current query-on acl. 01166 * 01167 * Require: 01168 *\li 'zone' to be a valid zone. 01169 */ 01170 01171 void 01172 dns_zone_clearxfracl(dns_zone_t *zone); 01173 /*%< 01174 * Clear the current transfer acl. 01175 * 01176 * Require: 01177 *\li 'zone' to be a valid zone. 01178 */ 01179 01180 isc_boolean_t 01181 dns_zone_getupdatedisabled(dns_zone_t *zone); 01182 /*%< 01183 * Return update disabled. 01184 * Transient unless called when running in isc_task_exclusive() mode. 01185 */ 01186 01187 void 01188 dns_zone_setupdatedisabled(dns_zone_t *zone, isc_boolean_t state); 01189 /*%< 01190 * Set update disabled. 01191 * Should only be called only when running in isc_task_exclusive() mode. 01192 * Failure to do so may result in updates being committed after the 01193 * call has been made. 01194 */ 01195 01196 isc_boolean_t 01197 dns_zone_getzeronosoattl(dns_zone_t *zone); 01198 /*%< 01199 * Return zero-no-soa-ttl status. 01200 */ 01201 01202 void 01203 dns_zone_setzeronosoattl(dns_zone_t *zone, isc_boolean_t state); 01204 /*%< 01205 * Set zero-no-soa-ttl status. 01206 */ 01207 01208 void 01209 dns_zone_setchecknames(dns_zone_t *zone, dns_severity_t severity); 01210 /*%< 01211 * Set the severity of name checking when loading a zone. 01212 * 01213 * Require: 01214 * \li 'zone' to be a valid zone. 01215 */ 01216 01217 dns_severity_t 01218 dns_zone_getchecknames(dns_zone_t *zone); 01219 /*%< 01220 * Return the current severity of name checking. 01221 * 01222 * Require: 01223 *\li 'zone' to be a valid zone. 01224 */ 01225 01226 void 01227 dns_zone_setjournalsize(dns_zone_t *zone, isc_int32_t size); 01228 /*%< 01229 * Sets the journal size for the zone. 01230 * 01231 * Requires: 01232 *\li 'zone' to be a valid zone. 01233 */ 01234 01235 isc_int32_t 01236 dns_zone_getjournalsize(dns_zone_t *zone); 01237 /*%< 01238 * Return the journal size as set with a previous call to 01239 * dns_zone_setjournalsize(). 01240 * 01241 * Requires: 01242 *\li 'zone' to be a valid zone. 01243 */ 01244 01245 isc_result_t 01246 dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from, 01247 dns_message_t *msg); 01248 /*%< 01249 * Tell the zone that it has received a NOTIFY message from another 01250 * server. This may cause some zone maintenance activity to occur. 01251 * 01252 * Requires: 01253 *\li 'zone' to be a valid zone. 01254 *\li '*from' to contain the address of the server from which 'msg' 01255 * was received. 01256 *\li 'msg' a message with opcode NOTIFY and qr clear. 01257 * 01258 * Returns: 01259 *\li DNS_R_REFUSED 01260 *\li DNS_R_NOTIMP 01261 *\li DNS_R_FORMERR 01262 *\li DNS_R_SUCCESS 01263 */ 01264 01265 void 01266 dns_zone_setmaxxfrin(dns_zone_t *zone, isc_uint32_t maxxfrin); 01267 /*%< 01268 * Set the maximum time (in seconds) that a zone transfer in (AXFR/IXFR) 01269 * of this zone will use before being aborted. 01270 * 01271 * Requires: 01272 * \li 'zone' to be valid initialised zone. 01273 */ 01274 01275 isc_uint32_t 01276 dns_zone_getmaxxfrin(dns_zone_t *zone); 01277 /*%< 01278 * Returns the maximum transfer time for this zone. This will be 01279 * either the value set by the last call to dns_zone_setmaxxfrin() or 01280 * the default value of 1 hour. 01281 * 01282 * Requires: 01283 *\li 'zone' to be valid initialised zone. 01284 */ 01285 01286 void 01287 dns_zone_setmaxxfrout(dns_zone_t *zone, isc_uint32_t maxxfrout); 01288 /*%< 01289 * Set the maximum time (in seconds) that a zone transfer out (AXFR/IXFR) 01290 * of this zone will use before being aborted. 01291 * 01292 * Requires: 01293 * \li 'zone' to be valid initialised zone. 01294 */ 01295 01296 isc_uint32_t 01297 dns_zone_getmaxxfrout(dns_zone_t *zone); 01298 /*%< 01299 * Returns the maximum transfer time for this zone. This will be 01300 * either the value set by the last call to dns_zone_setmaxxfrout() or 01301 * the default value of 1 hour. 01302 * 01303 * Requires: 01304 *\li 'zone' to be valid initialised zone. 01305 */ 01306 01307 isc_result_t 01308 dns_zone_setjournal(dns_zone_t *zone, const char *myjournal); 01309 /*%< 01310 * Sets the filename used for journaling updates / IXFR transfers. 01311 * The default journal name is set by dns_zone_setfile() to be 01312 * "file.jnl". If 'myjournal' is NULL, the zone will have no 01313 * journal name. 01314 * 01315 * Requires: 01316 *\li 'zone' to be a valid zone. 01317 * 01318 * Returns: 01319 *\li #ISC_R_SUCCESS 01320 *\li #ISC_R_NOMEMORY 01321 */ 01322 01323 char * 01324 dns_zone_getjournal(dns_zone_t *zone); 01325 /*%< 01326 * Returns the journal name associated with this zone. 01327 * If no journal has been set this will be NULL. 01328 * 01329 * Requires: 01330 *\li 'zone' to be valid initialised zone. 01331 */ 01332 01333 dns_zonetype_t 01334 dns_zone_gettype(dns_zone_t *zone); 01335 /*%< 01336 * Returns the type of the zone (master/slave/etc.) 01337 * 01338 * Requires: 01339 *\li 'zone' to be valid initialised zone. 01340 */ 01341 01342 void 01343 dns_zone_settask(dns_zone_t *zone, isc_task_t *task); 01344 /*%< 01345 * Give a zone a task to work with. Any current task will be detached. 01346 * 01347 * Requires: 01348 *\li 'zone' to be valid. 01349 *\li 'task' to be valid. 01350 */ 01351 01352 void 01353 dns_zone_gettask(dns_zone_t *zone, isc_task_t **target); 01354 /*%< 01355 * Attach '*target' to the zone's task. 01356 * 01357 * Requires: 01358 *\li 'zone' to be valid initialised zone. 01359 *\li 'zone' to have a task. 01360 *\li 'target' to be != NULL && '*target' == NULL. 01361 */ 01362 01363 void 01364 dns_zone_notify(dns_zone_t *zone); 01365 /*%< 01366 * Generate notify events for this zone. 01367 * 01368 * Requires: 01369 *\li 'zone' to be a valid zone. 01370 */ 01371 01372 isc_result_t 01373 dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump); 01374 /*%< 01375 * Replace the database of "zone" with a new database "db". 01376 * 01377 * If "dump" is ISC_TRUE, then the new zone contents are dumped 01378 * into to the zone's master file for persistence. When replacing 01379 * a zone database by one just loaded from a master file, set 01380 * "dump" to ISC_FALSE to avoid a redundant redump of the data just 01381 * loaded. Otherwise, it should be set to ISC_TRUE. 01382 * 01383 * If the "diff-on-reload" option is enabled in the configuration file, 01384 * the differences between the old and the new database are added to the 01385 * journal file, and the master file dump is postponed. 01386 * 01387 * Requires: 01388 * \li 'zone' to be a valid zone. 01389 * 01390 * Returns: 01391 * \li DNS_R_SUCCESS 01392 * \li DNS_R_BADZONE zone failed basic consistency checks: 01393 * * a single SOA must exist 01394 * * some NS records must exist. 01395 * Others 01396 */ 01397 01398 isc_uint32_t 01399 dns_zone_getidlein(dns_zone_t *zone); 01400 /*%< 01401 * Requires: 01402 * \li 'zone' to be a valid zone. 01403 * 01404 * Returns: 01405 * \li number of seconds of idle time before we abort the transfer in. 01406 */ 01407 01408 void 01409 dns_zone_setidlein(dns_zone_t *zone, isc_uint32_t idlein); 01410 /*%< 01411 * \li Set the idle timeout for transfer the. 01412 * \li Zero set the default value, 1 hour. 01413 * 01414 * Requires: 01415 * \li 'zone' to be a valid zone. 01416 */ 01417 01418 isc_uint32_t 01419 dns_zone_getidleout(dns_zone_t *zone); 01420 /*%< 01421 * 01422 * Requires: 01423 * \li 'zone' to be a valid zone. 01424 * 01425 * Returns: 01426 * \li number of seconds of idle time before we abort a transfer out. 01427 */ 01428 01429 void 01430 dns_zone_setidleout(dns_zone_t *zone, isc_uint32_t idleout); 01431 /*%< 01432 * \li Set the idle timeout for transfers out. 01433 * \li Zero set the default value, 1 hour. 01434 * 01435 * Requires: 01436 * \li 'zone' to be a valid zone. 01437 */ 01438 01439 void 01440 dns_zone_getssutable(dns_zone_t *zone, dns_ssutable_t **table); 01441 /*%< 01442 * Get the simple-secure-update policy table. 01443 * 01444 * Requires: 01445 * \li 'zone' to be a valid zone. 01446 */ 01447 01448 void 01449 dns_zone_setssutable(dns_zone_t *zone, dns_ssutable_t *table); 01450 /*%< 01451 * Set / clear the simple-secure-update policy table. 01452 * 01453 * Requires: 01454 * \li 'zone' to be a valid zone. 01455 */ 01456 01457 isc_mem_t * 01458 dns_zone_getmctx(dns_zone_t *zone); 01459 /*%< 01460 * Get the memory context of a zone. 01461 * 01462 * Requires: 01463 * \li 'zone' to be a valid zone. 01464 */ 01465 01466 dns_zonemgr_t * 01467 dns_zone_getmgr(dns_zone_t *zone); 01468 /*%< 01469 * If 'zone' is managed return the zone manager otherwise NULL. 01470 * 01471 * Requires: 01472 * \li 'zone' to be a valid zone. 01473 */ 01474 01475 void 01476 dns_zone_setsigvalidityinterval(dns_zone_t *zone, isc_uint32_t interval); 01477 /*%< 01478 * Set the zone's RRSIG validity interval. This is the length of time 01479 * for which DNSSEC signatures created as a result of dynamic updates 01480 * to secure zones will remain valid, in seconds. 01481 * 01482 * Requires: 01483 * \li 'zone' to be a valid zone. 01484 */ 01485 01486 isc_uint32_t 01487 dns_zone_getsigvalidityinterval(dns_zone_t *zone); 01488 /*%< 01489 * Get the zone's RRSIG validity interval. 01490 * 01491 * Requires: 01492 * \li 'zone' to be a valid zone. 01493 */ 01494 01495 void 01496 dns_zone_setsigresigninginterval(dns_zone_t *zone, isc_uint32_t interval); 01497 /*%< 01498 * Set the zone's RRSIG re-signing interval. A dynamic zone's RRSIG's 01499 * will be re-signed 'interval' amount of time before they expire. 01500 * 01501 * Requires: 01502 * \li 'zone' to be a valid zone. 01503 */ 01504 01505 isc_uint32_t 01506 dns_zone_getsigresigninginterval(dns_zone_t *zone); 01507 /*%< 01508 * Get the zone's RRSIG re-signing interval. 01509 * 01510 * Requires: 01511 * \li 'zone' to be a valid zone. 01512 */ 01513 01514 void 01515 dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype); 01516 /*%< 01517 * Sets zone notify method to "notifytype" 01518 */ 01519 01520 isc_result_t 01521 dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg, 01522 dns_updatecallback_t callback, void *callback_arg); 01523 /*%< 01524 * Forward 'msg' to each master in turn until we get an answer or we 01525 * have exhausted the list of masters. 'callback' will be called with 01526 * ISC_R_SUCCESS if we get an answer and the returned message will be 01527 * passed as 'answer_message', otherwise a non ISC_R_SUCCESS result code 01528 * will be passed and answer_message will be NULL. The callback function 01529 * is responsible for destroying 'answer_message'. 01530 * (callback)(callback_arg, result, answer_message); 01531 * 01532 * Require: 01533 *\li 'zone' to be valid 01534 *\li 'msg' to be valid. 01535 *\li 'callback' to be non NULL. 01536 * Returns: 01537 *\li #ISC_R_SUCCESS if the message has been forwarded, 01538 *\li #ISC_R_NOMEMORY 01539 *\li Others 01540 */ 01541 01542 isc_result_t 01543 dns_zone_next(dns_zone_t *zone, dns_zone_t **next); 01544 /*%< 01545 * Find the next zone in the list of managed zones. 01546 * 01547 * Requires: 01548 *\li 'zone' to be valid 01549 *\li The zone manager for the indicated zone MUST be locked 01550 * by the caller. This is not checked. 01551 *\li 'next' be non-NULL, and '*next' be NULL. 01552 * 01553 * Ensures: 01554 *\li 'next' points to a valid zone (result ISC_R_SUCCESS) or to NULL 01555 * (result ISC_R_NOMORE). 01556 */ 01557 01558 01559 01560 isc_result_t 01561 dns_zone_first(dns_zonemgr_t *zmgr, dns_zone_t **first); 01562 /*%< 01563 * Find the first zone in the list of managed zones. 01564 * 01565 * Requires: 01566 *\li 'zonemgr' to be valid 01567 *\li The zone manager for the indicated zone MUST be locked 01568 * by the caller. This is not checked. 01569 *\li 'first' be non-NULL, and '*first' be NULL 01570 * 01571 * Ensures: 01572 *\li 'first' points to a valid zone (result ISC_R_SUCCESS) or to NULL 01573 * (result ISC_R_NOMORE). 01574 */ 01575 01576 isc_result_t 01577 dns_zone_setkeydirectory(dns_zone_t *zone, const char *directory); 01578 /*%< 01579 * Sets the name of the directory where private keys used for 01580 * online signing of dynamic zones are found. 01581 * 01582 * Require: 01583 *\li 'zone' to be a valid zone. 01584 * 01585 * Returns: 01586 *\li #ISC_R_NOMEMORY 01587 *\li #ISC_R_SUCCESS 01588 */ 01589 01590 const char * 01591 dns_zone_getkeydirectory(dns_zone_t *zone); 01592 /*%< 01593 * Gets the name of the directory where private keys used for 01594 * online signing of dynamic zones are found. 01595 * 01596 * Requires: 01597 *\li 'zone' to be valid initialised zone. 01598 * 01599 * Returns: 01600 * Pointer to null-terminated file name, or NULL. 01601 */ 01602 01603 01604 isc_result_t 01605 dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr, 01606 isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr, 01607 dns_zonemgr_t **zmgrp); 01608 /*%< 01609 * Create a zone manager. Note: the zone manager will not be able to 01610 * manage any zones until dns_zonemgr_setsize() has been run. 01611 * 01612 * Requires: 01613 *\li 'mctx' to be a valid memory context. 01614 *\li 'taskmgr' to be a valid task manager. 01615 *\li 'timermgr' to be a valid timer manager. 01616 *\li 'zmgrp' to point to a NULL pointer. 01617 */ 01618 01619 isc_result_t 01620 dns_zonemgr_setsize(dns_zonemgr_t *zmgr, int num_zones); 01621 /*%< 01622 * Set the size of the zone manager task pool. This must be run 01623 * before zmgr can be used for managing zones. Currently, it can only 01624 * be run once; the task pool cannot be resized. 01625 * 01626 * Requires: 01627 *\li zmgr is a valid zone manager. 01628 *\li zmgr->zonetasks has been initialized. 01629 */ 01630 01631 isc_result_t 01632 dns_zonemgr_createzone(dns_zonemgr_t *zmgr, dns_zone_t **zonep); 01633 /*%< 01634 * Allocate a new zone using a memory context from the 01635 * zone manager's memory context pool. 01636 * 01637 * Require: 01638 *\li 'zmgr' to be a valid zone manager. 01639 *\li 'zonep' != NULL and '*zonep' == NULL. 01640 */ 01641 01642 01643 isc_result_t 01644 dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone); 01645 /*%< 01646 * Bring the zone under control of a zone manager. 01647 * 01648 * Require: 01649 *\li 'zmgr' to be a valid zone manager. 01650 *\li 'zone' to be a valid zone. 01651 */ 01652 01653 isc_result_t 01654 dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr); 01655 /*%< 01656 * Force zone maintenance of all zones managed by 'zmgr' at its 01657 * earliest convenience. 01658 */ 01659 01660 void 01661 dns__zonemgr_run(isc_task_t *task, isc_event_t *event); 01662 /*%< 01663 * Event handler to call dns_zonemgr_forcemaint(); used to start 01664 * zone operations from a unit test. Not intended for use outside 01665 * libdns or related tests. 01666 */ 01667 01668 void 01669 dns_zonemgr_resumexfrs(dns_zonemgr_t *zmgr); 01670 /*%< 01671 * Attempt to start any stalled zone transfers. 01672 */ 01673 01674 void 01675 dns_zonemgr_shutdown(dns_zonemgr_t *zmgr); 01676 /*%< 01677 * Shut down the zone manager. 01678 * 01679 * Requires: 01680 *\li 'zmgr' to be a valid zone manager. 01681 */ 01682 01683 void 01684 dns_zonemgr_attach(dns_zonemgr_t *source, dns_zonemgr_t **target); 01685 /*%< 01686 * Attach '*target' to 'source' incrementing its external 01687 * reference count. 01688 * 01689 * Require: 01690 *\li 'zone' to be a valid zone. 01691 *\li 'target' to be non NULL and '*target' to be NULL. 01692 */ 01693 01694 void 01695 dns_zonemgr_detach(dns_zonemgr_t **zmgrp); 01696 /*%< 01697 * Detach from a zone manager. 01698 * 01699 * Requires: 01700 *\li '*zmgrp' is a valid, non-NULL zone manager pointer. 01701 * 01702 * Ensures: 01703 *\li '*zmgrp' is NULL. 01704 */ 01705 01706 void 01707 dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone); 01708 /*%< 01709 * Release 'zone' from the managed by 'zmgr'. 'zmgr' is implicitly 01710 * detached from 'zone'. 01711 * 01712 * Requires: 01713 *\li 'zmgr' to be a valid zone manager. 01714 *\li 'zone' to be a valid zone. 01715 *\li 'zmgr' == 'zone->zmgr' 01716 * 01717 * Ensures: 01718 *\li 'zone->zmgr' == NULL; 01719 */ 01720 01721 void 01722 dns_zonemgr_settransfersin(dns_zonemgr_t *zmgr, isc_uint32_t value); 01723 /*%< 01724 * Set the maximum number of simultaneous transfers in allowed by 01725 * the zone manager. 01726 * 01727 * Requires: 01728 *\li 'zmgr' to be a valid zone manager. 01729 */ 01730 01731 isc_uint32_t 01732 dns_zonemgr_getttransfersin(dns_zonemgr_t *zmgr); 01733 /*%< 01734 * Return the maximum number of simultaneous transfers in allowed. 01735 * 01736 * Requires: 01737 *\li 'zmgr' to be a valid zone manager. 01738 */ 01739 01740 void 01741 dns_zonemgr_settransfersperns(dns_zonemgr_t *zmgr, isc_uint32_t value); 01742 /*%< 01743 * Set the number of zone transfers allowed per nameserver. 01744 * 01745 * Requires: 01746 *\li 'zmgr' to be a valid zone manager 01747 */ 01748 01749 isc_uint32_t 01750 dns_zonemgr_getttransfersperns(dns_zonemgr_t *zmgr); 01751 /*%< 01752 * Return the number of transfers allowed per nameserver. 01753 * 01754 * Requires: 01755 *\li 'zmgr' to be a valid zone manager. 01756 */ 01757 01758 void 01759 dns_zonemgr_setiolimit(dns_zonemgr_t *zmgr, isc_uint32_t iolimit); 01760 /*%< 01761 * Set the number of simultaneous file descriptors available for 01762 * reading and writing masterfiles. 01763 * 01764 * Requires: 01765 *\li 'zmgr' to be a valid zone manager. 01766 *\li 'iolimit' to be positive. 01767 */ 01768 01769 isc_uint32_t 01770 dns_zonemgr_getiolimit(dns_zonemgr_t *zmgr); 01771 /*%< 01772 * Get the number of simultaneous file descriptors available for 01773 * reading and writing masterfiles. 01774 * 01775 * Requires: 01776 *\li 'zmgr' to be a valid zone manager. 01777 */ 01778 01779 void 01780 dns_zonemgr_setnotifyrate(dns_zonemgr_t *zmgr, unsigned int value); 01781 /*%< 01782 * Set the number of NOTIFY requests sent per second. 01783 * 01784 * Requires: 01785 *\li 'zmgr' to be a valid zone manager 01786 */ 01787 01788 void 01789 dns_zonemgr_setstartupnotifyrate(dns_zonemgr_t *zmgr, unsigned int value); 01790 /*%< 01791 * Set the number of startup NOTIFY requests sent per second. 01792 * 01793 * Requires: 01794 *\li 'zmgr' to be a valid zone manager 01795 */ 01796 01797 void 01798 dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value); 01799 /*%< 01800 * Set the number of SOA queries sent per second. 01801 * 01802 * Requires: 01803 *\li 'zmgr' to be a valid zone manager 01804 */ 01805 01806 unsigned int 01807 dns_zonemgr_getnotifyrate(dns_zonemgr_t *zmgr); 01808 /*%< 01809 * Return the number of NOTIFY requests sent per second. 01810 * 01811 * Requires: 01812 *\li 'zmgr' to be a valid zone manager. 01813 */ 01814 01815 unsigned int 01816 dns_zonemgr_getstartupnotifyrate(dns_zonemgr_t *zmgr); 01817 /*%< 01818 * Return the number of startup NOTIFY requests sent per second. 01819 * 01820 * Requires: 01821 *\li 'zmgr' to be a valid zone manager. 01822 */ 01823 01824 unsigned int 01825 dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr); 01826 /*%< 01827 * Return the number of SOA queries sent per second. 01828 * 01829 * Requires: 01830 *\li 'zmgr' to be a valid zone manager. 01831 */ 01832 01833 unsigned int 01834 dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state); 01835 /*%< 01836 * Returns the number of zones in the specified state. 01837 * 01838 * Requires: 01839 *\li 'zmgr' to be a valid zone manager. 01840 *\li 'state' to be a valid DNS_ZONESTATE_ constant. 01841 */ 01842 01843 void 01844 dns_zonemgr_unreachableadd(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, 01845 isc_sockaddr_t *local, isc_time_t *now); 01846 /*%< 01847 * Add the pair of addresses to the unreachable cache. 01848 * 01849 * Requires: 01850 *\li 'zmgr' to be a valid zone manager. 01851 *\li 'remote' to be a valid sockaddr. 01852 *\li 'local' to be a valid sockaddr. 01853 */ 01854 01855 isc_boolean_t 01856 dns_zonemgr_unreachable(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, 01857 isc_sockaddr_t *local, isc_time_t *now); 01858 /*%< 01859 * Returns ISC_TRUE if the given local/remote address pair 01860 * is found in the zone maanger's unreachable cache. 01861 * 01862 * Requires: 01863 *\li 'zmgr' to be a valid zone manager. 01864 *\li 'remote' to be a valid sockaddr. 01865 *\li 'local' to be a valid sockaddr. 01866 *\li 'now' != NULL 01867 */ 01868 01869 void 01870 dns_zonemgr_unreachabledel(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, 01871 isc_sockaddr_t *local); 01872 /*%< 01873 * Remove the pair of addresses from the unreachable cache. 01874 * 01875 * Requires: 01876 *\li 'zmgr' to be a valid zone manager. 01877 *\li 'remote' to be a valid sockaddr. 01878 *\li 'local' to be a valid sockaddr. 01879 */ 01880 01881 void 01882 dns_zone_forcereload(dns_zone_t *zone); 01883 /*%< 01884 * Force a reload of specified zone. 01885 * 01886 * Requires: 01887 *\li 'zone' to be a valid zone. 01888 */ 01889 01890 isc_boolean_t 01891 dns_zone_isforced(dns_zone_t *zone); 01892 /*%< 01893 * Check if the zone is waiting a forced reload. 01894 * 01895 * Requires: 01896 * \li 'zone' to be a valid zone. 01897 */ 01898 01899 isc_result_t 01900 dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on); 01901 /*%< 01902 * This function is obsoleted by dns_zone_setrequeststats(). 01903 */ 01904 01905 isc_uint64_t * 01906 dns_zone_getstatscounters(dns_zone_t *zone); 01907 /*%< 01908 * This function is obsoleted by dns_zone_getrequeststats(). 01909 */ 01910 01911 void 01912 dns_zone_setstats(dns_zone_t *zone, isc_stats_t *stats); 01913 /*%< 01914 * Set a general zone-maintenance statistics set 'stats' for 'zone'. This 01915 * function is expected to be called only on zone creation (when necessary). 01916 * Once installed, it cannot be removed or replaced. Also, there is no 01917 * interface to get the installed stats from the zone; the caller must keep the 01918 * stats to reference (e.g. dump) it later. 01919 * 01920 * Requires: 01921 * \li 'zone' to be a valid zone and does not have a statistics set already 01922 * installed. 01923 * 01924 *\li stats is a valid statistics supporting zone statistics counters 01925 * (see dns/stats.h). 01926 */ 01927 01928 void 01929 dns_zone_setrequeststats(dns_zone_t *zone, isc_stats_t *stats); 01930 01931 void 01932 dns_zone_setrcvquerystats(dns_zone_t *zone, dns_stats_t *stats); 01933 /*%< 01934 * Set additional statistics sets to zone. These are attached to the zone 01935 * but are not counted in the zone module; only the caller updates the 01936 * counters. 01937 * 01938 * Requires: 01939 * \li 'zone' to be a valid zone. 01940 * 01941 *\li stats is a valid statistics. 01942 */ 01943 01944 isc_stats_t * 01945 dns_zone_getrequeststats(dns_zone_t *zone); 01946 01947 dns_stats_t * 01948 dns_zone_getrcvquerystats(dns_zone_t *zone); 01949 /*%< 01950 * Get the additional statistics for zone, if one is installed. 01951 * 01952 * Requires: 01953 * \li 'zone' to be a valid zone. 01954 * 01955 * Returns: 01956 * \li when available, a pointer to the statistics set installed in zone; 01957 * otherwise NULL. 01958 */ 01959 01960 void 01961 dns_zone_dialup(dns_zone_t *zone); 01962 /*%< 01963 * Perform dialup-time maintenance on 'zone'. 01964 */ 01965 01966 void 01967 dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup); 01968 /*%< 01969 * Set the dialup type of 'zone' to 'dialup'. 01970 * 01971 * Requires: 01972 * \li 'zone' to be valid initialised zone. 01973 *\li 'dialup' to be a valid dialup type. 01974 */ 01975 01976 void 01977 dns_zone_log(dns_zone_t *zone, int level, const char *msg, ...) 01978 ISC_FORMAT_PRINTF(3, 4); 01979 /*%< 01980 * Log the message 'msg...' at 'level', including text that identifies 01981 * the message as applying to 'zone'. 01982 */ 01983 01984 void 01985 dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category, int level, 01986 const char *msg, ...) ISC_FORMAT_PRINTF(4, 5); 01987 /*%< 01988 * Log the message 'msg...' at 'level', including text that identifies 01989 * the message as applying to 'zone'. 01990 */ 01991 01992 void 01993 dns_zone_name(dns_zone_t *zone, char *buf, size_t len); 01994 /*%< 01995 * Return the name of the zone with class and view. 01996 * 01997 * Requires: 01998 *\li 'zone' to be valid. 01999 *\li 'buf' to be non NULL. 02000 */ 02001 02002 isc_result_t 02003 dns_zone_checknames(dns_zone_t *zone, dns_name_t *name, dns_rdata_t *rdata); 02004 /*%< 02005 * Check if this record meets the check-names policy. 02006 * 02007 * Requires: 02008 * 'zone' to be valid. 02009 * 'name' to be valid. 02010 * 'rdata' to be valid. 02011 * 02012 * Returns: 02013 * DNS_R_SUCCESS passed checks. 02014 * DNS_R_BADOWNERNAME failed ownername checks. 02015 * DNS_R_BADNAME failed rdata checks. 02016 */ 02017 02018 void 02019 dns_zone_setacache(dns_zone_t *zone, dns_acache_t *acache); 02020 /*%< 02021 * Associate the zone with an additional cache. 02022 * 02023 * Require: 02024 * 'zone' to be a valid zone. 02025 * 'acache' to be a non NULL pointer. 02026 * 02027 * Ensures: 02028 * 'zone' will have a reference to 'acache' 02029 */ 02030 02031 void 02032 dns_zone_setcheckmx(dns_zone_t *zone, dns_checkmxfunc_t checkmx); 02033 /*%< 02034 * Set the post load integrity callback function 'checkmx'. 02035 * 'checkmx' will be called if the MX TARGET is not within the zone. 02036 * 02037 * Require: 02038 * 'zone' to be a valid zone. 02039 */ 02040 02041 void 02042 dns_zone_setchecksrv(dns_zone_t *zone, dns_checkmxfunc_t checksrv); 02043 /*%< 02044 * Set the post load integrity callback function 'checksrv'. 02045 * 'checksrv' will be called if the SRV TARGET is not within the zone. 02046 * 02047 * Require: 02048 * 'zone' to be a valid zone. 02049 */ 02050 02051 void 02052 dns_zone_setcheckns(dns_zone_t *zone, dns_checknsfunc_t checkns); 02053 /*%< 02054 * Set the post load integrity callback function 'checkns'. 02055 * 'checkns' will be called if the NS TARGET is not within the zone. 02056 * 02057 * Require: 02058 * 'zone' to be a valid zone. 02059 */ 02060 02061 void 02062 dns_zone_setnotifydelay(dns_zone_t *zone, isc_uint32_t delay); 02063 /*%< 02064 * Set the minimum delay between sets of notify messages. 02065 * 02066 * Requires: 02067 * 'zone' to be valid. 02068 */ 02069 02070 isc_uint32_t 02071 dns_zone_getnotifydelay(dns_zone_t *zone); 02072 /*%< 02073 * Get the minimum delay between sets of notify messages. 02074 * 02075 * Requires: 02076 * 'zone' to be valid. 02077 */ 02078 02079 void 02080 dns_zone_setisself(dns_zone_t *zone, dns_isselffunc_t isself, void *arg); 02081 /*%< 02082 * Set the isself callback function and argument. 02083 * 02084 * isc_boolean_t 02085 * isself(dns_view_t *myview, dns_tsigkey_t *mykey, isc_netaddr_t *srcaddr, 02086 * isc_netaddr_t *destaddr, dns_rdataclass_t rdclass, void *arg); 02087 * 02088 * 'isself' returns ISC_TRUE if a non-recursive query from 'srcaddr' to 02089 * 'destaddr' with optional key 'mykey' for class 'rdclass' would be 02090 * delivered to 'myview'. 02091 */ 02092 02093 void 02094 dns_zone_setnodes(dns_zone_t *zone, isc_uint32_t nodes); 02095 /*%< 02096 * Set the number of nodes that will be checked per quantum. 02097 */ 02098 02099 void 02100 dns_zone_setsignatures(dns_zone_t *zone, isc_uint32_t signatures); 02101 /*%< 02102 * Set the number of signatures that will be generated per quantum. 02103 */ 02104 02105 isc_uint32_t 02106 dns_zone_getsignatures(dns_zone_t *zone); 02107 /*%< 02108 * Get the number of signatures that will be generated per quantum. 02109 */ 02110 02111 isc_result_t 02112 dns_zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, 02113 isc_uint16_t keyid, isc_boolean_t deleteit); 02114 /*%< 02115 * Initiate/resume signing of the entire zone with the zone DNSKEY(s) 02116 * that match the given algorithm and keyid. 02117 */ 02118 02119 isc_result_t 02120 dns_zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param); 02121 /*%< 02122 * Incrementally add a NSEC3 chain that corresponds to 'nsec3param'. 02123 */ 02124 02125 void 02126 dns_zone_setprivatetype(dns_zone_t *zone, dns_rdatatype_t type); 02127 dns_rdatatype_t 02128 dns_zone_getprivatetype(dns_zone_t *zone); 02129 /* 02130 * Get/Set the private record type. It is expected that these interfaces 02131 * will not be permanent. 02132 */ 02133 02134 void 02135 dns_zone_rekey(dns_zone_t *zone, isc_boolean_t fullsign); 02136 /*%< 02137 * Update the zone's DNSKEY set from the key repository. 02138 * 02139 * If 'fullsign' is true, trigger an immediate full signing of 02140 * the zone with the new key. Otherwise, if there are no keys or 02141 * if the new keys are for algorithms that have already signed the 02142 * zone, then the zone can be re-signed incrementally. 02143 */ 02144 02145 isc_result_t 02146 dns_zone_nscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, 02147 unsigned int *errors); 02148 /*% 02149 * Check if the name servers for the zone are sane (have address, don't 02150 * refer to CNAMEs/DNAMEs. The number of constiancy errors detected in 02151 * returned in '*errors' 02152 * 02153 * Requires: 02154 * \li 'zone' to be valid. 02155 * \li 'db' to be valid. 02156 * \li 'version' to be valid or NULL. 02157 * \li 'errors' to be non NULL. 02158 * 02159 * Returns: 02160 * ISC_R_SUCCESS if there were no errors examining the zone contents. 02161 */ 02162 02163 void 02164 dns_zone_setadded(dns_zone_t *zone, isc_boolean_t added); 02165 /*% 02166 * Sets the value of zone->added, which should be ISC_TRUE for 02167 * zones that were originally added by "rndc addzone". 02168 * 02169 * Requires: 02170 * \li 'zone' to be valid. 02171 */ 02172 02173 isc_boolean_t 02174 dns_zone_getadded(dns_zone_t *zone); 02175 /*% 02176 * Returns ISC_TRUE if the zone was originally added at runtime 02177 * using "rndc addzone". 02178 * 02179 * Requires: 02180 * \li 'zone' to be valid. 02181 */ 02182 02183 void 02184 dns_zone_setautomatic(dns_zone_t *zone, isc_boolean_t automatic); 02185 /*% 02186 * Sets the value of zone->automatic, which should be ISC_TRUE for 02187 * zones that were automatically added by named. 02188 * 02189 * Requires: 02190 * \li 'zone' to be valid. 02191 */ 02192 02193 isc_boolean_t 02194 dns_zone_getautomatic(dns_zone_t *zone); 02195 /*% 02196 * Returns ISC_TRUE if the zone was added automatically by named. 02197 * 02198 * Requires: 02199 * \li 'zone' to be valid. 02200 */ 02201 02202 isc_result_t 02203 dns_zone_dlzpostload(dns_zone_t *zone, dns_db_t *db); 02204 /*% 02205 * Load the origin names for a writeable DLZ database. 02206 */ 02207 02208 isc_boolean_t 02209 dns_zone_isdynamic(dns_zone_t *zone, isc_boolean_t ignore_freeze); 02210 /*% 02211 * Return true iff the zone is "dynamic", in the sense that the zone's 02212 * master file (if any) is written by the server, rather than being 02213 * updated manually and read by the server. 02214 * 02215 * This is true for slave zones, stub zones, key zones, and zones that 02216 * allow dynamic updates either by having an update policy ("ssutable") 02217 * or an "allow-update" ACL with a value other than exactly "{ none; }". 02218 * 02219 * If 'ignore_freeze' is true, then the zone which has had updates disabled 02220 * will still report itself to be dynamic. 02221 * 02222 * Requires: 02223 * \li 'zone' to be valid. 02224 */ 02225 02226 isc_result_t 02227 dns_zone_setrefreshkeyinterval(dns_zone_t *zone, isc_uint32_t interval); 02228 /*% 02229 * Sets the frequency, in minutes, with which the key repository will be 02230 * checked to see if the keys for this zone have been updated. Any value 02231 * higher than 1440 minutes (24 hours) will be silently reduced. A 02232 * value of zero will return an out-of-range error. 02233 * 02234 * Requires: 02235 * \li 'zone' to be valid. 02236 */ 02237 02238 isc_boolean_t 02239 dns_zone_getrequestexpire(dns_zone_t *zone); 02240 /*% 02241 * Returns the true/false value of the request-expire option in the zone. 02242 * 02243 * Requires: 02244 * \li 'zone' to be valid. 02245 */ 02246 02247 void 02248 dns_zone_setrequestexpire(dns_zone_t *zone, isc_boolean_t flag); 02249 /*% 02250 * Sets the request-expire option for the zone. Either true or false. The 02251 * default value is determined by the setting of this option in the view. 02252 * 02253 * Requires: 02254 * \li 'zone' to be valid. 02255 */ 02256 02257 02258 isc_boolean_t 02259 dns_zone_getrequestixfr(dns_zone_t *zone); 02260 /*% 02261 * Returns the true/false value of the request-ixfr option in the zone. 02262 * 02263 * Requires: 02264 * \li 'zone' to be valid. 02265 */ 02266 02267 void 02268 dns_zone_setrequestixfr(dns_zone_t *zone, isc_boolean_t flag); 02269 /*% 02270 * Sets the request-ixfr option for the zone. Either true or false. The 02271 * default value is determined by the setting of this option in the view. 02272 * 02273 * Requires: 02274 * \li 'zone' to be valid. 02275 */ 02276 02277 void 02278 dns_zone_setserialupdatemethod(dns_zone_t *zone, dns_updatemethod_t method); 02279 /*% 02280 * Sets the update method to use when incrementing the zone serial number 02281 * due to a DDNS update. Valid options are dns_updatemethod_increment 02282 * and dns_updatemethod_unixtime. 02283 * 02284 * Requires: 02285 * \li 'zone' to be valid. 02286 */ 02287 02288 dns_updatemethod_t 02289 dns_zone_getserialupdatemethod(dns_zone_t *zone); 02290 /*% 02291 * Returns the update method to be used when incrementing the zone serial 02292 * number due to a DDNS update. 02293 * 02294 * Requires: 02295 * \li 'zone' to be valid. 02296 */ 02297 02298 isc_result_t 02299 dns_zone_link(dns_zone_t *zone, dns_zone_t *raw); 02300 02301 void 02302 dns_zone_getraw(dns_zone_t *zone, dns_zone_t **raw); 02303 02304 isc_result_t 02305 dns_zone_keydone(dns_zone_t *zone, const char *data); 02306 02307 isc_result_t 02308 dns_zone_setnsec3param(dns_zone_t *zone, isc_uint8_t hash, isc_uint8_t flags, 02309 isc_uint16_t iter, isc_uint8_t saltlen, 02310 unsigned char *salt, isc_boolean_t replace); 02311 /*% 02312 * Set the NSEC3 parameters for the zone. 02313 * 02314 * If 'replace' is ISC_TRUE, then the existing NSEC3 chain, if any, will 02315 * be replaced with the new one. If 'hash' is zero, then the replacement 02316 * chain will be NSEC rather than NSEC3. 02317 * 02318 * Requires: 02319 * \li 'zone' to be valid. 02320 */ 02321 02322 void 02323 dns_zone_setrawdata(dns_zone_t *zone, dns_masterrawheader_t *header); 02324 /*% 02325 * Set the data to be included in the header when the zone is dumped in 02326 * binary format. 02327 */ 02328 02329 isc_result_t 02330 dns_zone_synckeyzone(dns_zone_t *zone); 02331 /*% 02332 * Force the managed key zone to synchronize, and start the key 02333 * maintenance timer. 02334 */ 02335 02336 isc_result_t 02337 dns_zone_getloadtime(dns_zone_t *zone, isc_time_t *loadtime); 02338 /*% 02339 * Return the time when the zone was last loaded. 02340 */ 02341 02342 isc_result_t 02343 dns_zone_getrefreshtime(dns_zone_t *zone, isc_time_t *refreshtime); 02344 /*% 02345 * Return the time when the (slave) zone will need to be refreshed. 02346 */ 02347 02348 isc_result_t 02349 dns_zone_getexpiretime(dns_zone_t *zone, isc_time_t *expiretime); 02350 /*% 02351 * Return the time when the (slave) zone will expire. 02352 */ 02353 02354 isc_result_t 02355 dns_zone_getrefreshkeytime(dns_zone_t *zone, isc_time_t *refreshkeytime); 02356 /*% 02357 * Return the time of the next scheduled DNSSEC key event. 02358 */ 02359 02360 unsigned int 02361 dns_zone_getincludes(dns_zone_t *zone, char ***includesp); 02362 /*% 02363 * Return the number include files that were encountered 02364 * during load. If the number is greater than zero, 'includesp' 02365 * will point to an array containing the filenames. 02366 * 02367 * The array and its contents need to be freed using isc_mem_free. 02368 */ 02369 02370 isc_result_t 02371 dns_zone_rpz_enable(dns_zone_t *zone, dns_rpz_zones_t *rpzs, 02372 dns_rpz_num_t rpz_num); 02373 /*% 02374 * Set the response policy associated with a zone. 02375 */ 02376 02377 void 02378 dns_zone_rpz_enable_db(dns_zone_t *zone, dns_db_t *db); 02379 /*% 02380 * If a zone is a response policy zone, mark its new database. 02381 */ 02382 02383 dns_rpz_num_t 02384 dns_zone_get_rpz_num(dns_zone_t *zone); 02385 02386 void 02387 dns_zone_setstatlevel(dns_zone_t *zone, dns_zonestat_level_t level); 02388 02389 dns_zonestat_level_t 02390 dns_zone_getstatlevel(dns_zone_t *zone); 02391 /*% 02392 * Set and get the statistics reporting level for the zone; 02393 * full, terse, or none. 02394 */ 02395 02396 isc_result_t 02397 dns_zone_setserial(dns_zone_t *zone, isc_uint32_t serial); 02398 /*% 02399 * Set the zone's serial to 'serial'. 02400 */ 02401 ISC_LANG_ENDDECLS 02402 02403 02404 #endif /* DNS_ZONE_H */