"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/dns/include/dns/zt.h" (7 Sep 2020, 5491 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 "zt.h" see the Fossies "Dox" file reference documentation.

    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 
   13 #ifndef DNS_ZT_H
   14 #define DNS_ZT_H 1
   15 
   16 /*! \file dns/zt.h */
   17 
   18 #include <stdbool.h>
   19 
   20 #include <isc/lang.h>
   21 
   22 #include <dns/types.h>
   23 
   24 #define DNS_ZTFIND_NOEXACT      0x01
   25 
   26 ISC_LANG_BEGINDECLS
   27 
   28 typedef isc_result_t
   29 (*dns_zt_allloaded_t)(void *arg);
   30 /*%<
   31  * Method prototype: when all pending zone loads are complete,
   32  * the zone table can inform the caller via a callback function with
   33  * this signature.
   34  */
   35 
   36 typedef isc_result_t
   37 (*dns_zt_zoneloaded_t)(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task);
   38 /*%<
   39  * Method prototype: when a zone finishes loading, the zt object
   40  * can be informed via a callback function with this signature.
   41  */
   42 
   43 isc_result_t
   44 dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **zt);
   45 /*%<
   46  * Creates a new zone table.
   47  *
   48  * Requires:
   49  * \li  'mctx' to be initialized.
   50  *
   51  * Returns:
   52  * \li  #ISC_R_SUCCESS on success.
   53  * \li  #ISC_R_NOMEMORY
   54  */
   55 
   56 isc_result_t
   57 dns_zt_mount(dns_zt_t *zt, dns_zone_t *zone);
   58 /*%<
   59  * Mounts the zone on the zone table.
   60  *
   61  * Requires:
   62  * \li  'zt' to be valid
   63  * \li  'zone' to be valid
   64  *
   65  * Returns:
   66  * \li  #ISC_R_SUCCESS
   67  * \li  #ISC_R_EXISTS
   68  * \li  #ISC_R_NOSPACE
   69  * \li  #ISC_R_NOMEMORY
   70  */
   71 
   72 isc_result_t
   73 dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone);
   74 /*%<
   75  * Unmount the given zone from the table.
   76  *
   77  * Requires:
   78  *  'zt' to be valid
   79  * \li  'zone' to be valid
   80  *
   81  * Returns:
   82  * \li  #ISC_R_SUCCESS
   83  * \li  #ISC_R_NOTFOUND
   84  * \li  #ISC_R_NOMEMORY
   85  */
   86 
   87 isc_result_t
   88 dns_zt_find(dns_zt_t *zt, const dns_name_t *name, unsigned int options,
   89         dns_name_t *foundname, dns_zone_t **zone);
   90 /*%<
   91  * Find the best match for 'name' in 'zt'.  If foundname is non NULL
   92  * then the name of the zone found is returned.
   93  *
   94  * Notes:
   95  * \li  If the DNS_ZTFIND_NOEXACT is set, the best partial match (if any)
   96  *  to 'name' will be returned.
   97  *
   98  * Requires:
   99  * \li  'zt' to be valid
  100  * \li  'name' to be valid
  101  * \li  'foundname' to be initialized and associated with a fixedname or NULL
  102  * \li  'zone' to be non NULL and '*zone' to be NULL
  103  *
  104  * Returns:
  105  * \li  #ISC_R_SUCCESS
  106  * \li  #DNS_R_PARTIALMATCH
  107  * \li  #ISC_R_NOTFOUND
  108  * \li  #ISC_R_NOSPACE
  109  */
  110 
  111 void
  112 dns_zt_detach(dns_zt_t **ztp);
  113 /*%<
  114  * Detach the given zonetable, if the reference count goes to zero the
  115  * zonetable will be freed.  In either case 'ztp' is set to NULL.
  116  *
  117  * Requires:
  118  * \li  '*ztp' to be valid
  119  */
  120 
  121 void
  122 dns_zt_flushanddetach(dns_zt_t **ztp);
  123 /*%<
  124  * Detach the given zonetable, if the reference count goes to zero the
  125  * zonetable will be flushed and then freed.  In either case 'ztp' is
  126  * set to NULL.
  127  *
  128  * Requires:
  129  * \li  '*ztp' to be valid
  130  */
  131 
  132 void
  133 dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp);
  134 /*%<
  135  * Attach 'zt' to '*ztp'.
  136  *
  137  * Requires:
  138  * \li  'zt' to be valid
  139  * \li  '*ztp' to be NULL
  140  */
  141 
  142 isc_result_t
  143 dns_zt_load(dns_zt_t *zt, bool stop);
  144 
  145 isc_result_t
  146 dns_zt_loadnew(dns_zt_t *zt, bool stop);
  147 
  148 isc_result_t
  149 dns_zt_asyncload(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg);
  150 
  151 isc_result_t
  152 dns_zt_asyncload2(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg,
  153           bool newonly);
  154 /*%<
  155  * Load all zones in the table.  If 'stop' is true,
  156  * stop on the first error and return it.  If 'stop'
  157  * is false, ignore errors.
  158  *
  159  * dns_zt_loadnew() only loads zones that are not yet loaded.
  160  * dns_zt_load() also loads zones that are already loaded and
  161  * and whose master file has changed since the last load.
  162  * dns_zt_asyncload() loads zones asynchronously; when all
  163  * zones in the zone table have finished loaded (or failed due
  164  * to errors), the caller is informed by calling 'alldone'
  165  * with an argument of 'arg'.
  166  *
  167  * Requires:
  168  * \li  'zt' to be valid
  169  */
  170 
  171 isc_result_t
  172 dns_zt_freezezones(dns_zt_t *zt, bool freeze);
  173 /*%<
  174  * Freeze/thaw updates to master zones.
  175  * Any pending updates will be flushed.
  176  * Zones will be reloaded on thaw.
  177  */
  178 
  179 isc_result_t
  180 dns_zt_apply(dns_zt_t *zt, bool stop,
  181          isc_result_t (*action)(dns_zone_t *, void *), void *uap);
  182 
  183 isc_result_t
  184 dns_zt_apply2(dns_zt_t *zt, bool stop, isc_result_t *sub,
  185           isc_result_t (*action)(dns_zone_t *, void *), void *uap);
  186 /*%<
  187  * Apply a given 'action' to all zone zones in the table.
  188  * If 'stop' is 'true' then walking the zone tree will stop if
  189  * 'action' does not return ISC_R_SUCCESS.
  190  *
  191  * Requires:
  192  * \li  'zt' to be valid.
  193  * \li  'action' to be non NULL.
  194  *
  195  * Returns:
  196  * \li  ISC_R_SUCCESS if action was applied to all nodes.  If 'stop' is
  197  *  false and 'sub' is non NULL then the first error (if any)
  198  *  reported by 'action' is returned in '*sub';
  199  *  any error code from 'action'.
  200  */
  201 
  202 bool
  203 dns_zt_loadspending(dns_zt_t *zt);
  204 /*%<
  205  * Returns true if and only if there are zones still waiting to
  206  * be loaded in zone table 'zt'.
  207  *
  208  * Requires:
  209  * \li  'zt' to be valid.
  210  */
  211 
  212 void
  213 dns_zt_setviewcommit(dns_zt_t *zt);
  214 /*%<
  215  * Commit dns_zone_setview() calls previously made for all zones in this
  216  * zone table.
  217  *
  218  * Requires:
  219  *\li   'view' to be valid.
  220  */
  221 
  222 void
  223 dns_zt_setviewrevert(dns_zt_t *zt);
  224 /*%<
  225  * Revert dns_zone_setview() calls previously made for all zones in this
  226  * zone table.
  227  *
  228  * Requires:
  229  *\li   'view' to be valid.
  230  */
  231 
  232 ISC_LANG_ENDDECLS
  233 
  234 #endif /* DNS_ZT_H */