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