2 * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2003 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: zone.h,v 1.126.18.19 2006/08/01 03:45:21 marka Exp $ */
31 #include <isc/formatcheck.h>
33 #include <isc/rwlock.h>
35 #include <dns/masterdump.h>
36 #include <dns/types.h>
45 #define DNS_ZONEOPT_SERVERS 0x00000001U /*%< perform server checks */
46 #define DNS_ZONEOPT_PARENTS 0x00000002U /*%< perform parent checks */
47 #define DNS_ZONEOPT_CHILDREN 0x00000004U /*%< perform child checks */
48 #define DNS_ZONEOPT_NOTIFY 0x00000008U /*%< perform NOTIFY */
49 #define DNS_ZONEOPT_MANYERRORS 0x00000010U /*%< return many errors on load */
50 #define DNS_ZONEOPT_IXFRFROMDIFFS 0x00000020U /*%< calculate differences */
51 #define DNS_ZONEOPT_NOMERGE 0x00000040U /*%< don't merge journal */
52 #define DNS_ZONEOPT_CHECKNS 0x00000080U /*%< check if NS's are addresses */
53 #define DNS_ZONEOPT_FATALNS 0x00000100U /*%< DNS_ZONEOPT_CHECKNS is fatal */
54 #define DNS_ZONEOPT_MULTIMASTER 0x00000200U /*%< this zone has multiple masters */
55 #define DNS_ZONEOPT_USEALTXFRSRC 0x00000400U /*%< use alternate transfer sources */
56 #define DNS_ZONEOPT_CHECKNAMES 0x00000800U /*%< check-names */
57 #define DNS_ZONEOPT_CHECKNAMESFAIL 0x00001000U /*%< fatal check-name failures */
58 #define DNS_ZONEOPT_CHECKWILDCARD 0x00002000U /*%< check for internal wildcards */
59 #define DNS_ZONEOPT_CHECKMX 0x00004000U /*%< check-mx */
60 #define DNS_ZONEOPT_CHECKMXFAIL 0x00008000U /*%< fatal check-mx failures */
61 #define DNS_ZONEOPT_CHECKINTEGRITY 0x00010000U /*%< perform integrity checks */
62 #define DNS_ZONEOPT_CHECKSIBLING 0x00020000U /*%< perform sibling glue checks */
63 #define DNS_ZONEOPT_NOCHECKNS 0x00040000U /*%< disable IN NS address checks */
64 #define DNS_ZONEOPT_WARNMXCNAME 0x00080000U /*%< warn on MX CNAME check */
65 #define DNS_ZONEOPT_IGNOREMXCNAME 0x00100000U /*%< ignore MX CNAME check */
66 #define DNS_ZONEOPT_WARNSRVCNAME 0x00200000U /*%< warn on SRV CNAME check */
67 #define DNS_ZONEOPT_IGNORESRVCNAME 0x00400000U /*%< ignore SRV CNAME check */
68 #define DNS_ZONEOPT_UPDATECHECKKSK 0x00800000U /*%< check dnskey KSK flag */
70 #ifndef NOMINUM_PUBLIC
72 * Nominum specific options build down.
74 #define DNS_ZONEOPT_NOTIFYFORWARD 0x80000000U /* forward notify to master */
75 #endif /* NOMINUM_PUBLIC */
77 #ifndef DNS_ZONE_MINREFRESH
78 #define DNS_ZONE_MINREFRESH 300 /*%< 5 minutes */
80 #ifndef DNS_ZONE_MAXREFRESH
81 #define DNS_ZONE_MAXREFRESH 2419200 /*%< 4 weeks */
83 #ifndef DNS_ZONE_DEFAULTREFRESH
84 #define DNS_ZONE_DEFAULTREFRESH 3600 /*%< 1 hour */
86 #ifndef DNS_ZONE_MINRETRY
87 #define DNS_ZONE_MINRETRY 300 /*%< 5 minutes */
89 #ifndef DNS_ZONE_MAXRETRY
90 #define DNS_ZONE_MAXRETRY 1209600 /*%< 2 weeks */
92 #ifndef DNS_ZONE_DEFAULTRETRY
93 #define DNS_ZONE_DEFAULTRETRY 60 /*%< 1 minute, subject to
94 exponential backoff */
97 #define DNS_ZONESTATE_XFERRUNNING 1
98 #define DNS_ZONESTATE_XFERDEFERRED 2
99 #define DNS_ZONESTATE_SOAQUERY 3
100 #define DNS_ZONESTATE_ANY 4
109 dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx);
111 * Creates a new empty zone and attach '*zonep' to it.
114 *\li 'zonep' to point to a NULL pointer.
115 *\li 'mctx' to be a valid memory context.
118 *\li '*zonep' refers to a valid zone.
123 *\li #ISC_R_UNEXPECTED
127 dns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass);
129 * Sets the class of a zone. This operation can only be performed
133 *\li 'zone' to be a valid zone.
134 *\li dns_zone_setclass() not to have been called since the zone was
136 *\li 'rdclass' != dns_rdataclass_none.
140 dns_zone_getclass(dns_zone_t *zone);
142 * Returns the current zone class.
145 *\li 'zone' to be a valid zone.
149 dns_zone_settype(dns_zone_t *zone, dns_zonetype_t type);
151 * Sets the zone type. This operation can only be performed once on
155 *\li 'zone' to be a valid zone.
156 *\li dns_zone_settype() not to have been called since the zone was
158 *\li 'type' != dns_zone_none
162 dns_zone_setview(dns_zone_t *zone, dns_view_t *view);
164 * Associate the zone with a view.
167 *\li 'zone' to be a valid zone.
171 dns_zone_getview(dns_zone_t *zone);
173 * Returns the zone's associated view.
176 *\li 'zone' to be a valid zone.
180 dns_zone_setorigin(dns_zone_t *zone, const dns_name_t *origin);
182 * Sets the zones origin to 'origin'.
185 *\li 'zone' to be a valid zone.
186 *\li 'origin' to be non NULL.
194 dns_zone_getorigin(dns_zone_t *zone);
196 * Returns the value of the origin.
199 *\li 'zone' to be a valid zone.
203 dns_zone_setfile(dns_zone_t *zone, const char *file);
206 dns_zone_setfile2(dns_zone_t *zone, const char *file,
207 dns_masterformat_t format);
209 * Sets the name of the master file in the format of 'format' from which
210 * the zone loads its database to 'file'.
212 * For zones that have no associated master file, 'file' will be NULL.
214 * For zones with persistent databases, the file name
215 * setting is ignored.
217 * dns_zone_setfile() is a backward-compatible form of
218 * dns_zone_setfile2(), which always specifies the
219 * dns_masterformat_text (RFC1035) format.
222 *\li 'zone' to be a valid zone.
230 dns_zone_getfile(dns_zone_t *zone);
232 * Gets the name of the zone's master file, if any.
235 *\li 'zone' to be valid initialised zone.
238 *\li Pointer to null-terminated file name, or NULL.
242 dns_zone_load(dns_zone_t *zone);
245 dns_zone_loadnew(dns_zone_t *zone);
247 * Cause the database to be loaded from its backing store.
248 * Confirm that the minimum requirements for the zone type are
249 * met, otherwise DNS_R_BADZONE is returned.
251 * dns_zone_loadnew() only loads zones that are not yet loaded.
252 * dns_zone_load() also loads zones that are already loaded and
253 * and whose master file has changed since the last load.
256 *\li 'zone' to be a valid zone.
259 *\li #ISC_R_UNEXPECTED
261 *\li DNS_R_CONTINUE Incremental load has been queued.
262 *\li DNS_R_UPTODATE The zone has already been loaded based on
263 * file system timestamps.
265 *\li Any result value from dns_db_load().
269 dns_zone_attach(dns_zone_t *source, dns_zone_t **target);
271 * Attach '*target' to 'source' incrementing its external
275 *\li 'zone' to be a valid zone.
276 *\li 'target' to be non NULL and '*target' to be NULL.
280 dns_zone_detach(dns_zone_t **zonep);
282 * Detach from a zone decrementing its external reference count.
283 * If this was the last external reference to the zone it will be
284 * shut down and eventually freed.
287 *\li 'zonep' to point to a valid zone.
291 dns_zone_iattach(dns_zone_t *source, dns_zone_t **target);
293 * Attach '*target' to 'source' incrementing its internal
294 * reference count. This is intended for use by operations
295 * such as zone transfers that need to prevent the zone
296 * object from being freed but not from shutting down.
299 *\li The caller is running in the context of the zone's task.
300 *\li 'zone' to be a valid zone.
301 *\li 'target' to be non NULL and '*target' to be NULL.
305 dns_zone_idetach(dns_zone_t **zonep);
307 * Detach from a zone decrementing its internal reference count.
308 * If there are no more internal or external references to the
309 * zone, it will be freed.
312 *\li The caller is running in the context of the zone's task.
313 *\li 'zonep' to point to a valid zone.
317 dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value);
319 * Sets ('value' == 'ISC_TRUE') / clears ('value' == 'IS_FALSE')
320 * zone flags. Valid flag bits are DNS_ZONE_F_*.
323 *\li 'zone' to be a valid zone.
327 dns_zone_getdb(dns_zone_t *zone, dns_db_t **dbp);
329 * Attach '*dbp' to the database to if it exists otherwise
330 * return DNS_R_NOTLOADED.
333 *\li 'zone' to be a valid zone.
334 *\li 'dbp' to be != NULL && '*dbp' == NULL.
342 dns_zone_setdbtype(dns_zone_t *zone,
343 unsigned int dbargc, const char * const *dbargv);
345 * Sets the database type to dbargv[0] and database arguments
346 * to subsequent dbargv elements.
347 * 'db_type' is not checked to see if it is a valid database type.
350 *\li 'zone' to be a valid zone.
351 *\li 'database' to be non NULL.
352 *\li 'dbargc' to be >= 1
353 *\li 'dbargv' to point to dbargc NULL-terminated strings
361 dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx);
363 * Returns the current dbtype. isc_mem_free() should be used
364 * to free 'argv' after use.
367 *\li 'zone' to be a valid zone.
368 *\li 'argv' to be non NULL and *argv to be NULL.
369 *\li 'mctx' to be valid.
377 dns_zone_markdirty(dns_zone_t *zone);
379 * Mark a zone as 'dirty'.
382 *\li 'zone' to be a valid zone.
386 dns_zone_expire(dns_zone_t *zone);
388 * Mark the zone as expired. If the zone requires dumping cause it to
389 * be initiated. Set the refresh and retry intervals to there default
390 * values and unload the zone.
393 *\li 'zone' to be a valid zone.
397 dns_zone_refresh(dns_zone_t *zone);
399 * Initiate zone up to date checks. The zone must already be being
403 *\li 'zone' to be a valid zone.
407 dns_zone_flush(dns_zone_t *zone);
409 * Write the zone to database if there are uncommited changes.
412 *\li 'zone' to be a valid zone.
416 dns_zone_dump(dns_zone_t *zone);
418 * Write the zone to database.
421 *\li 'zone' to be a valid zone.
425 dns_zone_dumptostream(dns_zone_t *zone, FILE *fd);
428 dns_zone_dumptostream2(dns_zone_t *zone, FILE *fd, dns_masterformat_t format,
429 const dns_master_style_t *style);
431 * Write the zone to stream 'fd' in the specified 'format'.
432 * If the 'format' is dns_masterformat_text (RFC1035), 'style' also
433 * specifies the file style (e.g., &dns_master_style_default).
435 * dns_zone_dumptostream() is a backward-compatible form of
436 * dns_zone_dumptostream2(), which always uses the dns_masterformat_text
437 * format and the dns_master_style_default style.
439 * Note that dns_zone_dumptostream2() is the most flexible form. It
440 * can also provide the functionality of dns_zone_fulldumptostream().
443 *\li 'zone' to be a valid zone.
444 *\li 'fd' to be a stream open for writing.
448 dns_zone_fulldumptostream(dns_zone_t *zone, FILE *fd);
450 * The same as dns_zone_dumptostream, but dumps the zone with
451 * different dump settings (dns_master_style_full).
454 *\li 'zone' to be a valid zone.
455 *\li 'fd' to be a stream open for writing.
459 dns_zone_maintenance(dns_zone_t *zone);
461 * Perform regular maintenace on the zone. This is called as a
462 * result of a zone being managed.
465 *\li 'zone' to be a valid zone.
469 dns_zone_setmasters(dns_zone_t *zone, const isc_sockaddr_t *masters,
472 dns_zone_setmasterswithkeys(dns_zone_t *zone,
473 const isc_sockaddr_t *masters,
474 dns_name_t **keynames,
477 * Set the list of master servers for the zone.
480 *\li 'zone' to be a valid zone.
481 *\li 'masters' array of isc_sockaddr_t with port set or NULL.
482 *\li 'count' the number of masters.
483 *\li 'keynames' array of dns_name_t's for tsig keys or NULL.
485 * \li dns_zone_setmasters() is just a wrapper to setmasterswithkeys(),
486 * passing NULL in the keynames field.
488 * \li If 'masters' is NULL then 'count' must be zero.
493 *\li Any result dns_name_dup() can return, if keynames!=NULL
497 dns_zone_setalsonotify(dns_zone_t *zone, const isc_sockaddr_t *notify,
500 * Set the list of additional servers to be notified when
501 * a zone changes. To clear the list use 'count = 0'.
504 *\li 'zone' to be a valid zone.
505 *\li 'notify' to be non-NULL if count != 0.
506 *\li 'count' to be the number of notifyees.
514 dns_zone_unload(dns_zone_t *zone);
516 * detach the database from the zone structure.
519 *\li 'zone' to be a valid zone.
523 dns_zone_setoption(dns_zone_t *zone, unsigned int option, isc_boolean_t value);
525 * Set given options on ('value' == ISC_TRUE) or off ('value' ==
529 *\li 'zone' to be a valid zone.
533 dns_zone_getoptions(dns_zone_t *zone);
535 * Returns the current zone options.
538 *\li 'zone' to be a valid zone.
542 dns_zone_setminrefreshtime(dns_zone_t *zone, isc_uint32_t val);
544 * Set the minimum refresh time.
547 *\li 'zone' is valid.
552 dns_zone_setmaxrefreshtime(dns_zone_t *zone, isc_uint32_t val);
554 * Set the maximum refresh time.
557 *\li 'zone' is valid.
562 dns_zone_setminretrytime(dns_zone_t *zone, isc_uint32_t val);
564 * Set the minimum retry time.
567 *\li 'zone' is valid.
572 dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val);
574 * Set the maximum retry time.
577 *\li 'zone' is valid.
582 dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
584 dns_zone_setaltxfrsource4(dns_zone_t *zone,
585 const isc_sockaddr_t *xfrsource);
587 * Set the source address to be used in IPv4 zone transfers.
590 *\li 'zone' to be a valid zone.
591 *\li 'xfrsource' to contain the address.
598 dns_zone_getxfrsource4(dns_zone_t *zone);
600 dns_zone_getaltxfrsource4(dns_zone_t *zone);
602 * Returns the source address set by a previous dns_zone_setxfrsource4
603 * call, or the default of inaddr_any, port 0.
606 *\li 'zone' to be a valid zone.
610 dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
612 dns_zone_setaltxfrsource6(dns_zone_t *zone,
613 const isc_sockaddr_t *xfrsource);
615 * Set the source address to be used in IPv6 zone transfers.
618 *\li 'zone' to be a valid zone.
619 *\li 'xfrsource' to contain the address.
626 dns_zone_getxfrsource6(dns_zone_t *zone);
628 dns_zone_getaltxfrsource6(dns_zone_t *zone);
630 * Returns the source address set by a previous dns_zone_setxfrsource6
631 * call, or the default of in6addr_any, port 0.
634 *\li 'zone' to be a valid zone.
638 dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
640 * Set the source address to be used with IPv4 NOTIFY messages.
643 *\li 'zone' to be a valid zone.
644 *\li 'notifysrc' to contain the address.
651 dns_zone_getnotifysrc4(dns_zone_t *zone);
653 * Returns the source address set by a previous dns_zone_setnotifysrc4
654 * call, or the default of inaddr_any, port 0.
657 *\li 'zone' to be a valid zone.
661 dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
663 * Set the source address to be used with IPv6 NOTIFY messages.
666 *\li 'zone' to be a valid zone.
667 *\li 'notifysrc' to contain the address.
674 dns_zone_getnotifysrc6(dns_zone_t *zone);
676 * Returns the source address set by a previous dns_zone_setnotifysrc6
677 * call, or the default of in6addr_any, port 0.
680 *\li 'zone' to be a valid zone.
684 dns_zone_setnotifyacl(dns_zone_t *zone, dns_acl_t *acl);
686 * Sets the notify acl list for the zone.
689 *\li 'zone' to be a valid zone.
690 *\li 'acl' to be a valid acl.
694 dns_zone_setqueryacl(dns_zone_t *zone, dns_acl_t *acl);
696 * Sets the query acl list for the zone.
699 *\li 'zone' to be a valid zone.
700 *\li 'acl' to be a valid acl.
704 dns_zone_setupdateacl(dns_zone_t *zone, dns_acl_t *acl);
706 * Sets the update acl list for the zone.
709 *\li 'zone' to be a valid zone.
710 *\li 'acl' to be valid acl.
714 dns_zone_setforwardacl(dns_zone_t *zone, dns_acl_t *acl);
716 * Sets the forward unsigned updates acl list for the zone.
719 *\li 'zone' to be a valid zone.
720 *\li 'acl' to be valid acl.
724 dns_zone_setxfracl(dns_zone_t *zone, dns_acl_t *acl);
726 * Sets the transfer acl list for the zone.
729 *\li 'zone' to be a valid zone.
730 *\li 'acl' to be valid acl.
734 dns_zone_getnotifyacl(dns_zone_t *zone);
736 * Returns the current notify acl or NULL.
739 *\li 'zone' to be a valid zone.
742 *\li acl a pointer to the acl.
747 dns_zone_getqueryacl(dns_zone_t *zone);
749 * Returns the current query acl or NULL.
752 *\li 'zone' to be a valid zone.
755 *\li acl a pointer to the acl.
760 dns_zone_getupdateacl(dns_zone_t *zone);
762 * Returns the current update acl or NULL.
765 *\li 'zone' to be a valid zone.
768 *\li acl a pointer to the acl.
773 dns_zone_getforwardacl(dns_zone_t *zone);
775 * Returns the current forward unsigned updates acl or NULL.
778 *\li 'zone' to be a valid zone.
781 *\li acl a pointer to the acl.
786 dns_zone_getxfracl(dns_zone_t *zone);
788 * Returns the current transfer acl or NULL.
791 *\li 'zone' to be a valid zone.
794 *\li acl a pointer to the acl.
799 dns_zone_clearupdateacl(dns_zone_t *zone);
801 * Clear the current update acl.
804 *\li 'zone' to be a valid zone.
808 dns_zone_clearforwardacl(dns_zone_t *zone);
810 * Clear the current forward unsigned updates acl.
813 *\li 'zone' to be a valid zone.
817 dns_zone_clearnotifyacl(dns_zone_t *zone);
819 * Clear the current notify acl.
822 *\li 'zone' to be a valid zone.
826 dns_zone_clearqueryacl(dns_zone_t *zone);
828 * Clear the current query acl.
831 *\li 'zone' to be a valid zone.
835 dns_zone_clearxfracl(dns_zone_t *zone);
837 * Clear the current transfer acl.
840 *\li 'zone' to be a valid zone.
844 dns_zone_getupdatedisabled(dns_zone_t *zone);
846 * Return update disabled.
850 dns_zone_setupdatedisabled(dns_zone_t *zone, isc_boolean_t state);
852 * Set update disabled.
856 dns_zone_getzeronosoattl(dns_zone_t *zone);
858 * Return zero-no-soa-ttl status.
862 dns_zone_setzeronosoattl(dns_zone_t *zone, isc_boolean_t state);
864 * Set zero-no-soa-ttl status.
868 dns_zone_setchecknames(dns_zone_t *zone, dns_severity_t severity);
870 * Set the severity of name checking when loading a zone.
873 * \li 'zone' to be a valid zone.
877 dns_zone_getchecknames(dns_zone_t *zone);
879 * Return the current severity of name checking.
882 *\li 'zone' to be a valid zone.
886 dns_zone_setjournalsize(dns_zone_t *zone, isc_int32_t size);
888 * Sets the journal size for the zone.
891 *\li 'zone' to be a valid zone.
895 dns_zone_getjournalsize(dns_zone_t *zone);
897 * Return the journal size as set with a previous call to
898 * dns_zone_setjournalsize().
901 *\li 'zone' to be a valid zone.
905 dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
908 * Tell the zone that it has recieved a NOTIFY message from another
909 * server. This may cause some zone maintainence activity to occur.
912 *\li 'zone' to be a valid zone.
913 *\li '*from' to contain the address of the server from which 'msg'
915 *\li 'msg' a message with opcode NOTIFY and qr clear.
925 dns_zone_setmaxxfrin(dns_zone_t *zone, isc_uint32_t maxxfrin);
927 * Set the maximum time (in seconds) that a zone transfer in (AXFR/IXFR)
928 * of this zone will use before being aborted.
931 * \li 'zone' to be valid initialised zone.
935 dns_zone_getmaxxfrin(dns_zone_t *zone);
937 * Returns the maximum transfer time for this zone. This will be
938 * either the value set by the last call to dns_zone_setmaxxfrin() or
939 * the default value of 1 hour.
942 *\li 'zone' to be valid initialised zone.
946 dns_zone_setmaxxfrout(dns_zone_t *zone, isc_uint32_t maxxfrout);
948 * Set the maximum time (in seconds) that a zone transfer out (AXFR/IXFR)
949 * of this zone will use before being aborted.
952 * \li 'zone' to be valid initialised zone.
956 dns_zone_getmaxxfrout(dns_zone_t *zone);
958 * Returns the maximum transfer time for this zone. This will be
959 * either the value set by the last call to dns_zone_setmaxxfrout() or
960 * the default value of 1 hour.
963 *\li 'zone' to be valid initialised zone.
967 dns_zone_setjournal(dns_zone_t *zone, const char *journal);
969 * Sets the filename used for journaling updates / IXFR transfers.
970 * The default journal name is set by dns_zone_setfile() to be
971 * "file.jnl". If 'journal' is NULL, the zone will have no
975 *\li 'zone' to be a valid zone.
983 dns_zone_getjournal(dns_zone_t *zone);
985 * Returns the journal name associated with this zone.
986 * If no journal has been set this will be NULL.
989 *\li 'zone' to be valid initialised zone.
993 dns_zone_gettype(dns_zone_t *zone);
995 * Returns the type of the zone (master/slave/etc.)
998 *\li 'zone' to be valid initialised zone.
1002 dns_zone_settask(dns_zone_t *zone, isc_task_t *task);
1004 * Give a zone a task to work with. Any current task will be detached.
1007 *\li 'zone' to be valid.
1008 *\li 'task' to be valid.
1012 dns_zone_gettask(dns_zone_t *zone, isc_task_t **target);
1014 * Attach '*target' to the zone's task.
1017 *\li 'zone' to be valid initialised zone.
1018 *\li 'zone' to have a task.
1019 *\li 'target' to be != NULL && '*target' == NULL.
1023 dns_zone_notify(dns_zone_t *zone);
1025 * Generate notify events for this zone.
1028 *\li 'zone' to be a valid zone.
1032 dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump);
1034 * Replace the database of "zone" with a new database "db".
1036 * If "dump" is ISC_TRUE, then the new zone contents are dumped
1037 * into to the zone's master file for persistence. When replacing
1038 * a zone database by one just loaded from a master file, set
1039 * "dump" to ISC_FALSE to avoid a redunant redump of the data just
1040 * loaded. Otherwise, it should be set to ISC_TRUE.
1042 * If the "diff-on-reload" option is enabled in the configuration file,
1043 * the differences between the old and the new database are added to the
1044 * journal file, and the master file dump is postponed.
1047 * \li 'zone' to be a valid zone.
1051 * \li DNS_R_BADZONE zone failed basic consistancy checks:
1052 * * a single SOA must exist
1053 * * some NS records must exist.
1058 dns_zone_getidlein(dns_zone_t *zone);
1061 * \li 'zone' to be a valid zone.
1064 * \li number of seconds of idle time before we abort the transfer in.
1068 dns_zone_setidlein(dns_zone_t *zone, isc_uint32_t idlein);
1070 * \li Set the idle timeout for transfer the.
1071 * \li Zero set the default value, 1 hour.
1074 * \li 'zone' to be a valid zone.
1078 dns_zone_getidleout(dns_zone_t *zone);
1082 * \li 'zone' to be a valid zone.
1085 * \li number of seconds of idle time before we abort a transfer out.
1089 dns_zone_setidleout(dns_zone_t *zone, isc_uint32_t idleout);
1091 * \li Set the idle timeout for transfers out.
1092 * \li Zero set the default value, 1 hour.
1095 * \li 'zone' to be a valid zone.
1099 dns_zone_getssutable(dns_zone_t *zone, dns_ssutable_t **table);
1101 * Get the simple-secure-update policy table.
1104 * \li 'zone' to be a valid zone.
1108 dns_zone_setssutable(dns_zone_t *zone, dns_ssutable_t *table);
1110 * Set / clear the simple-secure-update policy table.
1113 * \li 'zone' to be a valid zone.
1117 dns_zone_getmctx(dns_zone_t *zone);
1119 * Get the memory context of a zone.
1122 * \li 'zone' to be a valid zone.
1126 dns_zone_getmgr(dns_zone_t *zone);
1128 * If 'zone' is managed return the zone manager otherwise NULL.
1131 * \li 'zone' to be a valid zone.
1135 dns_zone_setsigvalidityinterval(dns_zone_t *zone, isc_uint32_t interval);
1137 * Set the zone's SIG validity interval. This is the length of time
1138 * for which DNSSEC signatures created as a result of dynamic updates
1139 * to secure zones will remain valid, in seconds.
1142 * \li 'zone' to be a valid zone.
1146 dns_zone_getsigvalidityinterval(dns_zone_t *zone);
1148 * Get the zone's SIG validity interval.
1151 * \li 'zone' to be a valid zone.
1155 dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype);
1157 * Sets zone notify method to "notifytype"
1161 dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg,
1162 dns_updatecallback_t callback, void *callback_arg);
1164 * Forward 'msg' to each master in turn until we get an answer or we
1165 * have exausted the list of masters. 'callback' will be called with
1166 * ISC_R_SUCCESS if we get an answer and the returned message will be
1167 * passed as 'answer_message', otherwise a non ISC_R_SUCCESS result code
1168 * will be passed and answer_message will be NULL. The callback function
1169 * is responsible for destroying 'answer_message'.
1170 * (callback)(callback_arg, result, answer_message);
1173 *\li 'zone' to be valid
1174 *\li 'msg' to be valid.
1175 *\li 'callback' to be non NULL.
1177 *\li #ISC_R_SUCCESS if the message has been forwarded,
1178 *\li #ISC_R_NOMEMORY
1183 dns_zone_next(dns_zone_t *zone, dns_zone_t **next);
1185 * Find the next zone in the list of managed zones.
1188 *\li 'zone' to be valid
1189 *\li The zone manager for the indicated zone MUST be locked
1190 * by the caller. This is not checked.
1191 *\li 'next' be non-NULL, and '*next' be NULL.
1194 *\li 'next' points to a valid zone (result ISC_R_SUCCESS) or to NULL
1195 * (result ISC_R_NOMORE).
1199 dns_zone_first(dns_zonemgr_t *zmgr, dns_zone_t **first);
1201 * Find the first zone in the list of managed zones.
1204 *\li 'zonemgr' to be valid
1205 *\li The zone manager for the indicated zone MUST be locked
1206 * by the caller. This is not checked.
1207 *\li 'first' be non-NULL, and '*first' be NULL
1210 *\li 'first' points to a valid zone (result ISC_R_SUCCESS) or to NULL
1211 * (result ISC_R_NOMORE).
1215 dns_zone_setkeydirectory(dns_zone_t *zone, const char *directory);
1217 * Sets the name of the directory where private keys used for
1218 * online signing of dynamic zones are found.
1221 *\li 'zone' to be a valid zone.
1224 *\li #ISC_R_NOMEMORY
1229 dns_zone_getkeydirectory(dns_zone_t *zone);
1231 * Gets the name of the directory where private keys used for
1232 * online signing of dynamic zones are found.
1235 *\li 'zone' to be valid initialised zone.
1238 * Pointer to null-terminated file name, or NULL.
1243 dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
1244 isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr,
1245 dns_zonemgr_t **zmgrp);
1247 * Create a zone manager.
1250 *\li 'mctx' to be a valid memory context.
1251 *\li 'taskmgr' to be a valid task manager.
1252 *\li 'timermgr' to be a valid timer manager.
1253 *\li 'zmgrp' to point to a NULL pointer.
1257 dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone);
1259 * Bring the zone under control of a zone manager.
1262 *\li 'zmgr' to be a valid zone manager.
1263 *\li 'zone' to be a valid zone.
1267 dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr);
1269 * Force zone maintenance of all zones managed by 'zmgr' at its
1270 * earliest conveniene.
1274 dns_zonemgr_resumexfrs(dns_zonemgr_t *zmgr);
1276 * Attempt to start any stalled zone transfers.
1280 dns_zonemgr_shutdown(dns_zonemgr_t *zmgr);
1282 * Shut down the zone manager.
1285 *\li 'zmgr' to be a valid zone manager.
1289 dns_zonemgr_attach(dns_zonemgr_t *source, dns_zonemgr_t **target);
1291 * Attach '*target' to 'source' incrementing its external
1295 *\li 'zone' to be a valid zone.
1296 *\li 'target' to be non NULL and '*target' to be NULL.
1300 dns_zonemgr_detach(dns_zonemgr_t **zmgrp);
1302 * Detach from a zone manager.
1305 *\li '*zmgrp' is a valid, non-NULL zone manager pointer.
1308 *\li '*zmgrp' is NULL.
1312 dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone);
1314 * Release 'zone' from the managed by 'zmgr'. 'zmgr' is implicitly
1315 * detached from 'zone'.
1318 *\li 'zmgr' to be a valid zone manager.
1319 *\li 'zone' to be a valid zone.
1320 *\li 'zmgr' == 'zone->zmgr'
1323 *\li 'zone->zmgr' == NULL;
1327 dns_zonemgr_settransfersin(dns_zonemgr_t *zmgr, isc_uint32_t value);
1329 * Set the maximum number of simultaneous transfers in allowed by
1333 *\li 'zmgr' to be a valid zone manager.
1337 dns_zonemgr_getttransfersin(dns_zonemgr_t *zmgr);
1339 * Return the the maximum number of simultaneous transfers in allowed.
1342 *\li 'zmgr' to be a valid zone manager.
1346 dns_zonemgr_settransfersperns(dns_zonemgr_t *zmgr, isc_uint32_t value);
1348 * Set the number of zone transfers allowed per nameserver.
1351 *\li 'zmgr' to be a valid zone manager
1355 dns_zonemgr_getttransfersperns(dns_zonemgr_t *zmgr);
1357 * Return the number of transfers allowed per nameserver.
1360 *\li 'zmgr' to be a valid zone manager.
1364 dns_zonemgr_setiolimit(dns_zonemgr_t *zmgr, isc_uint32_t iolimit);
1366 * Set the number of simultaneous file descriptors available for
1367 * reading and writing masterfiles.
1370 *\li 'zmgr' to be a valid zone manager.
1371 *\li 'iolimit' to be positive.
1375 dns_zonemgr_getiolimit(dns_zonemgr_t *zmgr);
1377 * Get the number of simultaneous file descriptors available for
1378 * reading and writing masterfiles.
1381 *\li 'zmgr' to be a valid zone manager.
1385 dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value);
1387 * Set the number of SOA queries sent per second.
1390 *\li 'zmgr' to be a valid zone manager
1394 dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr);
1396 * Return the number of SOA queries sent per second.
1399 *\li 'zmgr' to be a valid zone manager.
1403 dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state);
1405 * Returns the number of zones in the specified state.
1408 *\li 'zmgr' to be a valid zone manager.
1409 *\li 'state' to be a valid DNS_ZONESTATE_ constant.
1413 dns_zone_forcereload(dns_zone_t *zone);
1415 * Force a reload of specified zone.
1418 *\li 'zone' to be a valid zone.
1422 dns_zone_isforced(dns_zone_t *zone);
1424 * Check if the zone is waiting a forced reload.
1427 * \li 'zone' to be a valid zone.
1431 dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on);
1433 * Make the zone keep or not keep an array of statistics
1437 * \li zone be a valid zone.
1441 dns_zone_getstatscounters(dns_zone_t *zone);
1444 * zone be a valid zone.
1447 * \li A pointer to the zone's array of statistics counters,
1448 * or NULL if it has none.
1452 dns_zone_dialup(dns_zone_t *zone);
1454 * Perform dialup-time maintenance on 'zone'.
1458 dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup);
1460 * Set the dialup type of 'zone' to 'dialup'.
1463 * \li 'zone' to be valid initialised zone.
1464 *\li 'dialup' to be a valid dialup type.
1468 dns_zone_log(dns_zone_t *zone, int level, const char *msg, ...)
1469 ISC_FORMAT_PRINTF(3, 4);
1471 * Log the message 'msg...' at 'level', including text that identifies
1472 * the message as applying to 'zone'.
1476 dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category, int level,
1477 const char *msg, ...) ISC_FORMAT_PRINTF(4, 5);
1479 * Log the message 'msg...' at 'level', including text that identifies
1480 * the message as applying to 'zone'.
1484 dns_zone_name(dns_zone_t *zone, char *buf, size_t len);
1486 * Return the name of the zone with class and view.
1489 *\li 'zone' to be valid.
1490 *\li 'buf' to be non NULL.
1494 dns_zone_checknames(dns_zone_t *zone, dns_name_t *name, dns_rdata_t *rdata);
1496 * Check if this record meets the check-names policy.
1499 * 'zone' to be valid.
1500 * 'name' to be valid.
1501 * 'rdata' to be valid.
1504 * DNS_R_SUCCESS passed checks.
1505 * DNS_R_BADOWNERNAME failed ownername checks.
1506 * DNS_R_BADNAME failed rdata checks.
1510 dns_zone_setacache(dns_zone_t *zone, dns_acache_t *acache);
1512 * Associate the zone with an additional cache.
1515 * 'zone' to be a valid zone.
1516 * 'acache' to be a non NULL pointer.
1519 * 'zone' will have a reference to 'acache'
1523 dns_zone_setcheckmx(dns_zone_t *zone, dns_checkmxfunc_t checkmx);
1525 * Set the post load integrity callback function 'checkmx'.
1526 * 'checkmx' will be called if the MX is not within the zone.
1529 * 'zone' to be a valid zone.
1533 dns_zone_setchecksrv(dns_zone_t *zone, dns_checkmxfunc_t checksrv);
1535 * Set the post load integrity callback function 'checksrv'.
1536 * 'checksrv' will be called if the SRV TARGET is not within the zone.
1539 * 'zone' to be a valid zone.
1543 dns_zone_setcheckns(dns_zone_t *zone, dns_checknsfunc_t checkns);
1545 * Set the post load integrity callback function 'checkmx'.
1546 * 'checkmx' will be called if the MX is not within the zone.
1549 * 'zone' to be a valid zone.
1553 dns_zone_setnotifydelay(dns_zone_t *zone, isc_uint32_t delay);
1555 * Set the minimum delay between sets of notify messages.
1558 * 'zone' to be valid.
1562 dns_zone_getnotifydelay(dns_zone_t *zone);
1564 * Get the minimum delay between sets of notify messages.
1567 * 'zone' to be valid.
1571 dns_zone_setisself(dns_zone_t *zone, dns_isselffunc_t isself, void *arg);
1573 * Set the isself callback function and argument.
1576 * isself(dns_view_t *myview, dns_tsigkey_t *mykey, isc_netaddr_t *srcaddr,
1577 * isc_netaddr_t *destaddr, dns_rdataclass_t rdclass, void *arg);
1579 * 'isself' returns ISC_TRUE if a non-recursive query from 'srcaddr' to
1580 * 'destaddr' with optional key 'mykey' for class 'rdclass' would be
1581 * delivered to 'myview'.
1586 #endif /* DNS_ZONE_H */