00001 /* 00002 * Copyright (C) 2004-2007, 2010-2014 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 1999-2001 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$ */ 00019 00020 #ifndef ISCCFG_ACLCONF_H 00021 #define ISCCFG_ACLCONF_H 1 00022 00023 #include <isc/lang.h> 00024 00025 #include <isccfg/cfg.h> 00026 00027 #ifdef HAVE_GEOIP 00028 #include <dns/geoip.h> 00029 #endif 00030 #include <dns/types.h> 00031 00032 typedef struct cfg_aclconfctx { 00033 ISC_LIST(dns_acl_t) named_acl_cache; 00034 isc_mem_t *mctx; 00035 #ifdef HAVE_GEOIP 00036 dns_geoip_databases_t *geoip; 00037 #endif 00038 isc_refcount_t references; 00039 } cfg_aclconfctx_t; 00040 00041 /*** 00042 *** Functions 00043 ***/ 00044 00045 ISC_LANG_BEGINDECLS 00046 00047 isc_result_t 00048 cfg_aclconfctx_create(isc_mem_t *mctx, cfg_aclconfctx_t **ret); 00049 /* 00050 * Creates and initializes an ACL configuration context. 00051 */ 00052 00053 void 00054 cfg_aclconfctx_detach(cfg_aclconfctx_t **actxp); 00055 /* 00056 * Removes a reference to an ACL configuration context; when references 00057 * reaches zero, clears the contents and deallocate the structure. 00058 */ 00059 00060 void 00061 cfg_aclconfctx_attach(cfg_aclconfctx_t *src, cfg_aclconfctx_t **dest); 00062 /* 00063 * Attaches a pointer to an existing ACL configuration context. 00064 */ 00065 00066 isc_result_t 00067 cfg_acl_fromconfig(const cfg_obj_t *caml, const cfg_obj_t *cctx, 00068 isc_log_t *lctx, cfg_aclconfctx_t *ctx, 00069 isc_mem_t *mctx, unsigned int nest_level, 00070 dns_acl_t **target); 00071 00072 isc_result_t 00073 cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, 00074 isc_log_t *lctx, cfg_aclconfctx_t *ctx, 00075 isc_mem_t *mctx, unsigned int nest_level, 00076 isc_uint16_t family, dns_acl_t **target); 00077 /* 00078 * Construct a new dns_acl_t from configuration data in 'caml' and 00079 * 'cctx'. Memory is allocated through 'mctx'. 00080 * 00081 * Any named ACLs referred to within 'caml' will be be converted 00082 * into nested dns_acl_t objects. Multiple references to the same 00083 * named ACLs will be converted into shared references to a single 00084 * nested dns_acl_t object when the referring objects were created 00085 * passing the same ACL configuration context 'ctx'. 00086 * 00087 * cfg_acl_fromconfig() is a backward-compatible version of 00088 * cfg_acl_fromconfig2(), which allows an address family to be 00089 * specified. If 'family' is not zero, then only addresses/prefixes 00090 * of a matching family (AF_INET or AF_INET6) may be configured. 00091 * 00092 * On success, attach '*target' to the new dns_acl_t object. 00093 */ 00094 00095 ISC_LANG_ENDDECLS 00096 00097 #endif /* ISCCFG_ACLCONF_H */