Merge from vendor branch WPA_SUPPLICANT:
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / dns / include / dns / forward.h
1 /*
2  * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 2000, 2001  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and 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.
8  *
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.
16  */
17
18 /* $Id: forward.h,v 1.2.2.1 2004/03/09 06:11:16 marka Exp $ */
19
20 #ifndef DNS_FORWARD_H
21 #define DNS_FORWARD_H 1
22
23 #include <isc/lang.h>
24 #include <isc/result.h>
25
26 #include <dns/types.h>
27
28 ISC_LANG_BEGINDECLS
29
30 struct dns_forwarders {
31         isc_sockaddrlist_t      addrs;
32         dns_fwdpolicy_t         fwdpolicy;
33 };
34
35 isc_result_t
36 dns_fwdtable_create(isc_mem_t *mctx, dns_fwdtable_t **fwdtablep);
37 /*
38  * Creates a new forwarding table.
39  *
40  * Requires:
41  *      mctx is a valid memory context.
42  *      fwdtablep != NULL && *fwdtablep == NULL
43  *
44  * Returns:
45  *      ISC_R_SUCCESS
46  *      ISC_R_NOMEMORY
47  */
48
49 isc_result_t
50 dns_fwdtable_add(dns_fwdtable_t *fwdtable, dns_name_t *name,
51                  isc_sockaddrlist_t *addrs, dns_fwdpolicy_t policy);
52 /*
53  * Adds an entry to the forwarding table.  The entry associates
54  * a domain with a list of forwarders and a forwarding policy.  The
55  * addrs list is copied if not empty, so the caller should free its copy.
56  *
57  * Requires:
58  *      fwdtable is a valid forwarding table.
59  *      name is a valid name
60  *      addrs is a valid list of sockaddrs, which may be empty.
61  *
62  * Returns:
63  *      ISC_R_SUCCESS
64  *      ISC_R_NOMEMORY
65  */
66
67 isc_result_t
68 dns_fwdtable_find(dns_fwdtable_t *fwdtable, dns_name_t *name,
69                   dns_forwarders_t **forwardersp);
70 /*
71  * Finds a domain in the forwarding table.  The closest matching parent
72  * domain is returned.
73  *
74  * Requires:
75  *      fwdtable is a valid forwarding table.
76  *      name is a valid name
77  *      forwardersp != NULL && *forwardersp == NULL
78  *
79  * Returns:
80  *      ISC_R_SUCCESS
81  *      ISC_R_NOTFOUND
82  */
83
84 void
85 dns_fwdtable_destroy(dns_fwdtable_t **fwdtablep);
86 /*
87  * Destroys a forwarding table.
88  *
89  * Requires:
90  *      fwtablep != NULL && *fwtablep != NULL
91  *
92  * Ensures:
93  *      all memory associated with the forwarding table is freed.
94  */
95
96 ISC_LANG_ENDDECLS
97
98 #endif /* DNS_FORWARD_H */