* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
#include <isc/formatcheck.h>
#include <dns/masterdump.h>
#include <dns/rdatastruct.h>
#define DNS_ZONEOPT_SERVERS 0x00000001U /*%< perform server checks */
#define DNS_ZONEOPT_PARENTS 0x00000002U /*%< perform parent checks */
#define DNS_ZONEOPT_CHILDREN 0x00000004U /*%< perform child checks */
#define DNS_ZONEOPT_NOTIFY 0x00000008U /*%< perform NOTIFY */
#define DNS_ZONEOPT_MANYERRORS 0x00000010U /*%< return many errors on load */
#define DNS_ZONEOPT_IXFRFROMDIFFS 0x00000020U /*%< calculate differences */
#define DNS_ZONEOPT_NOMERGE 0x00000040U /*%< don't merge journal */
#define DNS_ZONEOPT_CHECKNS 0x00000080U /*%< check if NS's are addresses */
#define DNS_ZONEOPT_FATALNS 0x00000100U /*%< DNS_ZONEOPT_CHECKNS is fatal */
#define DNS_ZONEOPT_MULTIMASTER 0x00000200U /*%< this zone has multiple masters */
#define DNS_ZONEOPT_USEALTXFRSRC 0x00000400U /*%< use alternate transfer sources */
#define DNS_ZONEOPT_CHECKNAMES 0x00000800U /*%< check-names */
#define DNS_ZONEOPT_CHECKNAMESFAIL 0x00001000U /*%< fatal check-name failures */
#define DNS_ZONEOPT_CHECKWILDCARD 0x00002000U /*%< check for internal wildcards */
#define DNS_ZONEOPT_CHECKMX 0x00004000U /*%< check-mx */
#define DNS_ZONEOPT_CHECKMXFAIL 0x00008000U /*%< fatal check-mx failures */
#define DNS_ZONEOPT_CHECKINTEGRITY 0x00010000U /*%< perform integrity checks */
#define DNS_ZONEOPT_CHECKSIBLING 0x00020000U /*%< perform sibling glue checks */
#define DNS_ZONEOPT_NOCHECKNS 0x00040000U /*%< disable IN NS address checks */
#define DNS_ZONEOPT_WARNMXCNAME 0x00080000U /*%< warn on MX CNAME check */
#define DNS_ZONEOPT_IGNOREMXCNAME 0x00100000U /*%< ignore MX CNAME check */
#define DNS_ZONEOPT_WARNSRVCNAME 0x00200000U /*%< warn on SRV CNAME check */
#define DNS_ZONEOPT_IGNORESRVCNAME 0x00400000U /*%< ignore SRV CNAME check */
#define DNS_ZONEOPT_UPDATECHECKKSK 0x00800000U /*%< check dnskey KSK flag */
#define DNS_ZONEOPT_TRYTCPREFRESH 0x01000000U /*%< try tcp refresh on udp failure */
#define DNS_ZONEOPT_NOTIFYTOSOA 0x02000000U /*%< Notify the SOA MNAME */
#define DNS_ZONEOPT_NSEC3TESTZONE 0x04000000U /*%< nsec3-test-zone */
#define DNS_ZONEOPT_SECURETOINSECURE 0x08000000U /*%< dnssec-secure-to-insecure */
#define DNS_ZONEOPT_DNSKEYKSKONLY 0x10000000U /*%< dnssec-dnskey-kskonly */
#define DNS_ZONEOPT_CHECKDUPRR 0x20000000U /*%< check-dup-records */
#define DNS_ZONEOPT_CHECKDUPRRFAIL 0x40000000U /*%< fatal check-dup-records failures */
#define DNS_ZONEOPT_CHECKSPF 0x80000000U /*%< check SPF records */
* The following zone options are shifted left into the
* higher-order 32 bits of the options.
#define DNS_ZONEOPT2_CHECKTTL 0x00000001U /*%< check max-zone-ttl */
#define DNS_ZONEOPT2_AUTOEMPTY 0x00000002U /*%< automatic empty zone */
* Nominum specific options build down.
#define DNS_ZONEOPT_NOTIFYFORWARD 0x80000000U /* forward notify to master */
#endif /* NOMINUM_PUBLIC */
* Zone key maintenance options
#define DNS_ZONEKEY_ALLOW 0x00000001U /*%< fetch keys on command */
#define DNS_ZONEKEY_MAINTAIN 0x00000002U /*%< publish/sign on schedule */
#define DNS_ZONEKEY_CREATE 0x00000004U /*%< make keys when needed */
#define DNS_ZONEKEY_FULLSIGN 0x00000008U /*%< roll to new keys immediately */
#define DNS_ZONEKEY_NORESIGN 0x00000010U /*%< no automatic resigning */
#ifndef DNS_ZONE_MINREFRESH
#define DNS_ZONE_MINREFRESH 300 /*%< 5 minutes */
#ifndef DNS_ZONE_MAXREFRESH
#define DNS_ZONE_MAXREFRESH 2419200 /*%< 4 weeks */
#ifndef DNS_ZONE_DEFAULTREFRESH
#define DNS_ZONE_DEFAULTREFRESH 3600 /*%< 1 hour */
#ifndef DNS_ZONE_MINRETRY
#define DNS_ZONE_MINRETRY 300 /*%< 5 minutes */
#ifndef DNS_ZONE_MAXRETRY
#define DNS_ZONE_MAXRETRY 1209600 /*%< 2 weeks */
#ifndef DNS_ZONE_DEFAULTRETRY
#define DNS_ZONE_DEFAULTRETRY 60 /*%< 1 minute, subject to
#define DNS_ZONESTATE_XFERRUNNING 1
#define DNS_ZONESTATE_XFERDEFERRED 2
#define DNS_ZONESTATE_SOAQUERY 3
#define DNS_ZONESTATE_ANY 4
#define DNS_ZONESTATE_AUTOMATIC 5
dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx);
* Creates a new empty zone and attach '*zonep' to it.
*\li 'zonep' to point to a NULL pointer.
*\li 'mctx' to be a valid memory context.
*\li '*zonep' refers to a valid zone.
dns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass);
* Sets the class of a zone. This operation can only be performed
*\li 'zone' to be a valid zone.
*\li dns_zone_setclass() not to have been called since the zone was
*\li 'rdclass' != dns_rdataclass_none.
dns_zone_getclass(dns_zone_t *zone);
* Returns the current zone class.
*\li 'zone' to be a valid zone.
dns_zone_getserial2(dns_zone_t *zone, uint32_t *serialp);
dns_zone_getserial(dns_zone_t *zone);
* Returns the current serial number of the zone. On success, the SOA
* serial of the zone will be copied into '*serialp'.
* dns_zone_getserial() cannot catch failure cases and is deprecated by
*\li 'zone' to be a valid zone.
*\li 'serialp' to be non NULL
*\li #DNS_R_NOTLOADED zone DB is not loaded
dns_zone_settype(dns_zone_t *zone, dns_zonetype_t type);
* Sets the zone type. This operation can only be performed once on
*\li 'zone' to be a valid zone.
*\li dns_zone_settype() not to have been called since the zone was
*\li 'type' != dns_zone_none
dns_zone_setview(dns_zone_t *zone, dns_view_t *view);
* Associate the zone with a view.
*\li 'zone' to be a valid zone.
dns_zone_getview(dns_zone_t *zone);
* Returns the zone's associated view.
*\li 'zone' to be a valid zone.
dns_zone_setviewcommit(dns_zone_t *zone);
* Commit the previous view saved internally via dns_zone_setview().
*\li 'zone' to be a valid zone.
dns_zone_setviewrevert(dns_zone_t *zone);
* Revert the most recent dns_zone_setview() on this zone,
* restoring the previous view.
*\li 'zone' to be a valid zone.
dns_zone_setorigin(dns_zone_t *zone, const dns_name_t *origin);
* Sets the zones origin to 'origin'.
*\li 'zone' to be a valid zone.
*\li 'origin' to be non NULL.
dns_zone_getorigin(dns_zone_t *zone);
* Returns the value of the origin.
*\li 'zone' to be a valid zone.
dns_zone_setfile(dns_zone_t *zone, const char *file);
dns_zone_setfile2(dns_zone_t *zone, const char *file,
dns_masterformat_t format);
dns_zone_setfile3(dns_zone_t *zone, const char *file,
dns_masterformat_t format, const dns_master_style_t *style);
* Sets the name of the master file in the format of 'format' from which
* the zone loads its database to 'file'.
* For zones that have no associated master file, 'file' will be NULL.
* For zones with persistent databases, the file name
* dns_zone_setfile() is a backward-compatible form of
* dns_zone_setfile2(), which always specifies the
* dns_masterformat_text (RFC1035) format.
* dns_zone_setfile2() is a backward-compatible form of
* dns_zone_setfile3(), which also specifies the style
* that should be used if a zone using the 'text'
* masterformat is ever dumped.
*\li 'zone' to be a valid zone.
dns_zone_getfile(dns_zone_t *zone);
* Gets the name of the zone's master file, if any.
*\li 'zone' to be valid initialised zone.
*\li Pointer to null-terminated file name, or NULL.
dns_zone_setmaxrecords(dns_zone_t *zone, uint32_t records);
* Sets the maximum number of records permitted in a zone.
*\li 'zone' to be valid initialised zone.
dns_zone_getmaxrecords(dns_zone_t *zone);
* Gets the maximum number of records permitted in a zone.
*\li 'zone' to be valid initialised zone.
*\li uint32_t maxrecords.
dns_zone_setmaxttl(dns_zone_t *zone, uint32_t maxttl);
* Sets the max ttl of the zone.
*\li 'zone' to be valid initialised zone.
dns_zone_getmaxttl(dns_zone_t *zone);
* Gets the max ttl of the zone.
*\li 'zone' to be valid initialised zone.
dns_zone_load(dns_zone_t *zone);
dns_zone_loadnew(dns_zone_t *zone);
dns_zone_loadandthaw(dns_zone_t *zone);
* Cause the database to be loaded from its backing store.
* Confirm that the minimum requirements for the zone type are
* met, otherwise DNS_R_BADZONE is returned.
* dns_zone_loadnew() only loads zones that are not yet loaded.
* dns_zone_load() also loads zones that are already loaded and
* and whose master file has changed since the last load.
* dns_zone_loadandthaw() is similar to dns_zone_load() but will
* also re-enable DNS UPDATEs when the load completes.
*\li 'zone' to be a valid zone.
*\li DNS_R_CONTINUE Incremental load has been queued.
*\li DNS_R_UPTODATE The zone has already been loaded based on
* file system timestamps.
*\li Any result value from dns_db_load().
dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg);
dns_zone_asyncload2(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg,
* Cause the database to be loaded from its backing store asynchronously.
* Other zone maintenance functions are suspended until this is complete.
* When finished, 'done' is called to inform the caller, with 'arg' as
* its first argument and 'zone' as its second. (Normally, 'arg' is
* expected to point to the zone table but is left undefined for testing
*\li 'zone' to be a valid zone.
*\li #ISC_R_ALREADYRUNNING
dns__zone_loadpending(dns_zone_t *zone);
* Indicates whether the zone is waiting to be loaded asynchronously.
* (Not currently intended for use outside of this module and associated
dns_zone_attach(dns_zone_t *source, dns_zone_t **target);
* Attach '*target' to 'source' incrementing its external
*\li 'zone' to be a valid zone.
*\li 'target' to be non NULL and '*target' to be NULL.
dns_zone_detach(dns_zone_t **zonep);
* Detach from a zone decrementing its external reference count.
* If this was the last external reference to the zone it will be
* shut down and eventually freed.
*\li 'zonep' to point to a valid zone.
dns_zone_iattach(dns_zone_t *source, dns_zone_t **target);
* Attach '*target' to 'source' incrementing its internal
* reference count. This is intended for use by operations
* such as zone transfers that need to prevent the zone
* object from being freed but not from shutting down.
*\li The caller is running in the context of the zone's task.
*\li 'zone' to be a valid zone.
*\li 'target' to be non NULL and '*target' to be NULL.
dns_zone_idetach(dns_zone_t **zonep);
* Detach from a zone decrementing its internal reference count.
* If there are no more internal or external references to the
* zone, it will be freed.
*\li The caller is running in the context of the zone's task.
*\li 'zonep' to point to a valid zone.
dns_zone_setflag(dns_zone_t *zone, unsigned int flags, bool value);
* Sets ('value' == 'true') / clears ('value' == 'IS_FALSE')
* zone flags. Valid flag bits are DNS_ZONE_F_*.
*\li 'zone' to be a valid zone.
dns_zone_getdb(dns_zone_t *zone, dns_db_t **dbp);
* Attach '*dbp' to the database to if it exists otherwise
* return DNS_R_NOTLOADED.