zt.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2007, 2011  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 1999-2002  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id: zt.h,v 1.40 2011/09/02 23:46:32 tbox Exp $ */
00019 
00020 #ifndef DNS_ZT_H
00021 #define DNS_ZT_H 1
00022 
00023 /*! \file dns/zt.h */
00024 
00025 #include <isc/lang.h>
00026 
00027 #include <dns/types.h>
00028 
00029 #define DNS_ZTFIND_NOEXACT              0x01
00030 
00031 ISC_LANG_BEGINDECLS
00032 
00033 typedef isc_result_t
00034 (*dns_zt_allloaded_t)(void *arg);
00035 /*%<
00036  * Method prototype: when all pending zone loads are complete,
00037  * the zone table can inform the caller via a callback function with
00038  * this signature.
00039  */
00040 
00041 typedef isc_result_t
00042 (*dns_zt_zoneloaded_t)(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task);
00043 /*%<
00044  * Method prototype: when a zone finishes loading, the zt object
00045  * can be informed via a callback function with this signature.
00046  */
00047 
00048 isc_result_t
00049 dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **zt);
00050 /*%<
00051  * Creates a new zone table.
00052  *
00053  * Requires:
00054  * \li  'mctx' to be initialized.
00055  *
00056  * Returns:
00057  * \li  #ISC_R_SUCCESS on success.
00058  * \li  #ISC_R_NOMEMORY
00059  */
00060 
00061 isc_result_t
00062 dns_zt_mount(dns_zt_t *zt, dns_zone_t *zone);
00063 /*%<
00064  * Mounts the zone on the zone table.
00065  *
00066  * Requires:
00067  * \li  'zt' to be valid
00068  * \li  'zone' to be valid
00069  *
00070  * Returns:
00071  * \li  #ISC_R_SUCCESS
00072  * \li  #ISC_R_EXISTS
00073  * \li  #ISC_R_NOSPACE
00074  * \li  #ISC_R_NOMEMORY
00075  */
00076 
00077 isc_result_t
00078 dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone);
00079 /*%<
00080  * Unmount the given zone from the table.
00081  *
00082  * Requires:
00083  *      'zt' to be valid
00084  * \li  'zone' to be valid
00085  *
00086  * Returns:
00087  * \li  #ISC_R_SUCCESS
00088  * \li  #ISC_R_NOTFOUND
00089  * \li  #ISC_R_NOMEMORY
00090  */
00091 
00092 isc_result_t
00093 dns_zt_find(dns_zt_t *zt, dns_name_t *name, unsigned int options,
00094             dns_name_t *foundname, dns_zone_t **zone);
00095 /*%<
00096  * Find the best match for 'name' in 'zt'.  If foundname is non NULL
00097  * then the name of the zone found is returned.
00098  *
00099  * Notes:
00100  * \li  If the DNS_ZTFIND_NOEXACT is set, the best partial match (if any)
00101  *      to 'name' will be returned.
00102  *
00103  * Requires:
00104  * \li  'zt' to be valid
00105  * \li  'name' to be valid
00106  * \li  'foundname' to be initialized and associated with a fixedname or NULL
00107  * \li  'zone' to be non NULL and '*zone' to be NULL
00108  *
00109  * Returns:
00110  * \li  #ISC_R_SUCCESS
00111  * \li  #DNS_R_PARTIALMATCH
00112  * \li  #ISC_R_NOTFOUND
00113  * \li  #ISC_R_NOSPACE
00114  */
00115 
00116 void
00117 dns_zt_detach(dns_zt_t **ztp);
00118 /*%<
00119  * Detach the given zonetable, if the reference count goes to zero the
00120  * zonetable will be freed.  In either case 'ztp' is set to NULL.
00121  *
00122  * Requires:
00123  * \li  '*ztp' to be valid
00124  */
00125 
00126 void
00127 dns_zt_flushanddetach(dns_zt_t **ztp);
00128 /*%<
00129  * Detach the given zonetable, if the reference count goes to zero the
00130  * zonetable will be flushed and then freed.  In either case 'ztp' is
00131  * set to NULL.
00132  *
00133  * Requires:
00134  * \li  '*ztp' to be valid
00135  */
00136 
00137 void
00138 dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp);
00139 /*%<
00140  * Attach 'zt' to '*ztp'.
00141  *
00142  * Requires:
00143  * \li  'zt' to be valid
00144  * \li  '*ztp' to be NULL
00145  */
00146 
00147 isc_result_t
00148 dns_zt_load(dns_zt_t *zt, isc_boolean_t stop);
00149 
00150 isc_result_t
00151 dns_zt_loadnew(dns_zt_t *zt, isc_boolean_t stop);
00152 
00153 isc_result_t
00154 dns_zt_asyncload(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg);
00155 /*%<
00156  * Load all zones in the table.  If 'stop' is ISC_TRUE,
00157  * stop on the first error and return it.  If 'stop'
00158  * is ISC_FALSE, ignore errors.
00159  *
00160  * dns_zt_loadnew() only loads zones that are not yet loaded.
00161  * dns_zt_load() also loads zones that are already loaded and
00162  * and whose master file has changed since the last load.
00163  * dns_zt_asyncload() loads zones asynchronously; when all
00164  * zones in the zone table have finished loaded (or failed due
00165  * to errors), the caller is informed by calling 'alldone'
00166  * with an argument of 'arg'.
00167  *
00168  * Requires:
00169  * \li  'zt' to be valid
00170  */
00171 
00172 isc_result_t
00173 dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze);
00174 /*%<
00175  * Freeze/thaw updates to master zones.
00176  * Any pending updates will be flushed.
00177  * Zones will be reloaded on thaw.
00178  */
00179 
00180 isc_result_t
00181 dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop,
00182              isc_result_t (*action)(dns_zone_t *, void *), void *uap);
00183 
00184 isc_result_t
00185 dns_zt_apply2(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub,
00186               isc_result_t (*action)(dns_zone_t *, void *), void *uap);
00187 /*%<
00188  * Apply a given 'action' to all zone zones in the table.
00189  * If 'stop' is 'ISC_TRUE' then walking the zone tree will stop if
00190  * 'action' does not return ISC_R_SUCCESS.
00191  *
00192  * Requires:
00193  * \li  'zt' to be valid.
00194  * \li  'action' to be non NULL.
00195  *
00196  * Returns:
00197  * \li  ISC_R_SUCCESS if action was applied to all nodes.  If 'stop' is
00198  *      ISC_FALSE and 'sub' is non NULL then the first error (if any)
00199  *      reported by 'action' is returned in '*sub';
00200  *      any error code from 'action'.
00201  */
00202 
00203 isc_boolean_t
00204 dns_zt_loadspending(dns_zt_t *zt);
00205 /*%<
00206  * Returns ISC_TRUE if and only if there are zones still waiting to
00207  * be loaded in zone table 'zt'.
00208  *
00209  * Requires:
00210  * \li  'zt' to be valid.
00211  */
00212 
00213 ISC_LANG_ENDDECLS
00214 
00215 #endif /* DNS_ZT_H */

Generated on Tue Apr 28 17:40:57 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha