1 /*	$NetBSD: listenlist.h,v 1.5 2014/12/10 04:37:52 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004, 2005, 2007, 2013  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 2000, 2001  Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /* Id: listenlist.h,v 1.15 2007/06/19 23:46:59 tbox Exp  */
21 
22 #ifndef NAMED_LISTENLIST_H
23 #define NAMED_LISTENLIST_H 1
24 
25 /*****
26  ***** Module Info
27  *****/
28 
29 /*! \file
30  * \brief
31  * "Listen lists", as in the "listen-on" configuration statement.
32  */
33 
34 /***
35  *** Imports
36  ***/
37 #include <isc/net.h>
38 
39 #include <dns/types.h>
40 
41 /***
42  *** Types
43  ***/
44 
45 typedef struct ns_listenelt ns_listenelt_t;
46 typedef struct ns_listenlist ns_listenlist_t;
47 
48 struct ns_listenelt {
49 	isc_mem_t *	       		mctx;
50 	in_port_t			port;
51 	isc_dscp_t			dscp;  /* -1 = not set, 0..63 */
52 	dns_acl_t *	       		acl;
53 	ISC_LINK(ns_listenelt_t)	link;
54 };
55 
56 struct ns_listenlist {
57 	isc_mem_t *			mctx;
58 	int				refcount;
59 	ISC_LIST(ns_listenelt_t)	elts;
60 };
61 
62 /***
63  *** Functions
64  ***/
65 
66 isc_result_t
67 ns_listenelt_create(isc_mem_t *mctx, in_port_t port, isc_dscp_t dscp,
68 		    dns_acl_t *acl, ns_listenelt_t **target);
69 /*%
70  * Create a listen-on list element.
71  */
72 
73 void
74 ns_listenelt_destroy(ns_listenelt_t *elt);
75 /*%
76  * Destroy a listen-on list element.
77  */
78 
79 isc_result_t
80 ns_listenlist_create(isc_mem_t *mctx, ns_listenlist_t **target);
81 /*%
82  * Create a new, empty listen-on list.
83  */
84 
85 void
86 ns_listenlist_attach(ns_listenlist_t *source, ns_listenlist_t **target);
87 /*%
88  * Attach '*target' to '*source'.
89  */
90 
91 void
92 ns_listenlist_detach(ns_listenlist_t **listp);
93 /*%
94  * Detach 'listp'.
95  */
96 
97 isc_result_t
98 ns_listenlist_default(isc_mem_t *mctx, in_port_t port, isc_dscp_t dscp,
99 		      isc_boolean_t enabled, ns_listenlist_t **target);
100 /*%
101  * Create a listen-on list with default contents, matching
102  * all addresses with port 'port' (if 'enabled' is ISC_TRUE),
103  * or no addresses (if 'enabled' is ISC_FALSE).
104  */
105 
106 #endif /* NAMED_LISTENLIST_H */
107 
108 
109