#include <config.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/rwlock.h>
#include <isc/sockaddr.h>
#include <isc/util.h>
#include <dns/forward.h>
#include <dns/rbt.h>
#include <dns/result.h>
#include <dns/types.h>
Go to the source code of this file.
Data Structures | |
struct | dns_fwdtable |
Defines | |
#define | FWDTABLEMAGIC ISC_MAGIC('F', 'w', 'd', 'T') |
#define | VALID_FWDTABLE(ft) ISC_MAGIC_VALID(ft, FWDTABLEMAGIC) |
Functions | |
static void | auto_detach (void *, void *) |
isc_result_t | dns_fwdtable_create (isc_mem_t *mctx, dns_fwdtable_t **fwdtablep) |
Creates a new forwarding table. | |
isc_result_t | dns_fwdtable_addfwd (dns_fwdtable_t *fwdtable, dns_name_t *name, dns_forwarderlist_t *fwdrs, dns_fwdpolicy_t fwdpolicy) |
isc_result_t | dns_fwdtable_add (dns_fwdtable_t *fwdtable, dns_name_t *name, isc_sockaddrlist_t *addrs, dns_fwdpolicy_t fwdpolicy) |
Adds an entry to the forwarding table. The entry associates a domain with a list of forwarders and a forwarding policy. The addrs/fwdrs list is copied if not empty, so the caller should free its copy. | |
isc_result_t | dns_fwdtable_delete (dns_fwdtable_t *fwdtable, dns_name_t *name) |
Removes an entry for 'name' from the forwarding table. If an entry that exactly matches 'name' does not exist, ISC_R_NOTFOUND will be returned. | |
isc_result_t | dns_fwdtable_find (dns_fwdtable_t *fwdtable, dns_name_t *name, dns_forwarders_t **forwardersp) |
Finds a domain in the forwarding table. The closest matching parent domain is returned. | |
isc_result_t | dns_fwdtable_find2 (dns_fwdtable_t *fwdtable, dns_name_t *name, dns_name_t *foundname, dns_forwarders_t **forwardersp) |
Finds a domain in the forwarding table. The closest matching parent domain is returned. | |
void | dns_fwdtable_destroy (dns_fwdtable_t **fwdtablep) |
Destroys a forwarding table. |
Definition in file forward.c.
#define FWDTABLEMAGIC ISC_MAGIC('F', 'w', 'd', 'T') |
#define VALID_FWDTABLE | ( | ft | ) | ISC_MAGIC_VALID(ft, FWDTABLEMAGIC) |
Definition at line 45 of file forward.c.
Referenced by dns_fwdtable_add(), dns_fwdtable_addfwd(), dns_fwdtable_delete(), dns_fwdtable_destroy(), and dns_fwdtable_find2().
static void auto_detach | ( | void * | data, | |
void * | arg | |||
) | [static] |
Definition at line 253 of file forward.c.
References dns_forwarders::fwdrs, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, isc_mem_put, dns_fwdtable::mctx, and UNUSED.
Referenced by dns_fwdtable_create(), and dns_zt_create().
isc_result_t dns_fwdtable_create | ( | isc_mem_t * | mctx, | |
dns_fwdtable_t ** | fwdtablep | |||
) |
Creates a new forwarding table.
Requires:
Definition at line 51 of file forward.c.
References auto_detach(), dns_rbt_create(), dns_rbt_destroy(), FWDTABLEMAGIC, isc_mem_attach(), isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlock_init(), dns_fwdtable::magic, dns_fwdtable::mctx, REQUIRE, dns_fwdtable::rwlock, and dns_fwdtable::table.
Referenced by dns_view_create().
isc_result_t dns_fwdtable_addfwd | ( | dns_fwdtable_t * | fwdtable, | |
dns_name_t * | name, | |||
dns_forwarderlist_t * | fwdrs, | |||
dns_fwdpolicy_t | fwdpolicy | |||
) |
Definition at line 87 of file forward.c.
References cleanup(), dns_rbt_addname(), dns_forwarders::fwdpolicy, dns_forwarders::fwdrs, ISC_LINK_INIT, ISC_LIST_APPEND, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_INIT, ISC_LIST_NEXT, ISC_LIST_UNLINK, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlocktype_write, dns_fwdtable::mctx, REQUIRE, dns_fwdtable::rwlock, RWLOCK, RWUNLOCK, dns_fwdtable::table, and VALID_FWDTABLE.
Referenced by configure_forward().
isc_result_t dns_fwdtable_add | ( | dns_fwdtable_t * | fwdtable, | |
dns_name_t * | name, | |||
isc_sockaddrlist_t * | addrs, | |||
dns_fwdpolicy_t | policy | |||
) |
Adds an entry to the forwarding table. The entry associates a domain with a list of forwarders and a forwarding policy. The addrs/fwdrs list is copied if not empty, so the caller should free its copy.
Requires:
Definition at line 136 of file forward.c.
References dns_forwarder::addr, cleanup(), dns_rbt_addname(), dns_forwarder::dscp, dns_forwarders::fwdpolicy, dns_forwarders::fwdrs, ISC_LINK_INIT, ISC_LIST_APPEND, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_INIT, ISC_LIST_NEXT, ISC_LIST_UNLINK, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlocktype_write, dns_fwdtable::mctx, REQUIRE, dns_fwdtable::rwlock, RWLOCK, RWUNLOCK, dns_fwdtable::table, and VALID_FWDTABLE.
Referenced by dns_client_setservers().
isc_result_t dns_fwdtable_delete | ( | dns_fwdtable_t * | fwdtable, | |
dns_name_t * | name | |||
) |
Removes an entry for 'name' from the forwarding table. If an entry that exactly matches 'name' does not exist, ISC_R_NOTFOUND will be returned.
Requires:
Definition at line 187 of file forward.c.
References DNS_R_PARTIALMATCH, dns_rbt_deletename(), ISC_FALSE, ISC_R_NOTFOUND, isc_rwlocktype_write, REQUIRE, dns_fwdtable::rwlock, RWLOCK, RWUNLOCK, dns_fwdtable::table, and VALID_FWDTABLE.
Referenced by dns_client_clearservers().
isc_result_t dns_fwdtable_find | ( | dns_fwdtable_t * | fwdtable, | |
dns_name_t * | name, | |||
dns_forwarders_t ** | forwardersp | |||
) |
Finds a domain in the forwarding table. The closest matching parent domain is returned.
Requires:
Definition at line 203 of file forward.c.
References dns_fwdtable_find2().
Referenced by configure_view().
isc_result_t dns_fwdtable_find2 | ( | dns_fwdtable_t * | fwdtable, | |
dns_name_t * | name, | |||
dns_name_t * | foundname, | |||
dns_forwarders_t ** | forwardersp | |||
) |
Finds a domain in the forwarding table. The closest matching parent domain is returned.
Requires:
Definition at line 210 of file forward.c.
References DNS_R_PARTIALMATCH, dns_rbt_findname(), ISC_R_SUCCESS, isc_rwlocktype_read, REQUIRE, dns_fwdtable::rwlock, RWLOCK, RWUNLOCK, dns_fwdtable::table, and VALID_FWDTABLE.
Referenced by dns_fwdtable_find(), fctx_create(), and fctx_getaddresses().
void dns_fwdtable_destroy | ( | dns_fwdtable_t ** | fwdtablep | ) |
Destroys a forwarding table.
Requires:
Definition at line 230 of file forward.c.
References dns_rbt_destroy(), isc_mem_detach(), isc_mem_put, isc_rwlock_destroy(), dns_fwdtable::magic, dns_fwdtable::mctx, mctx, REQUIRE, dns_fwdtable::rwlock, dns_fwdtable::table, and VALID_FWDTABLE.
Referenced by destroy(), and dns_view_create().