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