2 * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2003 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
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.153.56.8 2009/07/11 04:28:14 marka Exp $ */
23 /*! \file dns/zone.h */
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 */
69 #define DNS_ZONEOPT_TRYTCPREFRESH 0x01000000U /*%< try tcp refresh on udp failure */
70 #define DNS_ZONEOPT_NOTIFYTOSOA 0x02000000U /*%< Notify the SOA MNAME */
72 #ifndef NOMINUM_PUBLIC
74 * Nominum specific options build down.
76 #define DNS_ZONEOPT_NOTIFYFORWARD 0x80000000U /* forward notify to master */
77 #endif /* NOMINUM_PUBLIC */
79 #ifndef DNS_ZONE_MINREFRESH
80 #define DNS_ZONE_MINREFRESH 300 /*%< 5 minutes */
82 #ifndef DNS_ZONE_MAXREFRESH
83 #define DNS_ZONE_MAXREFRESH 2419200 /*%< 4 weeks */
85 #ifndef DNS_ZONE_DEFAULTREFRESH
86 #define DNS_ZONE_DEFAULTREFRESH 3600 /*%< 1 hour */
88 #ifndef DNS_ZONE_MINRETRY
89 #define DNS_ZONE_MINRETRY 300 /*%< 5 minutes */
91 #ifndef DNS_ZONE_MAXRETRY
92 #define DNS_ZONE_MAXRETRY 1209600 /*%< 2 weeks */
94 #ifndef DNS_ZONE_DEFAULTRETRY
95 #define DNS_ZONE_DEFAULTRETRY 60 /*%< 1 minute, subject to
96 exponential backoff */
99 #define DNS_ZONESTATE_XFERRUNNING 1
100 #define DNS_ZONESTATE_XFERDEFERRED 2
101 #define DNS_ZONESTATE_SOAQUERY 3
102 #define DNS_ZONESTATE_ANY 4
111 dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx);
113 * Creates a new empty zone and attach '*zonep' to it.
116 *\li 'zonep' to point to a NULL pointer.
117 *\li 'mctx' to be a valid memory context.
120 *\li '*zonep' refers to a valid zone.
125 *\li #ISC_R_UNEXPECTED
129 dns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass);
131 * Sets the class of a zone. This operation can only be performed
135 *\li 'zone' to be a valid zone.
136 *\li dns_zone_setclass() not to have been called since the zone was
138 *\li 'rdclass' != dns_rdataclass_none.
142 dns_zone_getclass(dns_zone_t *zone);
144 * Returns the current zone class.
147 *\li 'zone' to be a valid zone.
151 dns_zone_getserial(dns_zone_t *zone);
153 * Returns the current serial number of the zone.
156 *\li 'zone' to be a valid zone.
160 dns_zone_settype(dns_zone_t *zone, dns_zonetype_t type);
162 * Sets the zone type. This operation can only be performed once on
166 *\li 'zone' to be a valid zone.
167 *\li dns_zone_settype() not to have been called since the zone was
169 *\li 'type' != dns_zone_none
173 dns_zone_setview(dns_zone_t *zone, dns_view_t *view);
175 * Associate the zone with a view.
178 *\li 'zone' to be a valid zone.
182 dns_zone_getview(dns_zone_t *zone);
184 * Returns the zone's associated view.
187 *\li 'zone' to be a valid zone.
191 dns_zone_setorigin(dns_zone_t *zone, const dns_name_t *origin);
193 * Sets the zones origin to 'origin'.
196 *\li 'zone' to be a valid zone.
197 *\li 'origin' to be non NULL.
205 dns_zone_getorigin(dns_zone_t *zone);
207 * Returns the value of the origin.
210 *\li 'zone' to be a valid zone.
214 dns_zone_setfile(dns_zone_t *zone, const char *file);
217 dns_zone_setfile2(dns_zone_t *zone, const char *file,
218 dns_masterformat_t format);
220 * Sets the name of the master file in the format of 'format' from which
221 * the zone loads its database to 'file'.
223 * For zones that have no associated master file, 'file' will be NULL.
225 * For zones with persistent databases, the file name
226 * setting is ignored.
228 * dns_zone_setfile() is a backward-compatible form of
229 * dns_zone_setfile2(), which always specifies the
230 * dns_masterformat_text (RFC1035) format.
233 *\li 'zone' to be a valid zone.
241 dns_zone_getfile(dns_zone_t *zone);
243 * Gets the name of the zone's master file, if any.
246 *\li 'zone' to be valid initialised zone.
249 *\li Pointer to null-terminated file name, or NULL.
253 dns_zone_load(dns_zone_t *zone);
256 dns_zone_loadnew(dns_zone_t *zone);
259 dns_zone_loadandthaw(dns_zone_t *zone);
261 * Cause the database to be loaded from its backing store.
262 * Confirm that the minimum requirements for the zone type are
263 * met, otherwise DNS_R_BADZONE is returned.
265 * dns_zone_loadnew() only loads zones that are not yet loaded.
266 * dns_zone_load() also loads zones that are already loaded and
267 * and whose master file has changed since the last load.
268 * dns_zone_loadandthaw() is similar to dns_zone_load() but will
269 * also re-enable DNS UPDATEs when the load completes.
272 *\li 'zone' to be a valid zone.
275 *\li #ISC_R_UNEXPECTED
277 *\li DNS_R_CONTINUE Incremental load has been queued.
278 *\li DNS_R_UPTODATE The zone has already been loaded based on
279 * file system timestamps.
281 *\li Any result value from dns_db_load().
285 dns_zone_attach(dns_zone_t *source, dns_zone_t **target);
287 * Attach '*target' to 'source' incrementing its external
291 *\li 'zone' to be a valid zone.
292 *\li 'target' to be non NULL and '*target' to be NULL.
296 dns_zone_detach(dns_zone_t **zonep);
298 * Detach from a zone decrementing its external reference count.
299 * If this was the last external reference to the zone it will be
300 * shut down and eventually freed.
303 *\li 'zonep' to point to a valid zone.
307 dns_zone_iattach(dns_zone_t *source, dns_zone_t **target);
309 * Attach '*target' to 'source' incrementing its internal
310 * reference count. This is intended for use by operations
311 * such as zone transfers that need to prevent the zone
312 * object from being freed but not from shutting down.
315 *\li The caller is running in the context of the zone's task.
316 *\li 'zone' to be a valid zone.
317 *\li 'target' to be non NULL and '*target' to be NULL.
321 dns_zone_idetach(dns_zone_t **zonep);
323 * Detach from a zone decrementing its internal reference count.
324 * If there are no more internal or external references to the
325 * zone, it will be freed.
328 *\li The caller is running in the context of the zone's task.
329 *\li 'zonep' to point to a valid zone.
333 dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value);
335 * Sets ('value' == 'ISC_TRUE') / clears ('value' == 'IS_FALSE')
336 * zone flags. Valid flag bits are DNS_ZONE_F_*.
339 *\li 'zone' to be a valid zone.
343 dns_zone_getdb(dns_zone_t *zone, dns_db_t **dbp);
345 * Attach '*dbp' to the database to if it exists otherwise
346 * return DNS_R_NOTLOADED.
349 *\li 'zone' to be a valid zone.
350 *\li 'dbp' to be != NULL && '*dbp' == NULL.
358 dns_zone_setdbtype(dns_zone_t *zone,
359 unsigned int dbargc, const char * const *dbargv);
361 * Sets the database type to dbargv[0] and database arguments
362 * to subsequent dbargv elements.
363 * 'db_type' is not checked to see if it is a valid database type.
366 *\li 'zone' to be a valid zone.
367 *\li 'database' to be non NULL.
368 *\li 'dbargc' to be >= 1
369 *\li 'dbargv' to point to dbargc NULL-terminated strings
377 dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx);
379 * Returns the current dbtype. isc_mem_free() should be used
380 * to free 'argv' after use.
383 *\li 'zone' to be a valid zone.
384 *\li 'argv' to be non NULL and *argv to be NULL.
385 *\li 'mctx' to be valid.
393 dns_zone_markdirty(dns_zone_t *zone);
395 * Mark a zone as 'dirty'.
398 *\li 'zone' to be a valid zone.
402 dns_zone_expire(dns_zone_t *zone);
404 * Mark the zone as expired. If the zone requires dumping cause it to
405 * be initiated. Set the refresh and retry intervals to there default
406 * values and unload the zone.
409 *\li 'zone' to be a valid zone.
413 dns_zone_refresh(dns_zone_t *zone);
415 * Initiate zone up to date checks. The zone must already be being
419 *\li 'zone' to be a valid zone.
423 dns_zone_flush(dns_zone_t *zone);
425 * Write the zone to database if there are uncommitted changes.
428 *\li 'zone' to be a valid zone.
432 dns_zone_dump(dns_zone_t *zone);
434 * Write the zone to database.
437 *\li 'zone' to be a valid zone.
441 dns_zone_dumptostream(dns_zone_t *zone, FILE *fd);
444 dns_zone_dumptostream2(dns_zone_t *zone, FILE *fd, dns_masterformat_t format,
445 const dns_master_style_t *style);
447 * Write the zone to stream 'fd' in the specified 'format'.
448 * If the 'format' is dns_masterformat_text (RFC1035), 'style' also
449 * specifies the file style (e.g., &dns_master_style_default).
451 * dns_zone_dumptostream() is a backward-compatible form of
452 * dns_zone_dumptostream2(), which always uses the dns_masterformat_text
453 * format and the dns_master_style_default style.
455 * Note that dns_zone_dumptostream2() is the most flexible form. It
456 * can also provide the functionality of dns_zone_fulldumptostream().
459 *\li 'zone' to be a valid zone.
460 *\li 'fd' to be a stream open for writing.
464 dns_zone_fulldumptostream(dns_zone_t *zone, FILE *fd);
466 * The same as dns_zone_dumptostream, but dumps the zone with
467 * different dump settings (dns_master_style_full).
470 *\li 'zone' to be a valid zone.
471 *\li 'fd' to be a stream open for writing.
475 dns_zone_maintenance(dns_zone_t *zone);
477 * Perform regular maintenance on the zone. This is called as a
478 * result of a zone being managed.
481 *\li 'zone' to be a valid zone.
485 dns_zone_setmasters(dns_zone_t *zone, const isc_sockaddr_t *masters,
488 dns_zone_setmasterswithkeys(dns_zone_t *zone,
489 const isc_sockaddr_t *masters,
490 dns_name_t **keynames,
493 * Set the list of master servers for the zone.
496 *\li 'zone' to be a valid zone.
497 *\li 'masters' array of isc_sockaddr_t with port set or NULL.
498 *\li 'count' the number of masters.
499 *\li 'keynames' array of dns_name_t's for tsig keys or NULL.
501 * \li dns_zone_setmasters() is just a wrapper to setmasterswithkeys(),
502 * passing NULL in the keynames field.
504 * \li If 'masters' is NULL then 'count' must be zero.
509 *\li Any result dns_name_dup() can return, if keynames!=NULL
513 dns_zone_setalsonotify(dns_zone_t *zone, const isc_sockaddr_t *notify,
516 * Set the list of additional servers to be notified when
517 * a zone changes. To clear the list use 'count = 0'.
520 *\li 'zone' to be a valid zone.
521 *\li 'notify' to be non-NULL if count != 0.
522 *\li 'count' to be the number of notifiees.
530 dns_zone_unload(dns_zone_t *zone);
532 * detach the database from the zone structure.
535 *\li 'zone' to be a valid zone.
539 dns_zone_setoption(dns_zone_t *zone, unsigned int option, isc_boolean_t value);
541 * Set given options on ('value' == ISC_TRUE) or off ('value' ==
545 *\li 'zone' to be a valid zone.
549 dns_zone_getoptions(dns_zone_t *zone);
551 * Returns the current zone options.
554 *\li 'zone' to be a valid zone.
558 dns_zone_setminrefreshtime(dns_zone_t *zone, isc_uint32_t val);
560 * Set the minimum refresh time.
563 *\li 'zone' is valid.
568 dns_zone_setmaxrefreshtime(dns_zone_t *zone, isc_uint32_t val);
570 * Set the maximum refresh time.
573 *\li 'zone' is valid.
578 dns_zone_setminretrytime(dns_zone_t *zone, isc_uint32_t val);
580 * Set the minimum retry time.
583 *\li 'zone' is valid.
588 dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val);
590 * Set the maximum retry time.
593 *\li 'zone' is valid.
598 dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
600 dns_zone_setaltxfrsource4(dns_zone_t *zone,
601 const isc_sockaddr_t *xfrsource);
603 * Set the source address to be used in IPv4 zone transfers.
606 *\li 'zone' to be a valid zone.
607 *\li 'xfrsource' to contain the address.
614 dns_zone_getxfrsource4(dns_zone_t *zone);
616 dns_zone_getaltxfrsource4(dns_zone_t *zone);
618 * Returns the source address set by a previous dns_zone_setxfrsource4
619 * call, or the default of inaddr_any, port 0.
622 *\li 'zone' to be a valid zone.
626 dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
628 dns_zone_setaltxfrsource6(dns_zone_t *zone,
629 const isc_sockaddr_t *xfrsource);
631 * Set the source address to be used in IPv6 zone transfers.
634 *\li 'zone' to be a valid zone.
635 *\li 'xfrsource' to contain the address.
642 dns_zone_getxfrsource6(dns_zone_t *zone);
644 dns_zone_getaltxfrsource6(dns_zone_t *zone);
646 * Returns the source address set by a previous dns_zone_setxfrsource6
647 * call, or the default of in6addr_any, port 0.
650 *\li 'zone' to be a valid zone.
654 dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
656 * Set the source address to be used with IPv4 NOTIFY messages.
659 *\li 'zone' to be a valid zone.
660 *\li 'notifysrc' to contain the address.
667 dns_zone_getnotifysrc4(dns_zone_t *zone);
669 * Returns the source address set by a previous dns_zone_setnotifysrc4
670 * call, or the default of inaddr_any, port 0.
673 *\li 'zone' to be a valid zone.
677 dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
679 * Set the source address to be used with IPv6 NOTIFY messages.
682 *\li 'zone' to be a valid zone.
683 *\li 'notifysrc' to contain the address.
690 dns_zone_getnotifysrc6(dns_zone_t *zone);
692 * Returns the source address set by a previous dns_zone_setnotifysrc6
693 * call, or the default of in6addr_any, port 0.
696 *\li 'zone' to be a valid zone.
700 dns_zone_setnotifyacl(dns_zone_t *zone, dns_acl_t *acl);
702 * Sets the notify acl list for the zone.
705 *\li 'zone' to be a valid zone.
706 *\li 'acl' to be a valid acl.
710 dns_zone_setqueryacl(dns_zone_t *zone, dns_acl_t *acl);
712 * Sets the query acl list for the zone.
715 *\li 'zone' to be a valid zone.
716 *\li 'acl' to be a valid acl.
720 dns_zone_setqueryonacl(dns_zone_t *zone, dns_acl_t *acl);
722 * Sets the query-on acl list for the zone.
725 *\li 'zone' to be a valid zone.
726 *\li 'acl' to be a valid acl.
730 dns_zone_setupdateacl(dns_zone_t *zone, dns_acl_t *acl);
732 * Sets the update acl list for the zone.
735 *\li 'zone' to be a valid zone.
736 *\li 'acl' to be valid acl.
740 dns_zone_setforwardacl(dns_zone_t *zone, dns_acl_t *acl);
742 * Sets the forward unsigned updates acl list for the zone.
745 *\li 'zone' to be a valid zone.
746 *\li 'acl' to be valid acl.
750 dns_zone_setxfracl(dns_zone_t *zone, dns_acl_t *acl);
752 * Sets the transfer acl list for the zone.
755 *\li 'zone' to be a valid zone.
756 *\li 'acl' to be valid acl.
760 dns_zone_getnotifyacl(dns_zone_t *zone);
762 * Returns the current notify acl or NULL.
765 *\li 'zone' to be a valid zone.
768 *\li acl a pointer to the acl.
773 dns_zone_getqueryacl(dns_zone_t *zone);
775 * Returns the current query acl or NULL.
778 *\li 'zone' to be a valid zone.
781 *\li acl a pointer to the acl.
786 dns_zone_getqueryonacl(dns_zone_t *zone);
788 * Returns the current query-on acl or NULL.
791 *\li 'zone' to be a valid zone.
794 *\li acl a pointer to the acl.
799 dns_zone_getupdateacl(dns_zone_t *zone);
801 * Returns the current update acl or NULL.
804 *\li 'zone' to be a valid zone.
807 *\li acl a pointer to the acl.
812 dns_zone_getforwardacl(dns_zone_t *zone);
814 * Returns the current forward unsigned updates acl or NULL.
817 *\li 'zone' to be a valid zone.
820 *\li acl a pointer to the acl.
825 dns_zone_getxfracl(dns_zone_t *zone);
827 * Returns the current transfer acl or NULL.
830 *\li 'zone' to be a valid zone.
833 *\li acl a pointer to the acl.
838 dns_zone_clearupdateacl(dns_zone_t *zone);
840 * Clear the current update acl.
843 *\li 'zone' to be a valid zone.
847 dns_zone_clearforwardacl(dns_zone_t *zone);
849 * Clear the current forward unsigned updates acl.
852 *\li 'zone' to be a valid zone.
856 dns_zone_clearnotifyacl(dns_zone_t *zone);
858 * Clear the current notify acl.
861 *\li 'zone' to be a valid zone.
865 dns_zone_clearqueryacl(dns_zone_t *zone);
867 * Clear the current query acl.
870 *\li 'zone' to be a valid zone.
874 dns_zone_clearqueryonacl(dns_zone_t *zone);
876 * Clear the current query-on acl.
879 *\li 'zone' to be a valid zone.
883 dns_zone_clearxfracl(dns_zone_t *zone);
885 * Clear the current transfer acl.
888 *\li 'zone' to be a valid zone.
892 dns_zone_getupdatedisabled(dns_zone_t *zone);
894 * Return update disabled.
898 dns_zone_setupdatedisabled(dns_zone_t *zone, isc_boolean_t state);
900 * Set update disabled.
904 dns_zone_getzeronosoattl(dns_zone_t *zone);
906 * Return zero-no-soa-ttl status.
910 dns_zone_setzeronosoattl(dns_zone_t *zone, isc_boolean_t state);
912 * Set zero-no-soa-ttl status.
916 dns_zone_setchecknames(dns_zone_t *zone, dns_severity_t severity);
918 * Set the severity of name checking when loading a zone.
921 * \li 'zone' to be a valid zone.
925 dns_zone_getchecknames(dns_zone_t *zone);
927 * Return the current severity of name checking.
930 *\li 'zone' to be a valid zone.
934 dns_zone_setjournalsize(dns_zone_t *zone, isc_int32_t size);
936 * Sets the journal size for the zone.
939 *\li 'zone' to be a valid zone.
943 dns_zone_getjournalsize(dns_zone_t *zone);
945 * Return the journal size as set with a previous call to
946 * dns_zone_setjournalsize().
949 *\li 'zone' to be a valid zone.
953 dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
956 * Tell the zone that it has received a NOTIFY message from another
957 * server. This may cause some zone maintenance activity to occur.
960 *\li 'zone' to be a valid zone.
961 *\li '*from' to contain the address of the server from which 'msg'
963 *\li 'msg' a message with opcode NOTIFY and qr clear.
973 dns_zone_setmaxxfrin(dns_zone_t *zone, isc_uint32_t maxxfrin);
975 * Set the maximum time (in seconds) that a zone transfer in (AXFR/IXFR)
976 * of this zone will use before being aborted.
979 * \li 'zone' to be valid initialised zone.
983 dns_zone_getmaxxfrin(dns_zone_t *zone);
985 * Returns the maximum transfer time for this zone. This will be
986 * either the value set by the last call to dns_zone_setmaxxfrin() or
987 * the default value of 1 hour.
990 *\li 'zone' to be valid initialised zone.
994 dns_zone_setmaxxfrout(dns_zone_t *zone, isc_uint32_t maxxfrout);
996 * Set the maximum time (in seconds) that a zone transfer out (AXFR/IXFR)
997 * of this zone will use before being aborted.
1000 * \li 'zone' to be valid initialised zone.
1004 dns_zone_getmaxxfrout(dns_zone_t *zone);
1006 * Returns the maximum transfer time for this zone. This will be
1007 * either the value set by the last call to dns_zone_setmaxxfrout() or
1008 * the default value of 1 hour.
1011 *\li 'zone' to be valid initialised zone.
1015 dns_zone_setjournal(dns_zone_t *zone, const char *journal);
1017 * Sets the filename used for journaling updates / IXFR transfers.
1018 * The default journal name is set by dns_zone_setfile() to be
1019 * "file.jnl". If 'journal' is NULL, the zone will have no
1023 *\li 'zone' to be a valid zone.
1027 *\li #ISC_R_NOMEMORY
1031 dns_zone_getjournal(dns_zone_t *zone);
1033 * Returns the journal name associated with this zone.
1034 * If no journal has been set this will be NULL.
1037 *\li 'zone' to be valid initialised zone.
1041 dns_zone_gettype(dns_zone_t *zone);
1043 * Returns the type of the zone (master/slave/etc.)
1046 *\li 'zone' to be valid initialised zone.
1050 dns_zone_settask(dns_zone_t *zone, isc_task_t *task);
1052 * Give a zone a task to work with. Any current task will be detached.
1055 *\li 'zone' to be valid.
1056 *\li 'task' to be valid.
1060 dns_zone_gettask(dns_zone_t *zone, isc_task_t **target);
1062 * Attach '*target' to the zone's task.
1065 *\li 'zone' to be valid initialised zone.
1066 *\li 'zone' to have a task.
1067 *\li 'target' to be != NULL && '*target' == NULL.
1071 dns_zone_notify(dns_zone_t *zone);
1073 * Generate notify events for this zone.
1076 *\li 'zone' to be a valid zone.
1080 dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump);
1082 * Replace the database of "zone" with a new database "db".
1084 * If "dump" is ISC_TRUE, then the new zone contents are dumped
1085 * into to the zone's master file for persistence. When replacing
1086 * a zone database by one just loaded from a master file, set
1087 * "dump" to ISC_FALSE to avoid a redundant redump of the data just
1088 * loaded. Otherwise, it should be set to ISC_TRUE.
1090 * If the "diff-on-reload" option is enabled in the configuration file,
1091 * the differences between the old and the new database are added to the
1092 * journal file, and the master file dump is postponed.
1095 * \li 'zone' to be a valid zone.
1099 * \li DNS_R_BADZONE zone failed basic consistency checks:
1100 * * a single SOA must exist
1101 * * some NS records must exist.
1106 dns_zone_getidlein(dns_zone_t *zone);
1109 * \li 'zone' to be a valid zone.
1112 * \li number of seconds of idle time before we abort the transfer in.
1116 dns_zone_setidlein(dns_zone_t *zone, isc_uint32_t idlein);
1118 * \li Set the idle timeout for transfer the.
1119 * \li Zero set the default value, 1 hour.
1122 * \li 'zone' to be a valid zone.
1126 dns_zone_getidleout(dns_zone_t *zone);
1130 * \li 'zone' to be a valid zone.
1133 * \li number of seconds of idle time before we abort a transfer out.
1137 dns_zone_setidleout(dns_zone_t *zone, isc_uint32_t idleout);
1139 * \li Set the idle timeout for transfers out.
1140 * \li Zero set the default value, 1 hour.
1143 * \li 'zone' to be a valid zone.
1147 dns_zone_getssutable(dns_zone_t *zone, dns_ssutable_t **table);
1149 * Get the simple-secure-update policy table.
1152 * \li 'zone' to be a valid zone.
1156 dns_zone_setssutable(dns_zone_t *zone, dns_ssutable_t *table);
1158 * Set / clear the simple-secure-update policy table.
1161 * \li 'zone' to be a valid zone.
1165 dns_zone_getmctx(dns_zone_t *zone);
1167 * Get the memory context of a zone.
1170 * \li 'zone' to be a valid zone.
1174 dns_zone_getmgr(dns_zone_t *zone);
1176 * If 'zone' is managed return the zone manager otherwise NULL.
1179 * \li 'zone' to be a valid zone.
1183 dns_zone_setsigvalidityinterval(dns_zone_t *zone, isc_uint32_t interval);
1185 * Set the zone's SIG validity interval. This is the length of time
1186 * for which DNSSEC signatures created as a result of dynamic updates
1187 * to secure zones will remain valid, in seconds.
1190 * \li 'zone' to be a valid zone.
1194 dns_zone_getsigvalidityinterval(dns_zone_t *zone);
1196 * Get the zone's SIG validity interval.
1199 * \li 'zone' to be a valid zone.
1203 dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype);
1205 * Sets zone notify method to "notifytype"
1209 dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg,
1210 dns_updatecallback_t callback, void *callback_arg);
1212 * Forward 'msg' to each master in turn until we get an answer or we
1213 * have exhausted the list of masters. 'callback' will be called with
1214 * ISC_R_SUCCESS if we get an answer and the returned message will be
1215 * passed as 'answer_message', otherwise a non ISC_R_SUCCESS result code
1216 * will be passed and answer_message will be NULL. The callback function
1217 * is responsible for destroying 'answer_message'.
1218 * (callback)(callback_arg, result, answer_message);
1221 *\li 'zone' to be valid
1222 *\li 'msg' to be valid.
1223 *\li 'callback' to be non NULL.
1225 *\li #ISC_R_SUCCESS if the message has been forwarded,
1226 *\li #ISC_R_NOMEMORY
1231 dns_zone_next(dns_zone_t *zone, dns_zone_t **next);
1233 * Find the next zone in the list of managed zones.
1236 *\li 'zone' to be valid
1237 *\li The zone manager for the indicated zone MUST be locked
1238 * by the caller. This is not checked.
1239 *\li 'next' be non-NULL, and '*next' be NULL.
1242 *\li 'next' points to a valid zone (result ISC_R_SUCCESS) or to NULL
1243 * (result ISC_R_NOMORE).
1249 dns_zone_first(dns_zonemgr_t *zmgr, dns_zone_t **first);
1251 * Find the first zone in the list of managed zones.
1254 *\li 'zonemgr' to be valid
1255 *\li The zone manager for the indicated zone MUST be locked
1256 * by the caller. This is not checked.
1257 *\li 'first' be non-NULL, and '*first' be NULL
1260 *\li 'first' points to a valid zone (result ISC_R_SUCCESS) or to NULL
1261 * (result ISC_R_NOMORE).
1265 dns_zone_setkeydirectory(dns_zone_t *zone, const char *directory);
1267 * Sets the name of the directory where private keys used for
1268 * online signing of dynamic zones are found.
1271 *\li 'zone' to be a valid zone.
1274 *\li #ISC_R_NOMEMORY
1279 dns_zone_getkeydirectory(dns_zone_t *zone);
1281 * Gets the name of the directory where private keys used for
1282 * online signing of dynamic zones are found.
1285 *\li 'zone' to be valid initialised zone.
1288 * Pointer to null-terminated file name, or NULL.
1293 dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
1294 isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr,
1295 dns_zonemgr_t **zmgrp);
1297 * Create a zone manager.
1300 *\li 'mctx' to be a valid memory context.
1301 *\li 'taskmgr' to be a valid task manager.
1302 *\li 'timermgr' to be a valid timer manager.
1303 *\li 'zmgrp' to point to a NULL pointer.
1307 dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone);
1309 * Bring the zone under control of a zone manager.
1312 *\li 'zmgr' to be a valid zone manager.
1313 *\li 'zone' to be a valid zone.
1317 dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr);
1319 * Force zone maintenance of all zones managed by 'zmgr' at its
1320 * earliest convenience.
1324 dns_zonemgr_resumexfrs(dns_zonemgr_t *zmgr);
1326 * Attempt to start any stalled zone transfers.
1330 dns_zonemgr_shutdown(dns_zonemgr_t *zmgr);
1332 * Shut down the zone manager.
1335 *\li 'zmgr' to be a valid zone manager.
1339 dns_zonemgr_attach(dns_zonemgr_t *source, dns_zonemgr_t **target);
1341 * Attach '*target' to 'source' incrementing its external
1345 *\li 'zone' to be a valid zone.
1346 *\li 'target' to be non NULL and '*target' to be NULL.
1350 dns_zonemgr_detach(dns_zonemgr_t **zmgrp);
1352 * Detach from a zone manager.
1355 *\li '*zmgrp' is a valid, non-NULL zone manager pointer.
1358 *\li '*zmgrp' is NULL.
1362 dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone);
1364 * Release 'zone' from the managed by 'zmgr'. 'zmgr' is implicitly
1365 * detached from 'zone'.
1368 *\li 'zmgr' to be a valid zone manager.
1369 *\li 'zone' to be a valid zone.
1370 *\li 'zmgr' == 'zone->zmgr'
1373 *\li 'zone->zmgr' == NULL;
1377 dns_zonemgr_settransfersin(dns_zonemgr_t *zmgr, isc_uint32_t value);
1379 * Set the maximum number of simultaneous transfers in allowed by
1383 *\li 'zmgr' to be a valid zone manager.
1387 dns_zonemgr_getttransfersin(dns_zonemgr_t *zmgr);
1389 * Return the maximum number of simultaneous transfers in allowed.
1392 *\li 'zmgr' to be a valid zone manager.
1396 dns_zonemgr_settransfersperns(dns_zonemgr_t *zmgr, isc_uint32_t value);
1398 * Set the number of zone transfers allowed per nameserver.
1401 *\li 'zmgr' to be a valid zone manager
1405 dns_zonemgr_getttransfersperns(dns_zonemgr_t *zmgr);
1407 * Return the number of transfers allowed per nameserver.
1410 *\li 'zmgr' to be a valid zone manager.
1414 dns_zonemgr_setiolimit(dns_zonemgr_t *zmgr, isc_uint32_t iolimit);
1416 * Set the number of simultaneous file descriptors available for
1417 * reading and writing masterfiles.
1420 *\li 'zmgr' to be a valid zone manager.
1421 *\li 'iolimit' to be positive.
1425 dns_zonemgr_getiolimit(dns_zonemgr_t *zmgr);
1427 * Get the number of simultaneous file descriptors available for
1428 * reading and writing masterfiles.
1431 *\li 'zmgr' to be a valid zone manager.
1435 dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value);
1437 * Set the number of SOA queries sent per second.
1440 *\li 'zmgr' to be a valid zone manager
1444 dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr);
1446 * Return the number of SOA queries sent per second.
1449 *\li 'zmgr' to be a valid zone manager.
1453 dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state);
1455 * Returns the number of zones in the specified state.
1458 *\li 'zmgr' to be a valid zone manager.
1459 *\li 'state' to be a valid DNS_ZONESTATE_ constant.
1463 dns_zonemgr_unreachableadd(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote,
1464 isc_sockaddr_t *local, isc_time_t *now);
1466 * Add the pair of addresses to the unreachable cache.
1469 *\li 'zmgr' to be a valid zone manager.
1470 *\li 'remote' to be a valid sockaddr.
1471 *\li 'local' to be a valid sockaddr.
1475 dns_zone_forcereload(dns_zone_t *zone);
1477 * Force a reload of specified zone.
1480 *\li 'zone' to be a valid zone.
1484 dns_zone_isforced(dns_zone_t *zone);
1486 * Check if the zone is waiting a forced reload.
1489 * \li 'zone' to be a valid zone.
1493 dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on);
1495 * This function is obsoleted by dns_zone_setrequeststats().
1499 dns_zone_getstatscounters(dns_zone_t *zone);
1501 * This function is obsoleted by dns_zone_getrequeststats().
1505 dns_zone_setstats(dns_zone_t *zone, isc_stats_t *stats);
1507 * Set a general zone-maintenance statistics set 'stats' for 'zone'. This
1508 * function is expected to be called only on zone creation (when necessary).
1509 * Once installed, it cannot be removed or replaced. Also, there is no
1510 * interface to get the installed stats from the zone; the caller must keep the
1511 * stats to reference (e.g. dump) it later.
1514 * \li 'zone' to be a valid zone and does not have a statistics set already
1517 *\li stats is a valid statistics supporting zone statistics counters
1518 * (see dns/stats.h).
1522 dns_zone_setrequeststats(dns_zone_t *zone, isc_stats_t *stats);
1524 * Set an additional statistics set to zone. It is attached in the zone
1525 * but is not counted in the zone module; only the caller updates the counters.
1528 * \li 'zone' to be a valid zone.
1530 *\li stats is a valid statistics.
1534 dns_zone_getrequeststats(dns_zone_t *zone);
1536 * Get the additional statistics for zone, if one is installed.
1539 * \li 'zone' to be a valid zone.
1542 * \li when available, a pointer to the statistics set installed in zone;
1547 dns_zone_dialup(dns_zone_t *zone);
1549 * Perform dialup-time maintenance on 'zone'.
1553 dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup);
1555 * Set the dialup type of 'zone' to 'dialup'.
1558 * \li 'zone' to be valid initialised zone.
1559 *\li 'dialup' to be a valid dialup type.
1563 dns_zone_log(dns_zone_t *zone, int level, const char *msg, ...)
1564 ISC_FORMAT_PRINTF(3, 4);
1566 * Log the message 'msg...' at 'level', including text that identifies
1567 * the message as applying to 'zone'.
1571 dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category, int level,
1572 const char *msg, ...) ISC_FORMAT_PRINTF(4, 5);
1574 * Log the message 'msg...' at 'level', including text that identifies
1575 * the message as applying to 'zone'.
1579 dns_zone_name(dns_zone_t *zone, char *buf, size_t len);
1581 * Return the name of the zone with class and view.
1584 *\li 'zone' to be valid.
1585 *\li 'buf' to be non NULL.
1589 dns_zone_checknames(dns_zone_t *zone, dns_name_t *name, dns_rdata_t *rdata);
1591 * Check if this record meets the check-names policy.
1594 * 'zone' to be valid.
1595 * 'name' to be valid.
1596 * 'rdata' to be valid.
1599 * DNS_R_SUCCESS passed checks.
1600 * DNS_R_BADOWNERNAME failed ownername checks.
1601 * DNS_R_BADNAME failed rdata checks.
1605 dns_zone_setacache(dns_zone_t *zone, dns_acache_t *acache);
1607 * Associate the zone with an additional cache.
1610 * 'zone' to be a valid zone.
1611 * 'acache' to be a non NULL pointer.
1614 * 'zone' will have a reference to 'acache'
1618 dns_zone_setcheckmx(dns_zone_t *zone, dns_checkmxfunc_t checkmx);
1620 * Set the post load integrity callback function 'checkmx'.
1621 * 'checkmx' will be called if the MX is not within the zone.
1624 * 'zone' to be a valid zone.
1628 dns_zone_setchecksrv(dns_zone_t *zone, dns_checkmxfunc_t checksrv);
1630 * Set the post load integrity callback function 'checksrv'.
1631 * 'checksrv' will be called if the SRV TARGET is not within the zone.
1634 * 'zone' to be a valid zone.
1638 dns_zone_setcheckns(dns_zone_t *zone, dns_checknsfunc_t checkns);
1640 * Set the post load integrity callback function 'checkmx'.
1641 * 'checkmx' will be called if the MX is not within the zone.
1644 * 'zone' to be a valid zone.
1648 dns_zone_setnotifydelay(dns_zone_t *zone, isc_uint32_t delay);
1650 * Set the minimum delay between sets of notify messages.
1653 * 'zone' to be valid.
1657 dns_zone_getnotifydelay(dns_zone_t *zone);
1659 * Get the minimum delay between sets of notify messages.
1662 * 'zone' to be valid.
1666 dns_zone_setisself(dns_zone_t *zone, dns_isselffunc_t isself, void *arg);
1668 * Set the isself callback function and argument.
1671 * isself(dns_view_t *myview, dns_tsigkey_t *mykey, isc_netaddr_t *srcaddr,
1672 * isc_netaddr_t *destaddr, dns_rdataclass_t rdclass, void *arg);
1674 * 'isself' returns ISC_TRUE if a non-recursive query from 'srcaddr' to
1675 * 'destaddr' with optional key 'mykey' for class 'rdclass' would be
1676 * delivered to 'myview'.
1681 #endif /* DNS_ZONE_H */