00001 /* 00002 * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 2003 Internet Software Consortium. 00004 * 00005 * Permission to use, copy, modify, and/or distribute this software for any 00006 * purpose with or without fee is hereby granted, provided that the above 00007 * copyright notice and this permission notice appear in all copies. 00008 * 00009 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00010 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00011 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00012 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00013 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00014 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00015 * PERFORMANCE OF THIS SOFTWARE. 00016 */ 00017 00018 /* $Id: portlist.h,v 1.9 2007/06/19 23:47:17 tbox Exp $ */ 00019 00020 /*! \file dns/portlist.h */ 00021 00022 #include <isc/lang.h> 00023 #include <isc/net.h> 00024 #include <isc/types.h> 00025 00026 #include <dns/types.h> 00027 00028 ISC_LANG_BEGINDECLS 00029 00030 isc_result_t 00031 dns_portlist_create(isc_mem_t *mctx, dns_portlist_t **portlistp); 00032 /*%< 00033 * Create a port list. 00034 * 00035 * Requires: 00036 *\li 'mctx' to be valid. 00037 *\li 'portlistp' to be non NULL and '*portlistp' to be NULL; 00038 * 00039 * Returns: 00040 *\li #ISC_R_SUCCESS 00041 *\li #ISC_R_NOMEMORY 00042 *\li #ISC_R_UNEXPECTED 00043 */ 00044 00045 isc_result_t 00046 dns_portlist_add(dns_portlist_t *portlist, int af, in_port_t port); 00047 /*%< 00048 * Add the given <port,af> tuple to the portlist. 00049 * 00050 * Requires: 00051 *\li 'portlist' to be valid. 00052 *\li 'af' to be AF_INET or AF_INET6 00053 * 00054 * Returns: 00055 *\li #ISC_R_SUCCESS 00056 *\li #ISC_R_NOMEMORY 00057 */ 00058 00059 void 00060 dns_portlist_remove(dns_portlist_t *portlist, int af, in_port_t port); 00061 /*%< 00062 * Remove the given <port,af> tuple to the portlist. 00063 * 00064 * Requires: 00065 *\li 'portlist' to be valid. 00066 *\li 'af' to be AF_INET or AF_INET6 00067 */ 00068 00069 isc_boolean_t 00070 dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port); 00071 /*%< 00072 * Find the given <port,af> tuple to the portlist. 00073 * 00074 * Requires: 00075 *\li 'portlist' to be valid. 00076 *\li 'af' to be AF_INET or AF_INET6 00077 * 00078 * Returns 00079 * \li #ISC_TRUE if the tuple is found, ISC_FALSE otherwise. 00080 */ 00081 00082 void 00083 dns_portlist_attach(dns_portlist_t *portlist, dns_portlist_t **portlistp); 00084 /*%< 00085 * Attach to a port list. 00086 * 00087 * Requires: 00088 *\li 'portlist' to be valid. 00089 *\li 'portlistp' to be non NULL and '*portlistp' to be NULL; 00090 */ 00091 00092 void 00093 dns_portlist_detach(dns_portlist_t **portlistp); 00094 /*%< 00095 * Detach from a port list. 00096 * 00097 * Requires: 00098 *\li '*portlistp' to be valid. 00099 */ 00100 00101 ISC_LANG_ENDDECLS