1/* $NetBSD: listenlist.h,v 1.2.6.1 2012/06/05 21:15:09 bouyer Exp $ */ 2 3/* 4 * Copyright (C) 2004, 2005, 2007 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 45typedef struct ns_listenelt ns_listenelt_t; 46typedef struct ns_listenlist ns_listenlist_t; 47 48struct ns_listenelt { 49 isc_mem_t * mctx; 50 in_port_t port; 51 dns_acl_t * acl; 52 ISC_LINK(ns_listenelt_t) link; 53}; 54 55struct ns_listenlist { 56 isc_mem_t * mctx; 57 int refcount; 58 ISC_LIST(ns_listenelt_t) elts; 59}; 60 61/*** 62 *** Functions 63 ***/ 64 65isc_result_t 66ns_listenelt_create(isc_mem_t *mctx, in_port_t port, 67 dns_acl_t *acl, ns_listenelt_t **target); 68/*% 69 * Create a listen-on list element. 70 */ 71 72void 73ns_listenelt_destroy(ns_listenelt_t *elt); 74/*% 75 * Destroy a listen-on list element. 76 */ 77 78isc_result_t 79ns_listenlist_create(isc_mem_t *mctx, ns_listenlist_t **target); 80/*% 81 * Create a new, empty listen-on list. 82 */ 83 84void 85ns_listenlist_attach(ns_listenlist_t *source, ns_listenlist_t **target); 86/*% 87 * Attach '*target' to '*source'. 88 */ 89 90void 91ns_listenlist_detach(ns_listenlist_t **listp); 92/*% 93 * Detach 'listp'. 94 */ 95 96isc_result_t 97ns_listenlist_default(isc_mem_t *mctx, in_port_t port, 98 isc_boolean_t enabled, ns_listenlist_t **target); 99/*% 100 * Create a listen-on list with default contents, matching 101 * all addresses with port 'port' (if 'enabled' is ISC_TRUE), 102 * or no addresses (if 'enabled' is ISC_FALSE). 103 */ 104 105#endif /* NAMED_LISTENLIST_H */ 106 107 108