Merge branch 'vendor/EXPAT'
[dragonfly.git] / contrib / bind / lib / dns / include / dns / portlist.h
1 /*
2  * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 2003  Internet Software Consortium.
4  *
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.
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: portlist.h,v 1.9 2007/06/19 23:47:17 tbox Exp $ */
19
20 /*! \file dns/portlist.h */
21
22 #include <isc/lang.h>
23 #include <isc/net.h>
24 #include <isc/types.h>
25
26 #include <dns/types.h>
27
28 ISC_LANG_BEGINDECLS
29
30 isc_result_t
31 dns_portlist_create(isc_mem_t *mctx, dns_portlist_t **portlistp);
32 /*%<
33  * Create a port list.
34  * 
35  * Requires:
36  *\li   'mctx' to be valid.
37  *\li   'portlistp' to be non NULL and '*portlistp' to be NULL;
38  *
39  * Returns:
40  *\li   #ISC_R_SUCCESS
41  *\li   #ISC_R_NOMEMORY
42  *\li   #ISC_R_UNEXPECTED
43  */
44
45 isc_result_t
46 dns_portlist_add(dns_portlist_t *portlist, int af, in_port_t port);
47 /*%<
48  * Add the given <port,af> tuple to the portlist.
49  *
50  * Requires:
51  *\li   'portlist' to be valid.
52  *\li   'af' to be AF_INET or AF_INET6
53  *
54  * Returns:
55  *\li   #ISC_R_SUCCESS
56  *\li   #ISC_R_NOMEMORY
57  */
58
59 void
60 dns_portlist_remove(dns_portlist_t *portlist, int af, in_port_t port);
61 /*%<
62  * Remove the given <port,af> tuple to the portlist.
63  *
64  * Requires:
65  *\li   'portlist' to be valid.
66  *\li   'af' to be AF_INET or AF_INET6
67  */
68
69 isc_boolean_t
70 dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port);
71 /*%<
72  * Find the given <port,af> tuple to the portlist.
73  *
74  * Requires:
75  *\li   'portlist' to be valid.
76  *\li   'af' to be AF_INET or AF_INET6
77  *
78  * Returns
79  * \li  #ISC_TRUE if the tuple is found, ISC_FALSE otherwise.
80  */
81
82 void
83 dns_portlist_attach(dns_portlist_t *portlist, dns_portlist_t **portlistp);
84 /*%<
85  * Attach to a port list.
86  *
87  * Requires:
88  *\li   'portlist' to be valid.
89  *\li   'portlistp' to be non NULL and '*portlistp' to be NULL;
90  */
91
92 void
93 dns_portlist_detach(dns_portlist_t **portlistp);
94 /*%<
95  * Detach from a port list.
96  *
97  * Requires:
98  *\li   '*portlistp' to be valid.
99  */
100
101 ISC_LANG_ENDDECLS