"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/dns/include/dns/zone.h" (7 Sep 2020, 60863 Bytes) of package /linux/misc/dns/bind9/9.11.23/bind-9.11.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "zone.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 9.17.2_vs_9.17.3.

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