dbtable.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 1999-2001  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: dbtable.h,v 1.23 2007/06/19 23:47:16 tbox Exp $ */
00019 
00020 #ifndef DNS_DBTABLE_H
00021 #define DNS_DBTABLE_H 1
00022 
00023 /*****
00024  ***** Module Info
00025  *****/
00026 
00027 /*! \file dns/dbtable.h
00028  * \brief
00029  * DNS DB Tables
00030  *
00031  * XXX TBS XXX
00032  *
00033  * MP:
00034  *\li   The module ensures appropriate synchronization of data structures it
00035  *      creates and manipulates.
00036  *
00037  * Reliability:
00038  *\li   No anticipated impact.
00039  *
00040  * Resources:
00041  *\li   None.
00042  *
00043  * Security:
00044  *\li   No anticipated impact.
00045  *
00046  * Standards:
00047  *\li   None.
00048  */
00049 
00050 #include <isc/lang.h>
00051 
00052 #include <dns/types.h>
00053 
00054 #define DNS_DBTABLEFIND_NOEXACT         0x01
00055 
00056 ISC_LANG_BEGINDECLS
00057 
00058 isc_result_t
00059 dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
00060                    dns_dbtable_t **dbtablep);
00061 /*%<
00062  * Make a new dbtable of class 'rdclass'
00063  *
00064  * Requires:
00065  *\li   mctx != NULL
00066  * \li  dbtablep != NULL && *dptablep == NULL
00067  *\li   'rdclass' is a valid class
00068  *
00069  * Returns:
00070  *\li   #ISC_R_SUCCESS
00071  *\li   #ISC_R_NOMEMORY
00072  *\li   #ISC_R_UNEXPECTED
00073  */
00074 
00075 void
00076 dns_dbtable_attach(dns_dbtable_t *source, dns_dbtable_t **targetp);
00077 /*%<
00078  * Attach '*targetp' to 'source'.
00079  *
00080  * Requires:
00081  *
00082  *\li   'source' is a valid dbtable.
00083  *
00084  *\li   'targetp' points to a NULL dns_dbtable_t *.
00085  *
00086  * Ensures:
00087  *
00088  *\li   *targetp is attached to source.
00089  */
00090 
00091 void
00092 dns_dbtable_detach(dns_dbtable_t **dbtablep);
00093 /*%<
00094  * Detach *dbtablep from its dbtable.
00095  *
00096  * Requires:
00097  *
00098  *\li   '*dbtablep' points to a valid dbtable.
00099  *
00100  * Ensures:
00101  *
00102  *\li   *dbtablep is NULL.
00103  *
00104  *\li   If '*dbtablep' is the last reference to the dbtable,
00105  *              all resources used by the dbtable will be freed
00106  */
00107 
00108 isc_result_t
00109 dns_dbtable_add(dns_dbtable_t *dbtable, dns_db_t *db);
00110 /*%<
00111  * Add 'db' to 'dbtable'.
00112  *
00113  * Requires:
00114  *\li   'dbtable' is a valid dbtable.
00115  *
00116  *\li   'db' is a valid database with the same class as 'dbtable'
00117  */
00118 
00119 void
00120 dns_dbtable_remove(dns_dbtable_t *dbtable, dns_db_t *db);
00121 /*%<
00122  * Remove 'db' from 'dbtable'.
00123  *
00124  * Requires:
00125  *\li   'db' was previously added to 'dbtable'.
00126  */
00127 
00128 void
00129 dns_dbtable_adddefault(dns_dbtable_t *dbtable, dns_db_t *db);
00130 /*%<
00131  * Use 'db' as the result of a dns_dbtable_find() if no better match is
00132  * available.
00133  */
00134 
00135 void
00136 dns_dbtable_getdefault(dns_dbtable_t *dbtable, dns_db_t **db);
00137 /*%<
00138  * Get the 'db' used as the result of a dns_dbtable_find()
00139  * if no better match is available.
00140  */
00141 
00142 void
00143 dns_dbtable_removedefault(dns_dbtable_t *dbtable);
00144 /*%<
00145  * Remove the default db from 'dbtable'.
00146  */
00147 
00148 isc_result_t
00149 dns_dbtable_find(dns_dbtable_t *dbtable, dns_name_t *name,
00150                  unsigned int options, dns_db_t **dbp);
00151 /*%<
00152  * Find the deepest match to 'name' in the dbtable, and return it
00153  *
00154  * Notes:
00155  *\li   If the DNS_DBTABLEFIND_NOEXACT option is set, the best partial
00156  *      match (if any) to 'name' will be returned.
00157  *
00158  * Returns:  
00159  * \li #ISC_R_SUCCESS           on success
00160  *\li        something else:            no default and match
00161  */
00162 
00163 ISC_LANG_ENDDECLS
00164 
00165 #endif /* DNS_DBTABLE_H */

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