Import bind 9.5.2 vendor sources.
[dragonfly.git] / contrib / bind-9.5.2 / lib / dns / include / dns / forward.h
blob512c5e3c6ed243016d6527a8953b86a109ade3ec
1 /*
2 * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000, 2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: forward.h,v 1.11 2007/06/19 23:47:16 tbox Exp $ */
20 #ifndef DNS_FORWARD_H
21 #define DNS_FORWARD_H 1
23 /*! \file dns/forward.h */
25 #include <isc/lang.h>
26 #include <isc/result.h>
28 #include <dns/types.h>
30 ISC_LANG_BEGINDECLS
32 struct dns_forwarders {
33 isc_sockaddrlist_t addrs;
34 dns_fwdpolicy_t fwdpolicy;
37 isc_result_t
38 dns_fwdtable_create(isc_mem_t *mctx, dns_fwdtable_t **fwdtablep);
39 /*%<
40 * Creates a new forwarding table.
42 * Requires:
43 * \li mctx is a valid memory context.
44 * \li fwdtablep != NULL && *fwdtablep == NULL
46 * Returns:
47 * \li #ISC_R_SUCCESS
48 * \li #ISC_R_NOMEMORY
51 isc_result_t
52 dns_fwdtable_add(dns_fwdtable_t *fwdtable, dns_name_t *name,
53 isc_sockaddrlist_t *addrs, dns_fwdpolicy_t policy);
54 /*%<
55 * Adds an entry to the forwarding table. The entry associates
56 * a domain with a list of forwarders and a forwarding policy. The
57 * addrs list is copied if not empty, so the caller should free its copy.
59 * Requires:
60 * \li fwdtable is a valid forwarding table.
61 * \li name is a valid name
62 * \li addrs is a valid list of sockaddrs, which may be empty.
64 * Returns:
65 * \li #ISC_R_SUCCESS
66 * \li #ISC_R_NOMEMORY
69 isc_result_t
70 dns_fwdtable_find(dns_fwdtable_t *fwdtable, dns_name_t *name,
71 dns_forwarders_t **forwardersp);
72 /*%<
73 * Finds a domain in the forwarding table. The closest matching parent
74 * domain is returned.
76 * Requires:
77 * \li fwdtable is a valid forwarding table.
78 * \li name is a valid name
79 * \li forwardersp != NULL && *forwardersp == NULL
81 * Returns:
82 * \li #ISC_R_SUCCESS
83 * \li #ISC_R_NOTFOUND
86 isc_result_t
87 dns_fwdtable_find2(dns_fwdtable_t *fwdtable, dns_name_t *name,
88 dns_name_t *foundname, dns_forwarders_t **forwardersp);
89 /*%<
90 * Finds a domain in the forwarding table. The closest matching parent
91 * domain is returned.
93 * Requires:
94 * \li fwdtable is a valid forwarding table.
95 * \li name is a valid name
96 * \li forwardersp != NULL && *forwardersp == NULL
97 * \li foundname to be NULL or a valid name with buffer.
99 * Returns:
100 * \li #ISC_R_SUCCESS
101 * \li #ISC_R_NOTFOUND
104 void
105 dns_fwdtable_destroy(dns_fwdtable_t **fwdtablep);
106 /*%<
107 * Destroys a forwarding table.
109 * Requires:
110 * \li fwtablep != NULL && *fwtablep != NULL
112 * Ensures:
113 * \li all memory associated with the forwarding table is freed.
116 ISC_LANG_ENDDECLS
118 #endif /* DNS_FORWARD_H */