]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/bind9/lib/dns/include/dns/iptable.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / bind9 / lib / dns / include / dns / iptable.h
1 /*
2  * Copyright (C) 2007, 2012  Internet Systems Consortium, Inc. ("ISC")
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14  * PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 /* $Id: iptable.h,v 1.4 2007/09/14 01:46:05 marka Exp $ */
18
19 #ifndef DNS_IPTABLE_H
20 #define DNS_IPTABLE_H 1
21
22 #include <isc/lang.h>
23 #include <isc/magic.h>
24 #include <isc/radix.h>
25
26 #include <dns/types.h>
27
28 struct dns_iptable {
29         unsigned int            magic;
30         isc_mem_t               *mctx;
31         isc_refcount_t          refcount;
32         isc_radix_tree_t        *radix;
33         ISC_LINK(dns_iptable_t) nextincache;
34 };
35
36 #define DNS_IPTABLE_MAGIC       ISC_MAGIC('T','a','b','l')
37 #define DNS_IPTABLE_VALID(a)    ISC_MAGIC_VALID(a, DNS_IPTABLE_MAGIC)
38
39 /***
40  *** Functions
41  ***/
42
43 ISC_LANG_BEGINDECLS
44
45 isc_result_t
46 dns_iptable_create(isc_mem_t *mctx, dns_iptable_t **target);
47 /*
48  * Create a new IP table and the underlying radix structure
49  */
50
51 isc_result_t
52 dns_iptable_addprefix(dns_iptable_t *tab, isc_netaddr_t *addr,
53                       isc_uint16_t bitlen, isc_boolean_t pos);
54 /*
55  * Add an IP prefix to an existing IP table
56  */
57
58 isc_result_t
59 dns_iptable_merge(dns_iptable_t *tab, dns_iptable_t *source, isc_boolean_t pos);
60 /*
61  * Merge one IP table into another one.
62  */
63
64 void
65 dns_iptable_attach(dns_iptable_t *source, dns_iptable_t **target);
66
67 void
68 dns_iptable_detach(dns_iptable_t **tabp);
69
70 ISC_LANG_ENDDECLS
71
72 #endif /* DNS_IPTABLE_H */