forward.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2007, 2009, 2013  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 2000, 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: forward.h,v 1.13 2009/09/02 23:48:02 tbox Exp $ */
00019 
00020 #ifndef DNS_FORWARD_H
00021 #define DNS_FORWARD_H 1
00022 
00023 /*! \file dns/forward.h */
00024 
00025 #include <isc/lang.h>
00026 #include <isc/result.h>
00027 
00028 #include <dns/types.h>
00029 
00030 ISC_LANG_BEGINDECLS
00031 
00032 struct dns_forwarder {
00033         isc_sockaddr_t                  addr;
00034         isc_dscp_t                      dscp;
00035         ISC_LINK(dns_forwarder_t)       link;
00036 };
00037 
00038 typedef ISC_LIST(struct dns_forwarder)  dns_forwarderlist_t;
00039 
00040 struct dns_forwarders {
00041         dns_forwarderlist_t     fwdrs;
00042         dns_fwdpolicy_t         fwdpolicy;
00043 };
00044 
00045 isc_result_t
00046 dns_fwdtable_create(isc_mem_t *mctx, dns_fwdtable_t **fwdtablep);
00047 /*%<
00048  * Creates a new forwarding table.
00049  *
00050  * Requires:
00051  * \li  mctx is a valid memory context.
00052  * \li  fwdtablep != NULL && *fwdtablep == NULL
00053  *
00054  * Returns:
00055  * \li  #ISC_R_SUCCESS
00056  * \li  #ISC_R_NOMEMORY
00057  */
00058 
00059 isc_result_t
00060 dns_fwdtable_addfwd(dns_fwdtable_t *fwdtable, dns_name_t *name,
00061                     dns_forwarderlist_t *fwdrs, dns_fwdpolicy_t policy);
00062 isc_result_t
00063 dns_fwdtable_add(dns_fwdtable_t *fwdtable, dns_name_t *name,
00064                  isc_sockaddrlist_t *addrs, dns_fwdpolicy_t policy);
00065 /*%<
00066  * Adds an entry to the forwarding table.  The entry associates
00067  * a domain with a list of forwarders and a forwarding policy.  The
00068  * addrs/fwdrs list is copied if not empty, so the caller should free
00069  * its copy.
00070  *
00071  * Requires:
00072  * \li  fwdtable is a valid forwarding table.
00073  * \li  name is a valid name
00074  * \li  addrs/fwdrs is a valid list of isc_sockaddr/dns_forwarder
00075  *      structures, which may be empty.
00076  *
00077  * Returns:
00078  * \li  #ISC_R_SUCCESS
00079  * \li  #ISC_R_NOMEMORY
00080  */
00081 
00082 isc_result_t
00083 dns_fwdtable_delete(dns_fwdtable_t *fwdtable, dns_name_t *name);
00084 /*%<
00085  * Removes an entry for 'name' from the forwarding table.  If an entry
00086  * that exactly matches 'name' does not exist, ISC_R_NOTFOUND will be returned.
00087  *
00088  * Requires:
00089  * \li  fwdtable is a valid forwarding table.
00090  * \li  name is a valid name
00091  *
00092  * Returns:
00093  * \li  #ISC_R_SUCCESS
00094  * \li  #ISC_R_NOTFOUND
00095  */
00096 
00097 isc_result_t
00098 dns_fwdtable_find(dns_fwdtable_t *fwdtable, dns_name_t *name,
00099                   dns_forwarders_t **forwardersp);
00100 /*%<
00101  * Finds a domain in the forwarding table.  The closest matching parent
00102  * domain is returned.
00103  *
00104  * Requires:
00105  * \li  fwdtable is a valid forwarding table.
00106  * \li  name is a valid name
00107  * \li  forwardersp != NULL && *forwardersp == NULL
00108  *
00109  * Returns:
00110  * \li  #ISC_R_SUCCESS
00111  * \li  #ISC_R_NOTFOUND
00112  */
00113 
00114 isc_result_t
00115 dns_fwdtable_find2(dns_fwdtable_t *fwdtable, dns_name_t *name,
00116                    dns_name_t *foundname, dns_forwarders_t **forwardersp);
00117 /*%<
00118  * Finds a domain in the forwarding table.  The closest matching parent
00119  * domain is returned.
00120  *
00121  * Requires:
00122  * \li  fwdtable is a valid forwarding table.
00123  * \li  name is a valid name
00124  * \li  forwardersp != NULL && *forwardersp == NULL
00125  * \li  foundname to be NULL or a valid name with buffer.
00126  *
00127  * Returns:
00128  * \li  #ISC_R_SUCCESS
00129  * \li  #ISC_R_NOTFOUND
00130  */
00131 
00132 void
00133 dns_fwdtable_destroy(dns_fwdtable_t **fwdtablep);
00134 /*%<
00135  * Destroys a forwarding table.
00136  *
00137  * Requires:
00138  * \li  fwtablep != NULL && *fwtablep != NULL
00139  *
00140  * Ensures:
00141  * \li  all memory associated with the forwarding table is freed.
00142  */
00143 
00144 ISC_LANG_ENDDECLS
00145 
00146 #endif /* DNS_FORWARD_H */

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