home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / dns / zone.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-09-17  |  36.5 KB  |  1,587 lines

  1. /*
  2.  * Copyright (C) 2004-2006  Internet Systems Consortium, Inc. ("ISC")
  3.  * Copyright (C) 1999-2003  Internet Software Consortium.
  4.  *
  5.  * Permission to use, copy, modify, and distribute this software for any
  6.  * purpose with or without fee is hereby granted, provided that the above
  7.  * copyright notice and this permission notice appear in all copies.
  8.  *
  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.
  16.  */
  17.  
  18. /* $Id: zone.h,v 1.126.18.19 2006/08/01 03:45:21 marka Exp $ */
  19.  
  20. #ifndef DNS_ZONE_H
  21. #define DNS_ZONE_H 1
  22.  
  23. /*! \file */
  24.  
  25. /***
  26.  ***    Imports
  27.  ***/
  28.  
  29. #include <stdio.h>
  30.  
  31. #include <isc/formatcheck.h>
  32. #include <isc/lang.h>
  33. #include <isc/rwlock.h>
  34.  
  35. #include <dns/masterdump.h>
  36. #include <dns/types.h>
  37.  
  38. typedef enum {
  39.     dns_zone_none,
  40.     dns_zone_master,
  41.     dns_zone_slave,
  42.     dns_zone_stub
  43. } dns_zonetype_t;
  44.  
  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.  
  70. #ifndef NOMINUM_PUBLIC
  71. /*
  72.  * Nominum specific options build down.
  73.  */
  74. #define DNS_ZONEOPT_NOTIFYFORWARD 0x80000000U    /* forward notify to master */
  75. #endif /* NOMINUM_PUBLIC */
  76.  
  77. #ifndef DNS_ZONE_MINREFRESH
  78. #define DNS_ZONE_MINREFRESH            300    /*%< 5 minutes */
  79. #endif
  80. #ifndef DNS_ZONE_MAXREFRESH
  81. #define DNS_ZONE_MAXREFRESH        2419200    /*%< 4 weeks */
  82. #endif
  83. #ifndef DNS_ZONE_DEFAULTREFRESH
  84. #define DNS_ZONE_DEFAULTREFRESH           3600    /*%< 1 hour */
  85. #endif
  86. #ifndef DNS_ZONE_MINRETRY
  87. #define DNS_ZONE_MINRETRY            300    /*%< 5 minutes */
  88. #endif
  89. #ifndef DNS_ZONE_MAXRETRY
  90. #define DNS_ZONE_MAXRETRY        1209600    /*%< 2 weeks */
  91. #endif
  92. #ifndef DNS_ZONE_DEFAULTRETRY
  93. #define DNS_ZONE_DEFAULTRETRY             60    /*%< 1 minute, subject to
  94.                            exponential backoff */
  95. #endif
  96.  
  97. #define DNS_ZONESTATE_XFERRUNNING    1
  98. #define DNS_ZONESTATE_XFERDEFERRED    2
  99. #define DNS_ZONESTATE_SOAQUERY        3
  100. #define DNS_ZONESTATE_ANY        4
  101.  
  102. ISC_LANG_BEGINDECLS
  103.  
  104. /***
  105.  ***    Functions
  106.  ***/
  107.  
  108. isc_result_t
  109. dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx);
  110. /*%<
  111.  *    Creates a new empty zone and attach '*zonep' to it.
  112.  *
  113.  * Requires:
  114.  *\li    'zonep' to point to a NULL pointer.
  115.  *\li    'mctx' to be a valid memory context.
  116.  *
  117.  * Ensures:
  118.  *\li    '*zonep' refers to a valid zone.
  119.  *
  120.  * Returns:
  121.  *\li    #ISC_R_SUCCESS
  122.  *\li    #ISC_R_NOMEMORY
  123.  *\li    #ISC_R_UNEXPECTED
  124.  */
  125.  
  126. void
  127. dns_zone_setclass(dns_zone_t *zone, dns_rdataclass_t rdclass);
  128. /*%<
  129.  *    Sets the class of a zone.  This operation can only be performed
  130.  *    once on a zone.
  131.  *
  132.  * Require:
  133.  *\li    'zone' to be a valid zone.
  134.  *\li    dns_zone_setclass() not to have been called since the zone was
  135.  *    created.
  136.  *\li    'rdclass' != dns_rdataclass_none.
  137.  */
  138.  
  139. dns_rdataclass_t
  140. dns_zone_getclass(dns_zone_t *zone);
  141. /*%<
  142.  *    Returns the current zone class.
  143.  *
  144.  * Requires:
  145.  *\li    'zone' to be a valid zone.
  146.  */
  147.  
  148. void
  149. dns_zone_settype(dns_zone_t *zone, dns_zonetype_t type);
  150. /*%<
  151.  *    Sets the zone type. This operation can only be performed once on
  152.  *    a zone.
  153.  *
  154.  * Requires:
  155.  *\li    'zone' to be a valid zone.
  156.  *\li    dns_zone_settype() not to have been called since the zone was
  157.  *    created.
  158.  *\li    'type' != dns_zone_none
  159.  */
  160.  
  161. void
  162. dns_zone_setview(dns_zone_t *zone, dns_view_t *view);
  163. /*%<
  164.  *    Associate the zone with a view.
  165.  *
  166.  * Require:
  167.  *\li    'zone' to be a valid zone.
  168.  */
  169.  
  170. dns_view_t *
  171. dns_zone_getview(dns_zone_t *zone);
  172. /*%<
  173.  *    Returns the zone's associated view.
  174.  *
  175.  * Requires:
  176.  *\li    'zone' to be a valid zone.
  177.  */
  178.  
  179. isc_result_t
  180. dns_zone_setorigin(dns_zone_t *zone, const dns_name_t *origin);
  181. /*%<
  182.  *    Sets the zones origin to 'origin'.
  183.  *
  184.  * Require:
  185.  *\li    'zone' to be a valid zone.
  186.  *\li    'origin' to be non NULL.
  187.  *
  188.  * Returns:
  189.  *\li    #ISC_R_SUCCESS
  190.  *\li     #ISC_R_NOMEMORY
  191.  */
  192.  
  193. dns_name_t *
  194. dns_zone_getorigin(dns_zone_t *zone);
  195. /*%<
  196.  *    Returns the value of the origin.
  197.  *
  198.  * Require:
  199.  *\li    'zone' to be a valid zone.
  200.  */
  201.  
  202. isc_result_t
  203. dns_zone_setfile(dns_zone_t *zone, const char *file);
  204.  
  205. isc_result_t
  206. dns_zone_setfile2(dns_zone_t *zone, const char *file,
  207.           dns_masterformat_t format);
  208. /*%<
  209.  *    Sets the name of the master file in the format of 'format' from which
  210.  *    the zone loads its database to 'file'.
  211.  *
  212.  *    For zones that have no associated master file, 'file' will be NULL.
  213.  *
  214.  *    For zones with persistent databases, the file name
  215.  *    setting is ignored.
  216.  *
  217.  *    dns_zone_setfile() is a backward-compatible form of
  218.  *    dns_zone_setfile2(), which always specifies the
  219.  *    dns_masterformat_text (RFC1035) format.
  220.  *
  221.  * Require:
  222.  *\li    'zone' to be a valid zone.
  223.  *
  224.  * Returns:
  225.  *\li    #ISC_R_NOMEMORY
  226.  *\li    #ISC_R_SUCCESS
  227.  */
  228.  
  229. const char *
  230. dns_zone_getfile(dns_zone_t *zone);
  231. /*%<
  232.  *     Gets the name of the zone's master file, if any.
  233.  *
  234.  * Requires:
  235.  *\li    'zone' to be valid initialised zone.
  236.  *
  237.  * Returns:
  238.  *\li    Pointer to null-terminated file name, or NULL.
  239.  */
  240.  
  241. isc_result_t
  242. dns_zone_load(dns_zone_t *zone);
  243.  
  244. isc_result_t
  245. dns_zone_loadnew(dns_zone_t *zone);
  246. /*%<
  247.  *    Cause the database to be loaded from its backing store.
  248.  *    Confirm that the minimum requirements for the zone type are
  249.  *    met, otherwise DNS_R_BADZONE is returned.
  250.  *
  251.  *    dns_zone_loadnew() only loads zones that are not yet loaded.
  252.  *    dns_zone_load() also loads zones that are already loaded and
  253.  *    and whose master file has changed since the last load.
  254.  *
  255.  * Require:
  256.  *\li    'zone' to be a valid zone.
  257.  *
  258.  * Returns:
  259.  *\li    #ISC_R_UNEXPECTED
  260.  *\li    #ISC_R_SUCCESS
  261.  *\li    DNS_R_CONTINUE      Incremental load has been queued.
  262.  *\li    DNS_R_UPTODATE      The zone has already been loaded based on
  263.  *              file system timestamps.
  264.  *\li    DNS_R_BADZONE
  265.  *\li    Any result value from dns_db_load().
  266.  */
  267.  
  268. void
  269. dns_zone_attach(dns_zone_t *source, dns_zone_t **target);
  270. /*%<
  271.  *    Attach '*target' to 'source' incrementing its external
  272.  *     reference count.
  273.  *
  274.  * Require:
  275.  *\li    'zone' to be a valid zone.
  276.  *\li    'target' to be non NULL and '*target' to be NULL.
  277.  */
  278.  
  279. void
  280. dns_zone_detach(dns_zone_t **zonep);
  281. /*%<
  282.  *    Detach from a zone decrementing its external reference count.
  283.  *    If this was the last external reference to the zone it will be
  284.  *     shut down and eventually freed.
  285.  *
  286.  * Require:
  287.  *\li    'zonep' to point to a valid zone.
  288.  */
  289.  
  290. void
  291. dns_zone_iattach(dns_zone_t *source, dns_zone_t **target);
  292. /*%<
  293.  *    Attach '*target' to 'source' incrementing its internal
  294.  *     reference count.  This is intended for use by operations
  295.  *     such as zone transfers that need to prevent the zone
  296.  *     object from being freed but not from shutting down.
  297.  *
  298.  * Require:
  299.  *\li    The caller is running in the context of the zone's task.
  300.  *\li    'zone' to be a valid zone.
  301.  *\li    'target' to be non NULL and '*target' to be NULL.
  302.  */
  303.  
  304. void
  305. dns_zone_idetach(dns_zone_t **zonep);
  306. /*%<
  307.  *    Detach from a zone decrementing its internal reference count.
  308.  *    If there are no more internal or external references to the
  309.  *     zone, it will be freed.
  310.  *
  311.  * Require:
  312.  *\li    The caller is running in the context of the zone's task.
  313.  *\li    'zonep' to point to a valid zone.
  314.  */
  315.  
  316. void
  317. dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value);
  318. /*%<
  319.  *    Sets ('value' == 'ISC_TRUE') / clears ('value' == 'IS_FALSE')
  320.  *    zone flags.  Valid flag bits are DNS_ZONE_F_*.
  321.  *
  322.  * Requires
  323.  *\li    'zone' to be a valid zone.
  324.  */
  325.  
  326. isc_result_t
  327. dns_zone_getdb(dns_zone_t *zone, dns_db_t **dbp);
  328. /*%<
  329.  *     Attach '*dbp' to the database to if it exists otherwise
  330.  *    return DNS_R_NOTLOADED.
  331.  *
  332.  * Require:
  333.  *\li    'zone' to be a valid zone.
  334.  *\li    'dbp' to be != NULL && '*dbp' == NULL.
  335.  *
  336.  * Returns:
  337.  *\li    #ISC_R_SUCCESS
  338.  *\li    DNS_R_NOTLOADED
  339.  */
  340.  
  341. isc_result_t
  342. dns_zone_setdbtype(dns_zone_t *zone,
  343.            unsigned int dbargc, const char * const *dbargv);
  344. /*%<
  345.  *    Sets the database type to dbargv[0] and database arguments
  346.  *    to subsequent dbargv elements.
  347.  *    'db_type' is not checked to see if it is a valid database type.
  348.  *
  349.  * Require:
  350.  *\li    'zone' to be a valid zone.
  351.  *\li    'database' to be non NULL.
  352.  *\li    'dbargc' to be >= 1
  353.  *\li    'dbargv' to point to dbargc NULL-terminated strings
  354.  *
  355.  * Returns:
  356.  *\li    #ISC_R_NOMEMORY
  357.  *\li    #ISC_R_SUCCESS
  358.  */
  359.  
  360. isc_result_t
  361. dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx);
  362. /*%<
  363.  *    Returns the current dbtype.  isc_mem_free() should be used
  364.  *     to free 'argv' after use.
  365.  *
  366.  * Require:
  367.  *\li    'zone' to be a valid zone.
  368.  *\li    'argv' to be non NULL and *argv to be NULL.
  369.  *\li    'mctx' to be valid.
  370.  *
  371.  * Returns:
  372.  *\li    #ISC_R_NOMEMORY
  373.  *\li    #ISC_R_SUCCESS
  374.  */
  375.  
  376. void
  377. dns_zone_markdirty(dns_zone_t *zone);
  378. /*%<
  379.  *    Mark a zone as 'dirty'.
  380.  *
  381.  * Require:
  382.  *\li    'zone' to be a valid zone.
  383.  */
  384.  
  385. void
  386. dns_zone_expire(dns_zone_t *zone);
  387. /*%<
  388.  *    Mark the zone as expired.  If the zone requires dumping cause it to
  389.  *    be initiated.  Set the refresh and retry intervals to there default
  390.  *    values and unload the zone.
  391.  *
  392.  * Require
  393.  *\li    'zone' to be a valid zone.
  394.  */
  395.  
  396. void
  397. dns_zone_refresh(dns_zone_t *zone);
  398. /*%<
  399.  *    Initiate zone up to date checks.  The zone must already be being
  400.  *    managed.
  401.  *
  402.  * Require
  403.  *\li    'zone' to be a valid zone.
  404.  */
  405.  
  406. isc_result_t
  407. dns_zone_flush(dns_zone_t *zone);
  408. /*%<
  409.  *    Write the zone to database if there are uncommited changes.
  410.  *
  411.  * Require:
  412.  *\li    'zone' to be a valid zone.
  413.  */
  414.  
  415. isc_result_t
  416. dns_zone_dump(dns_zone_t *zone);
  417. /*%<
  418.  *    Write the zone to database.
  419.  *
  420.  * Require:
  421.  *\li    'zone' to be a valid zone.
  422.  */
  423.  
  424. isc_result_t
  425. dns_zone_dumptostream(dns_zone_t *zone, FILE *fd);
  426.  
  427. isc_result_t
  428. dns_zone_dumptostream2(dns_zone_t *zone, FILE *fd, dns_masterformat_t format,
  429.                const dns_master_style_t *style);
  430. /*%<
  431.  *    Write the zone to stream 'fd' in the specified 'format'.
  432.  *    If the 'format' is dns_masterformat_text (RFC1035), 'style' also
  433.  *    specifies the file style (e.g., &dns_master_style_default).
  434.  *
  435.  *    dns_zone_dumptostream() is a backward-compatible form of
  436.  *    dns_zone_dumptostream2(), which always uses the dns_masterformat_text
  437.  *    format and the dns_master_style_default style.
  438.  *
  439.  *    Note that dns_zone_dumptostream2() is the most flexible form.  It
  440.  *    can also provide the functionality of dns_zone_fulldumptostream().
  441.  *
  442.  * Require:
  443.  *\li    'zone' to be a valid zone.
  444.  *\li    'fd' to be a stream open for writing.
  445.  */
  446.  
  447. isc_result_t
  448. dns_zone_fulldumptostream(dns_zone_t *zone, FILE *fd);
  449. /*%<
  450.  *    The same as dns_zone_dumptostream, but dumps the zone with
  451.  *    different dump settings (dns_master_style_full).
  452.  *
  453.  * Require:
  454.  *\li    'zone' to be a valid zone.
  455.  *\li    'fd' to be a stream open for writing.
  456.  */
  457.  
  458. void
  459. dns_zone_maintenance(dns_zone_t *zone);
  460. /*%<
  461.  *    Perform regular maintenace on the zone.  This is called as a
  462.  *    result of a zone being managed.
  463.  *
  464.  * Require
  465.  *\li    'zone' to be a valid zone.
  466.  */
  467.  
  468. isc_result_t
  469. dns_zone_setmasters(dns_zone_t *zone, const isc_sockaddr_t *masters,
  470.             isc_uint32_t count);
  471. isc_result_t
  472. dns_zone_setmasterswithkeys(dns_zone_t *zone,
  473.                 const isc_sockaddr_t *masters,
  474.                 dns_name_t **keynames,
  475.                 isc_uint32_t count);
  476. /*%<
  477.  *    Set the list of master servers for the zone.
  478.  *
  479.  * Require:
  480.  *\li    'zone' to be a valid zone.
  481.  *\li    'masters' array of isc_sockaddr_t with port set or NULL.
  482.  *\li    'count' the number of masters.
  483.  *\li      'keynames' array of dns_name_t's for tsig keys or NULL.
  484.  *
  485.  *  \li    dns_zone_setmasters() is just a wrapper to setmasterswithkeys(),
  486.  *      passing NULL in the keynames field.
  487.  *
  488.  * \li    If 'masters' is NULL then 'count' must be zero.
  489.  *
  490.  * Returns:
  491.  *\li    #ISC_R_SUCCESS
  492.  *\li    #ISC_R_NOMEMORY
  493.  *\li      Any result dns_name_dup() can return, if keynames!=NULL
  494.  */
  495.  
  496. isc_result_t
  497. dns_zone_setalsonotify(dns_zone_t *zone, const isc_sockaddr_t *notify,
  498.                isc_uint32_t count);
  499. /*%<
  500.  *    Set the list of additional servers to be notified when
  501.  *    a zone changes.     To clear the list use 'count = 0'.
  502.  *
  503.  * Require:
  504.  *\li    'zone' to be a valid zone.
  505.  *\li    'notify' to be non-NULL if count != 0.
  506.  *\li    'count' to be the number of notifyees.
  507.  *
  508.  * Returns:
  509.  *\li    #ISC_R_SUCCESS
  510.  *\li    #ISC_R_NOMEMORY
  511.  */
  512.  
  513. void
  514. dns_zone_unload(dns_zone_t *zone);
  515. /*%<
  516.  *    detach the database from the zone structure.
  517.  *
  518.  * Require:
  519.  *\li    'zone' to be a valid zone.
  520.  */
  521.  
  522. void
  523. dns_zone_setoption(dns_zone_t *zone, unsigned int option, isc_boolean_t value);
  524. /*%<
  525.  *    Set given options on ('value' == ISC_TRUE) or off ('value' ==
  526.  *    #ISC_FALSE).
  527.  *
  528.  * Require:
  529.  *\li    'zone' to be a valid zone.
  530.  */
  531.  
  532. unsigned int
  533. dns_zone_getoptions(dns_zone_t *zone);
  534. /*%<
  535.  *    Returns the current zone options.
  536.  *
  537.  * Require:
  538.  *\li    'zone' to be a valid zone.
  539.  */
  540.  
  541. void
  542. dns_zone_setminrefreshtime(dns_zone_t *zone, isc_uint32_t val);
  543. /*%<
  544.  *    Set the minimum refresh time.
  545.  *
  546.  * Requires:
  547.  *\li    'zone' is valid.
  548.  *\li    val > 0.
  549.  */
  550.  
  551. void
  552. dns_zone_setmaxrefreshtime(dns_zone_t *zone, isc_uint32_t val);
  553. /*%<
  554.  *    Set the maximum refresh time.
  555.  *
  556.  * Requires:
  557.  *\li    'zone' is valid.
  558.  *\li    val > 0.
  559.  */
  560.  
  561. void
  562. dns_zone_setminretrytime(dns_zone_t *zone, isc_uint32_t val);
  563. /*%<
  564.  *    Set the minimum retry time.
  565.  *
  566.  * Requires:
  567.  *\li    'zone' is valid.
  568.  *\li    val > 0.
  569.  */
  570.  
  571. void
  572. dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val);
  573. /*%<
  574.  *    Set the maximum retry time.
  575.  *
  576.  * Requires:
  577.  *\li    'zone' is valid.
  578.  *    val > 0.
  579.  */
  580.  
  581. isc_result_t
  582. dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
  583. isc_result_t
  584. dns_zone_setaltxfrsource4(dns_zone_t *zone,
  585.               const isc_sockaddr_t *xfrsource);
  586. /*%<
  587.  *     Set the source address to be used in IPv4 zone transfers.
  588.  *
  589.  * Require:
  590.  *\li    'zone' to be a valid zone.
  591.  *\li    'xfrsource' to contain the address.
  592.  *
  593.  * Returns:
  594.  *\li    #ISC_R_SUCCESS
  595.  */
  596.  
  597. isc_sockaddr_t *
  598. dns_zone_getxfrsource4(dns_zone_t *zone);
  599. isc_sockaddr_t *
  600. dns_zone_getaltxfrsource4(dns_zone_t *zone);
  601. /*%<
  602.  *    Returns the source address set by a previous dns_zone_setxfrsource4
  603.  *    call, or the default of inaddr_any, port 0.
  604.  *
  605.  * Require:
  606.  *\li    'zone' to be a valid zone.
  607.  */
  608.  
  609. isc_result_t
  610. dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
  611. isc_result_t
  612. dns_zone_setaltxfrsource6(dns_zone_t *zone,
  613.               const isc_sockaddr_t *xfrsource);
  614. /*%<
  615.  *     Set the source address to be used in IPv6 zone transfers.
  616.  *
  617.  * Require:
  618.  *\li    'zone' to be a valid zone.
  619.  *\li    'xfrsource' to contain the address.
  620.  *
  621.  * Returns:
  622.  *\li    #ISC_R_SUCCESS
  623.  */
  624.  
  625. isc_sockaddr_t *
  626. dns_zone_getxfrsource6(dns_zone_t *zone);
  627. isc_sockaddr_t *
  628. dns_zone_getaltxfrsource6(dns_zone_t *zone);
  629. /*%<
  630.  *    Returns the source address set by a previous dns_zone_setxfrsource6
  631.  *    call, or the default of in6addr_any, port 0.
  632.  *
  633.  * Require:
  634.  *\li    'zone' to be a valid zone.
  635.  */
  636.  
  637. isc_result_t
  638. dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
  639. /*%<
  640.  *     Set the source address to be used with IPv4 NOTIFY messages.
  641.  *
  642.  * Require:
  643.  *\li    'zone' to be a valid zone.
  644.  *\li    'notifysrc' to contain the address.
  645.  *
  646.  * Returns:
  647.  *\li    #ISC_R_SUCCESS
  648.  */
  649.  
  650. isc_sockaddr_t *
  651. dns_zone_getnotifysrc4(dns_zone_t *zone);
  652. /*%<
  653.  *    Returns the source address set by a previous dns_zone_setnotifysrc4
  654.  *    call, or the default of inaddr_any, port 0.
  655.  *
  656.  * Require:
  657.  *\li    'zone' to be a valid zone.
  658.  */
  659.  
  660. isc_result_t
  661. dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
  662. /*%<
  663.  *     Set the source address to be used with IPv6 NOTIFY messages.
  664.  *
  665.  * Require:
  666.  *\li    'zone' to be a valid zone.
  667.  *\li    'notifysrc' to contain the address.
  668.  *
  669.  * Returns:
  670.  *\li    #ISC_R_SUCCESS
  671.  */
  672.  
  673. isc_sockaddr_t *
  674. dns_zone_getnotifysrc6(dns_zone_t *zone);
  675. /*%<
  676.  *    Returns the source address set by a previous dns_zone_setnotifysrc6
  677.  *    call, or the default of in6addr_any, port 0.
  678.  *
  679.  * Require:
  680.  *\li    'zone' to be a valid zone.
  681.  */
  682.  
  683. void
  684. dns_zone_setnotifyacl(dns_zone_t *zone, dns_acl_t *acl);
  685. /*%<
  686.  *    Sets the notify acl list for the zone.
  687.  *
  688.  * Require:
  689.  *\li    'zone' to be a valid zone.
  690.  *\li    'acl' to be a valid acl.
  691.  */
  692.  
  693. void
  694. dns_zone_setqueryacl(dns_zone_t *zone, dns_acl_t *acl);
  695. /*%<
  696.  *    Sets the query acl list for the zone.
  697.  *
  698.  * Require:
  699.  *\li    'zone' to be a valid zone.
  700.  *\li    'acl' to be a valid acl.
  701.  */
  702.  
  703. void
  704. dns_zone_setupdateacl(dns_zone_t *zone, dns_acl_t *acl);
  705. /*%<
  706.  *    Sets the update acl list for the zone.
  707.  *
  708.  * Require:
  709.  *\li    'zone' to be a valid zone.
  710.  *\li    'acl' to be valid acl.
  711.  */
  712.  
  713. void
  714. dns_zone_setforwardacl(dns_zone_t *zone, dns_acl_t *acl);
  715. /*%<
  716.  *    Sets the forward unsigned updates acl list for the zone.
  717.  *
  718.  * Require:
  719.  *\li    'zone' to be a valid zone.
  720.  *\li    'acl' to be valid acl.
  721.  */
  722.  
  723. void
  724. dns_zone_setxfracl(dns_zone_t *zone, dns_acl_t *acl);
  725. /*%<
  726.  *    Sets the transfer acl list for the zone.
  727.  *
  728.  * Require:
  729.  *\li    'zone' to be a valid zone.
  730.  *\li    'acl' to be valid acl.
  731.  */
  732.  
  733. dns_acl_t *
  734. dns_zone_getnotifyacl(dns_zone_t *zone);
  735. /*%<
  736.  *     Returns the current notify acl or NULL.
  737.  *
  738.  * Require:
  739.  *\li    'zone' to be a valid zone.
  740.  *
  741.  * Returns:
  742.  *\li    acl a pointer to the acl.
  743.  *\li    NULL
  744.  */
  745.  
  746. dns_acl_t *
  747. dns_zone_getqueryacl(dns_zone_t *zone);
  748. /*%<
  749.  *     Returns the current query acl or NULL.
  750.  *
  751.  * Require:
  752.  *\li    'zone' to be a valid zone.
  753.  *
  754.  * Returns:
  755.  *\li    acl a pointer to the acl.
  756.  *\li    NULL
  757.  */
  758.  
  759. dns_acl_t *
  760. dns_zone_getupdateacl(dns_zone_t *zone);
  761. /*%<
  762.  *     Returns the current update acl or NULL.
  763.  *
  764.  * Require:
  765.  *\li    'zone' to be a valid zone.
  766.  *
  767.  * Returns:
  768.  *\li    acl a pointer to the acl.
  769.  *\li    NULL
  770.  */
  771.  
  772. dns_acl_t *
  773. dns_zone_getforwardacl(dns_zone_t *zone);
  774. /*%<
  775.  *     Returns the current forward unsigned updates acl or NULL.
  776.  *
  777.  * Require:
  778.  *\li    'zone' to be a valid zone.
  779.  *
  780.  * Returns:
  781.  *\li    acl a pointer to the acl.
  782.  *\li    NULL
  783.  */
  784.  
  785. dns_acl_t *
  786. dns_zone_getxfracl(dns_zone_t *zone);
  787. /*%<
  788.  *     Returns the current transfer acl or NULL.
  789.  *
  790.  * Require:
  791.  *\li    'zone' to be a valid zone.
  792.  *
  793.  * Returns:
  794.  *\li    acl a pointer to the acl.
  795.  *\li    NULL
  796.  */
  797.  
  798. void
  799. dns_zone_clearupdateacl(dns_zone_t *zone);
  800. /*%<
  801.  *    Clear the current update acl.
  802.  *
  803.  * Require:
  804.  *\li    'zone' to be a valid zone.
  805.  */
  806.  
  807. void
  808. dns_zone_clearforwardacl(dns_zone_t *zone);
  809. /*%<
  810.  *    Clear the current forward unsigned updates acl.
  811.  *
  812.  * Require:
  813.  *\li    'zone' to be a valid zone.
  814.  */
  815.  
  816. void
  817. dns_zone_clearnotifyacl(dns_zone_t *zone);
  818. /*%<
  819.  *    Clear the current notify acl.
  820.  *
  821.  * Require:
  822.  *\li    'zone' to be a valid zone.
  823.  */
  824.  
  825. void
  826. dns_zone_clearqueryacl(dns_zone_t *zone);
  827. /*%<
  828.  *    Clear the current query acl.
  829.  *
  830.  * Require:
  831.  *\li    'zone' to be a valid zone.
  832.  */
  833.  
  834. void
  835. dns_zone_clearxfracl(dns_zone_t *zone);
  836. /*%<
  837.  *    Clear the current transfer acl.
  838.  *
  839.  * Require:
  840.  *\li    'zone' to be a valid zone.
  841.  */
  842.  
  843. isc_boolean_t
  844. dns_zone_getupdatedisabled(dns_zone_t *zone);
  845. /*%<
  846.  * Return update disabled.
  847.  */
  848.  
  849. void
  850. dns_zone_setupdatedisabled(dns_zone_t *zone, isc_boolean_t state);
  851. /*%<
  852.  * Set update disabled.
  853.  */
  854.  
  855. isc_boolean_t
  856. dns_zone_getzeronosoattl(dns_zone_t *zone);
  857. /*%<
  858.  * Return zero-no-soa-ttl status.
  859.  */
  860.  
  861. void
  862. dns_zone_setzeronosoattl(dns_zone_t *zone, isc_boolean_t state);
  863. /*%<
  864.  * Set zero-no-soa-ttl status.
  865.  */
  866.  
  867. void
  868. dns_zone_setchecknames(dns_zone_t *zone, dns_severity_t severity);
  869. /*%<
  870.  *     Set the severity of name checking when loading a zone.
  871.  *
  872.  * Require:
  873.  * \li     'zone' to be a valid zone.
  874.  */
  875.  
  876. dns_severity_t
  877. dns_zone_getchecknames(dns_zone_t *zone);
  878. /*%<
  879.  *    Return the current severity of name checking.
  880.  *
  881.  * Require:
  882.  *\li    'zone' to be a valid zone.
  883.  */
  884.  
  885. void
  886. dns_zone_setjournalsize(dns_zone_t *zone, isc_int32_t size);
  887. /*%<
  888.  *    Sets the journal size for the zone.
  889.  *
  890.  * Requires:
  891.  *\li    'zone' to be a valid zone.
  892.  */
  893.  
  894. isc_int32_t
  895. dns_zone_getjournalsize(dns_zone_t *zone);
  896. /*%<
  897.  *    Return the journal size as set with a previous call to
  898.  *    dns_zone_setjournalsize().
  899.  *
  900.  * Requires:
  901.  *\li    'zone' to be a valid zone.
  902.  */
  903.  
  904. isc_result_t
  905. dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from,
  906.                dns_message_t *msg);
  907. /*%<
  908.  *    Tell the zone that it has recieved a NOTIFY message from another
  909.  *    server.  This may cause some zone maintainence activity to occur.
  910.  *
  911.  * Requires:
  912.  *\li    'zone' to be a valid zone.
  913.  *\li    '*from' to contain the address of the server from which 'msg'
  914.  *        was recieved.
  915.  *\li    'msg' a message with opcode NOTIFY and qr clear.
  916.  *
  917.  * Returns:
  918.  *\li    DNS_R_REFUSED
  919.  *\li    DNS_R_NOTIMP
  920.  *\li    DNS_R_FORMERR
  921.  *\li    DNS_R_SUCCESS
  922.  */
  923.  
  924. void
  925. dns_zone_setmaxxfrin(dns_zone_t *zone, isc_uint32_t maxxfrin);
  926. /*%<
  927.  * Set the maximum time (in seconds) that a zone transfer in (AXFR/IXFR)
  928.  * of this zone will use before being aborted.
  929.  *
  930.  * Requires:
  931.  * \li    'zone' to be valid initialised zone.
  932.  */
  933.  
  934. isc_uint32_t
  935. dns_zone_getmaxxfrin(dns_zone_t *zone);
  936. /*%<
  937.  * Returns the maximum transfer time for this zone.  This will be
  938.  * either the value set by the last call to dns_zone_setmaxxfrin() or
  939.  * the default value of 1 hour.
  940.  *
  941.  * Requires:
  942.  *\li    'zone' to be valid initialised zone.
  943.  */
  944.  
  945. void
  946. dns_zone_setmaxxfrout(dns_zone_t *zone, isc_uint32_t maxxfrout);
  947. /*%<
  948.  * Set the maximum time (in seconds) that a zone transfer out (AXFR/IXFR)
  949.  * of this zone will use before being aborted.
  950.  *
  951.  * Requires:
  952.  * \li    'zone' to be valid initialised zone.
  953.  */
  954.  
  955. isc_uint32_t
  956. dns_zone_getmaxxfrout(dns_zone_t *zone);
  957. /*%<
  958.  * Returns the maximum transfer time for this zone.  This will be
  959.  * either the value set by the last call to dns_zone_setmaxxfrout() or
  960.  * the default value of 1 hour.
  961.  *
  962.  * Requires:
  963.  *\li    'zone' to be valid initialised zone.
  964.  */
  965.  
  966. isc_result_t
  967. dns_zone_setjournal(dns_zone_t *zone, const char *journal);
  968. /*%<
  969.  * Sets the filename used for journaling updates / IXFR transfers.
  970.  * The default journal name is set by dns_zone_setfile() to be
  971.  * "file.jnl".  If 'journal' is NULL, the zone will have no
  972.  * journal name.
  973.  *
  974.  * Requires:
  975.  *\li    'zone' to be a valid zone.
  976.  *
  977.  * Returns:
  978.  *\li    #ISC_R_SUCCESS
  979.  *\li    #ISC_R_NOMEMORY
  980.  */
  981.  
  982. char *
  983. dns_zone_getjournal(dns_zone_t *zone);
  984. /*%<
  985.  * Returns the journal name associated with this zone.
  986.  * If no journal has been set this will be NULL.
  987.  *
  988.  * Requires:
  989.  *\li    'zone' to be valid initialised zone.
  990.  */
  991.  
  992. dns_zonetype_t
  993. dns_zone_gettype(dns_zone_t *zone);
  994. /*%<
  995.  * Returns the type of the zone (master/slave/etc.)
  996.  *
  997.  * Requires:
  998.  *\li    'zone' to be valid initialised zone.
  999.  */
  1000.  
  1001. void
  1002. dns_zone_settask(dns_zone_t *zone, isc_task_t *task);
  1003. /*%<
  1004.  * Give a zone a task to work with.  Any current task will be detached.
  1005.  *
  1006.  * Requires:
  1007.  *\li    'zone' to be valid.
  1008.  *\li    'task' to be valid.
  1009.  */
  1010.  
  1011. void
  1012. dns_zone_gettask(dns_zone_t *zone, isc_task_t **target);
  1013. /*%<
  1014.  * Attach '*target' to the zone's task.
  1015.  *
  1016.  * Requires:
  1017.  *\li    'zone' to be valid initialised zone.
  1018.  *\li    'zone' to have a task.
  1019.  *\li    'target' to be != NULL && '*target' == NULL.
  1020.  */
  1021.  
  1022. void
  1023. dns_zone_notify(dns_zone_t *zone);
  1024. /*%<
  1025.  * Generate notify events for this zone.
  1026.  *
  1027.  * Requires:
  1028.  *\li    'zone' to be a valid zone.
  1029.  */
  1030.  
  1031. isc_result_t
  1032. dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump);
  1033. /*%<
  1034.  * Replace the database of "zone" with a new database "db".
  1035.  *
  1036.  * If "dump" is ISC_TRUE, then the new zone contents are dumped
  1037.  * into to the zone's master file for persistence.  When replacing
  1038.  * a zone database by one just loaded from a master file, set
  1039.  * "dump" to ISC_FALSE to avoid a redunant redump of the data just
  1040.  * loaded.  Otherwise, it should be set to ISC_TRUE.
  1041.  *
  1042.  * If the "diff-on-reload" option is enabled in the configuration file,
  1043.  * the differences between the old and the new database are added to the
  1044.  * journal file, and the master file dump is postponed.
  1045.  *
  1046.  * Requires:
  1047.  * \li    'zone' to be a valid zone.
  1048.  *
  1049.  * Returns:
  1050.  * \li    DNS_R_SUCCESS
  1051.  * \li    DNS_R_BADZONE    zone failed basic consistancy checks:
  1052.  *            * a single SOA must exist
  1053.  *            * some NS records must exist.
  1054.  *    Others
  1055.  */
  1056.  
  1057. isc_uint32_t
  1058. dns_zone_getidlein(dns_zone_t *zone);
  1059. /*%<
  1060.  * Requires:
  1061.  * \li    'zone' to be a valid zone.
  1062.  *
  1063.  * Returns:
  1064.  * \li    number of seconds of idle time before we abort the transfer in.
  1065.  */
  1066.  
  1067. void
  1068. dns_zone_setidlein(dns_zone_t *zone, isc_uint32_t idlein);
  1069. /*%<
  1070.  * \li    Set the idle timeout for transfer the.
  1071.  * \li    Zero set the default value, 1 hour.
  1072.  *
  1073.  * Requires:
  1074.  * \li    'zone' to be a valid zone.
  1075.  */
  1076.  
  1077. isc_uint32_t
  1078. dns_zone_getidleout(dns_zone_t *zone);
  1079. /*%<
  1080.  *
  1081.  * Requires:
  1082.  * \li    'zone' to be a valid zone.
  1083.  *
  1084.  * Returns:
  1085.  * \li    number of seconds of idle time before we abort a transfer out.
  1086.  */
  1087.  
  1088. void
  1089. dns_zone_setidleout(dns_zone_t *zone, isc_uint32_t idleout);
  1090. /*%<
  1091.  * \li    Set the idle timeout for transfers out.
  1092.  * \li    Zero set the default value, 1 hour.
  1093.  *
  1094.  * Requires:
  1095.  * \li    'zone' to be a valid zone.
  1096.  */
  1097.  
  1098. void
  1099. dns_zone_getssutable(dns_zone_t *zone, dns_ssutable_t **table);
  1100. /*%<
  1101.  * Get the simple-secure-update policy table.
  1102.  *
  1103.  * Requires:
  1104.  * \li    'zone' to be a valid zone.
  1105.  */
  1106.  
  1107. void
  1108. dns_zone_setssutable(dns_zone_t *zone, dns_ssutable_t *table);
  1109. /*%<
  1110.  * Set / clear the simple-secure-update policy table.
  1111.  *
  1112.  * Requires:
  1113.  * \li    'zone' to be a valid zone.
  1114.  */
  1115.  
  1116. isc_mem_t *
  1117. dns_zone_getmctx(dns_zone_t *zone);
  1118. /*%<
  1119.  * Get the memory context of a zone.
  1120.  *
  1121.  * Requires:
  1122.  * \li    'zone' to be a valid zone.
  1123.  */
  1124.  
  1125. dns_zonemgr_t *
  1126. dns_zone_getmgr(dns_zone_t *zone);
  1127. /*%<
  1128.  *    If 'zone' is managed return the zone manager otherwise NULL.
  1129.  *
  1130.  * Requires:
  1131.  * \li    'zone' to be a valid zone.
  1132.  */
  1133.  
  1134. void
  1135. dns_zone_setsigvalidityinterval(dns_zone_t *zone, isc_uint32_t interval);
  1136. /*%<
  1137.  * Set the zone's SIG validity interval.  This is the length of time
  1138.  * for which DNSSEC signatures created as a result of dynamic updates
  1139.  * to secure zones will remain valid, in seconds.
  1140.  *
  1141.  * Requires:
  1142.  * \li    'zone' to be a valid zone.
  1143.  */
  1144.  
  1145. isc_uint32_t
  1146. dns_zone_getsigvalidityinterval(dns_zone_t *zone);
  1147. /*%<
  1148.  * Get the zone's SIG validity interval.
  1149.  *
  1150.  * Requires:
  1151.  * \li    'zone' to be a valid zone.
  1152.  */
  1153.  
  1154. void
  1155. dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype);
  1156. /*%<
  1157.  * Sets zone notify method to "notifytype"
  1158.  */
  1159.  
  1160. isc_result_t
  1161. dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg,
  1162.                        dns_updatecallback_t callback, void *callback_arg);
  1163. /*%<
  1164.  * Forward 'msg' to each master in turn until we get an answer or we
  1165.  * have exausted the list of masters. 'callback' will be called with
  1166.  * ISC_R_SUCCESS if we get an answer and the returned message will be
  1167.  * passed as 'answer_message', otherwise a non ISC_R_SUCCESS result code
  1168.  * will be passed and answer_message will be NULL.  The callback function
  1169.  * is responsible for destroying 'answer_message'.
  1170.  *        (callback)(callback_arg, result, answer_message);
  1171.  *
  1172.  * Require:
  1173.  *\li    'zone' to be valid
  1174.  *\li    'msg' to be valid.
  1175.  *\li    'callback' to be non NULL.
  1176.  * Returns:
  1177.  *\li    #ISC_R_SUCCESS if the message has been forwarded,
  1178.  *\li    #ISC_R_NOMEMORY
  1179.  *\li    Others
  1180.  */
  1181.  
  1182. isc_result_t
  1183. dns_zone_next(dns_zone_t *zone, dns_zone_t **next);
  1184. /*%<
  1185.  * Find the next zone in the list of managed zones.
  1186.  *
  1187.  * Requires:
  1188.  *\li    'zone' to be valid
  1189.  *\li    The zone manager for the indicated zone MUST be locked
  1190.  *    by the caller.  This is not checked.
  1191.  *\li    'next' be non-NULL, and '*next' be NULL.
  1192.  *
  1193.  * Ensures:
  1194.  *\li    'next' points to a valid zone (result ISC_R_SUCCESS) or to NULL
  1195.  *    (result ISC_R_NOMORE).
  1196.  */
  1197.  
  1198. isc_result_t
  1199. dns_zone_first(dns_zonemgr_t *zmgr, dns_zone_t **first);
  1200. /*%<
  1201.  * Find the first zone in the list of managed zones.
  1202.  *
  1203.  * Requires:
  1204.  *\li    'zonemgr' to be valid
  1205.  *\li    The zone manager for the indicated zone MUST be locked
  1206.  *    by the caller.  This is not checked.
  1207.  *\li    'first' be non-NULL, and '*first' be NULL
  1208.  *
  1209.  * Ensures:
  1210.  *\li    'first' points to a valid zone (result ISC_R_SUCCESS) or to NULL
  1211.  *    (result ISC_R_NOMORE).
  1212.  */
  1213.  
  1214. isc_result_t
  1215. dns_zone_setkeydirectory(dns_zone_t *zone, const char *directory);
  1216. /*%<
  1217.  *    Sets the name of the directory where private keys used for
  1218.  *    online signing of dynamic zones are found.
  1219.  *
  1220.  * Require:
  1221.  *\li    'zone' to be a valid zone.
  1222.  *
  1223.  * Returns:
  1224.  *\li    #ISC_R_NOMEMORY
  1225.  *\li    #ISC_R_SUCCESS
  1226.  */
  1227.  
  1228. const char *
  1229. dns_zone_getkeydirectory(dns_zone_t *zone);
  1230. /*%<
  1231.  *     Gets the name of the directory where private keys used for
  1232.  *    online signing of dynamic zones are found.
  1233.  *
  1234.  * Requires:
  1235.  *\li    'zone' to be valid initialised zone.
  1236.  *
  1237.  * Returns:
  1238.  *    Pointer to null-terminated file name, or NULL.
  1239.  */
  1240.  
  1241.  
  1242. isc_result_t
  1243. dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
  1244.            isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr,
  1245.            dns_zonemgr_t **zmgrp);
  1246. /*%<
  1247.  * Create a zone manager.
  1248.  *
  1249.  * Requires:
  1250.  *\li    'mctx' to be a valid memory context.
  1251.  *\li    'taskmgr' to be a valid task manager.
  1252.  *\li    'timermgr' to be a valid timer manager.
  1253.  *\li    'zmgrp'    to point to a NULL pointer.
  1254.  */
  1255.  
  1256. isc_result_t
  1257. dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone);
  1258. /*%<
  1259.  *    Bring the zone under control of a zone manager.
  1260.  *
  1261.  * Require:
  1262.  *\li    'zmgr' to be a valid zone manager.
  1263.  *\li    'zone' to be a valid zone.
  1264.  */
  1265.  
  1266. isc_result_t
  1267. dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr);
  1268. /*%<
  1269.  * Force zone maintenance of all zones managed by 'zmgr' at its
  1270.  * earliest conveniene.
  1271.  */
  1272.  
  1273. void
  1274. dns_zonemgr_resumexfrs(dns_zonemgr_t *zmgr);
  1275. /*%<
  1276.  * Attempt to start any stalled zone transfers.
  1277.  */
  1278.  
  1279. void
  1280. dns_zonemgr_shutdown(dns_zonemgr_t *zmgr);
  1281. /*%<
  1282.  *    Shut down the zone manager.
  1283.  *
  1284.  * Requires:
  1285.  *\li    'zmgr' to be a valid zone manager.
  1286.  */
  1287.  
  1288. void
  1289. dns_zonemgr_attach(dns_zonemgr_t *source, dns_zonemgr_t **target);
  1290. /*%<
  1291.  *    Attach '*target' to 'source' incrementing its external
  1292.  *     reference count.
  1293.  *
  1294.  * Require:
  1295.  *\li    'zone' to be a valid zone.
  1296.  *\li    'target' to be non NULL and '*target' to be NULL.
  1297.  */
  1298.  
  1299. void
  1300. dns_zonemgr_detach(dns_zonemgr_t **zmgrp);
  1301. /*%<
  1302.  *     Detach from a zone manager.
  1303.  *
  1304.  * Requires:
  1305.  *\li    '*zmgrp' is a valid, non-NULL zone manager pointer.
  1306.  *
  1307.  * Ensures:
  1308.  *\li    '*zmgrp' is NULL.
  1309.  */
  1310.  
  1311. void
  1312. dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone);
  1313. /*%<
  1314.  *    Release 'zone' from the managed by 'zmgr'.  'zmgr' is implicitly
  1315.  *    detached from 'zone'.
  1316.  *
  1317.  * Requires:
  1318.  *\li    'zmgr' to be a valid zone manager.
  1319.  *\li    'zone' to be a valid zone.
  1320.  *\li    'zmgr' == 'zone->zmgr'
  1321.  *
  1322.  * Ensures:
  1323.  *\li    'zone->zmgr' == NULL;
  1324.  */
  1325.  
  1326. void
  1327. dns_zonemgr_settransfersin(dns_zonemgr_t *zmgr, isc_uint32_t value);
  1328. /*%<
  1329.  *    Set the maximum number of simultaneous transfers in allowed by
  1330.  *    the zone manager.
  1331.  *
  1332.  * Requires:
  1333.  *\li    'zmgr' to be a valid zone manager.
  1334.  */
  1335.  
  1336. isc_uint32_t
  1337. dns_zonemgr_getttransfersin(dns_zonemgr_t *zmgr);
  1338. /*%<
  1339.  *    Return the the maximum number of simultaneous transfers in allowed.
  1340.  *
  1341.  * Requires:
  1342.  *\li    'zmgr' to be a valid zone manager.
  1343.  */
  1344.  
  1345. void
  1346. dns_zonemgr_settransfersperns(dns_zonemgr_t *zmgr, isc_uint32_t value);
  1347. /*%<
  1348.  *    Set the number of zone transfers allowed per nameserver.
  1349.  *
  1350.  * Requires:
  1351.  *\li    'zmgr' to be a valid zone manager
  1352.  */
  1353.  
  1354. isc_uint32_t
  1355. dns_zonemgr_getttransfersperns(dns_zonemgr_t *zmgr);
  1356. /*%<
  1357.  *    Return the number of transfers allowed per nameserver.
  1358.  *
  1359.  * Requires:
  1360.  *\li    'zmgr' to be a valid zone manager.
  1361.  */
  1362.  
  1363. void
  1364. dns_zonemgr_setiolimit(dns_zonemgr_t *zmgr, isc_uint32_t iolimit);
  1365. /*%<
  1366.  *    Set the number of simultaneous file descriptors available for 
  1367.  *    reading and writing masterfiles.
  1368.  *
  1369.  * Requires:
  1370.  *\li    'zmgr' to be a valid zone manager.
  1371.  *\li    'iolimit' to be positive.
  1372.  */
  1373.  
  1374. isc_uint32_t
  1375. dns_zonemgr_getiolimit(dns_zonemgr_t *zmgr);
  1376. /*%<
  1377.  *    Get the number of simultaneous file descriptors available for 
  1378.  *    reading and writing masterfiles.
  1379.  *
  1380.  * Requires:
  1381.  *\li    'zmgr' to be a valid zone manager.
  1382.  */
  1383.  
  1384. void
  1385. dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value);
  1386. /*%<
  1387.  *    Set the number of SOA queries sent per second.
  1388.  *
  1389.  * Requires:
  1390.  *\li    'zmgr' to be a valid zone manager
  1391.  */
  1392.  
  1393. unsigned int
  1394. dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr);
  1395. /*%<
  1396.  *    Return the number of SOA queries sent per second.
  1397.  *
  1398.  * Requires:
  1399.  *\li    'zmgr' to be a valid zone manager.
  1400.  */
  1401.  
  1402. unsigned int
  1403. dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state);
  1404. /*%<
  1405.  *    Returns the number of zones in the specified state.
  1406.  *
  1407.  * Requires:
  1408.  *\li    'zmgr' to be a valid zone manager.
  1409.  *\li    'state' to be a valid DNS_ZONESTATE_ constant.
  1410.  */
  1411.  
  1412. void
  1413. dns_zone_forcereload(dns_zone_t *zone);
  1414. /*%<
  1415.  *      Force a reload of specified zone.
  1416.  *
  1417.  * Requires:
  1418.  *\li      'zone' to be a valid zone.
  1419.  */
  1420.  
  1421. isc_boolean_t
  1422. dns_zone_isforced(dns_zone_t *zone);
  1423. /*%<
  1424.  *      Check if the zone is waiting a forced reload.
  1425.  *
  1426.  * Requires:
  1427.  * \li     'zone' to be a valid zone.
  1428.  */
  1429.  
  1430. isc_result_t
  1431. dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on);
  1432. /*%<
  1433.  *      Make the zone keep or not keep an array of statistics
  1434.  *     counter.
  1435.  *
  1436.  * Requires:
  1437.  *   \li   zone be a valid zone.
  1438.  */
  1439.  
  1440. isc_uint64_t *
  1441. dns_zone_getstatscounters(dns_zone_t *zone);
  1442. /*%<
  1443.  * Requires:
  1444.  *      zone be a valid zone.
  1445.  *
  1446.  * Returns:
  1447.  * \li     A pointer to the zone's array of statistics counters,
  1448.  *    or NULL if it has none.
  1449.  */
  1450.  
  1451. void
  1452. dns_zone_dialup(dns_zone_t *zone);
  1453. /*%<
  1454.  * Perform dialup-time maintenance on 'zone'.
  1455.  */
  1456.  
  1457. void
  1458. dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup);
  1459. /*%<
  1460.  * Set the dialup type of 'zone' to 'dialup'.
  1461.  *
  1462.  * Requires:
  1463.  * \li    'zone' to be valid initialised zone.
  1464.  *\li    'dialup' to be a valid dialup type.
  1465.  */
  1466.  
  1467. void
  1468. dns_zone_log(dns_zone_t *zone, int level, const char *msg, ...)
  1469.     ISC_FORMAT_PRINTF(3, 4);
  1470. /*%<
  1471.  * Log the message 'msg...' at 'level', including text that identifies
  1472.  * the message as applying to 'zone'.
  1473.  */
  1474.  
  1475. void
  1476. dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category, int level,
  1477.           const char *msg, ...) ISC_FORMAT_PRINTF(4, 5);
  1478. /*%<
  1479.  * Log the message 'msg...' at 'level', including text that identifies
  1480.  * the message as applying to 'zone'.
  1481.  */
  1482.  
  1483. void
  1484. dns_zone_name(dns_zone_t *zone, char *buf, size_t len);
  1485. /*%<
  1486.  * Return the name of the zone with class and view.
  1487.  * 
  1488.  * Requires:
  1489.  *\li    'zone' to be valid.
  1490.  *\li    'buf' to be non NULL.
  1491.  */
  1492.  
  1493. isc_result_t
  1494. dns_zone_checknames(dns_zone_t *zone, dns_name_t *name, dns_rdata_t *rdata);
  1495. /*
  1496.  * Check if this record meets the check-names policy.
  1497.  *
  1498.  * Requires:
  1499.  *    'zone' to be valid.
  1500.  *    'name' to be valid.
  1501.  *    'rdata' to be valid.
  1502.  *
  1503.  * Returns:
  1504.  *    DNS_R_SUCCESS        passed checks.
  1505.  *    DNS_R_BADOWNERNAME    failed ownername checks.
  1506.  *    DNS_R_BADNAME        failed rdata checks.
  1507.  */
  1508.  
  1509. void
  1510. dns_zone_setacache(dns_zone_t *zone, dns_acache_t *acache);
  1511. /*
  1512.  *    Associate the zone with an additional cache.
  1513.  *
  1514.  * Require:
  1515.  *    'zone' to be a valid zone.
  1516.  *    'acache' to be a non NULL pointer.
  1517.  *
  1518.  * Ensures:
  1519.  *    'zone' will have a reference to 'acache'
  1520.  */
  1521.  
  1522. void
  1523. dns_zone_setcheckmx(dns_zone_t *zone, dns_checkmxfunc_t checkmx);
  1524. /*
  1525.  *    Set the post load integrity callback function 'checkmx'.
  1526.  *    'checkmx' will be called if the MX is not within the zone.
  1527.  *
  1528.  * Require:
  1529.  *    'zone' to be a valid zone.
  1530.  */
  1531.  
  1532. void
  1533. dns_zone_setchecksrv(dns_zone_t *zone, dns_checkmxfunc_t checksrv);
  1534. /*
  1535.  *    Set the post load integrity callback function 'checksrv'.
  1536.  *    'checksrv' will be called if the SRV TARGET is not within the zone.
  1537.  *
  1538.  * Require:
  1539.  *    'zone' to be a valid zone.
  1540.  */
  1541.  
  1542. void
  1543. dns_zone_setcheckns(dns_zone_t *zone, dns_checknsfunc_t checkns);
  1544. /*
  1545.  *    Set the post load integrity callback function 'checkmx'.
  1546.  *    'checkmx' will be called if the MX is not within the zone.
  1547.  *
  1548.  * Require:
  1549.  *    'zone' to be a valid zone.
  1550.  */
  1551.  
  1552. void
  1553. dns_zone_setnotifydelay(dns_zone_t *zone, isc_uint32_t delay);
  1554. /*
  1555.  * Set the minimum delay between sets of notify messages.
  1556.  *
  1557.  * Requires:
  1558.  *    'zone' to be valid.
  1559.  */
  1560.  
  1561. isc_uint32_t
  1562. dns_zone_getnotifydelay(dns_zone_t *zone);
  1563. /*
  1564.  * Get the minimum delay between sets of notify messages.
  1565.  *
  1566.  * Requires:
  1567.  *    'zone' to be valid.
  1568.  */
  1569.  
  1570. void
  1571. dns_zone_setisself(dns_zone_t *zone, dns_isselffunc_t isself, void *arg);
  1572. /*
  1573.  * Set the isself callback function and argument.
  1574.  *
  1575.  * isc_boolean_t
  1576.  * isself(dns_view_t *myview, dns_tsigkey_t *mykey, isc_netaddr_t *srcaddr,
  1577.  *      isc_netaddr_t *destaddr, dns_rdataclass_t rdclass, void *arg);
  1578.  *
  1579.  * 'isself' returns ISC_TRUE if a non-recursive query from 'srcaddr' to
  1580.  * 'destaddr' with optional key 'mykey' for class 'rdclass' would be
  1581.  * delivered to 'myview'.
  1582.  */
  1583.  
  1584. ISC_LANG_ENDDECLS
  1585.  
  1586. #endif /* DNS_ZONE_H */
  1587.