00001 /* 00002 * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 1999-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: globals.h,v 1.92 2011/11/09 18:44:04 each Exp $ */ 00019 00020 #ifndef NAMED_GLOBALS_H 00021 #define NAMED_GLOBALS_H 1 00022 00023 /*! \file */ 00024 00025 #include <isc/rwlock.h> 00026 #include <isc/log.h> 00027 #include <isc/net.h> 00028 00029 #include <isccfg/aclconf.h> 00030 #include <isccfg/cfg.h> 00031 00032 #include <dns/acl.h> 00033 #include <dns/zone.h> 00034 00035 #include <dst/dst.h> 00036 00037 #include <named/types.h> 00038 00039 #undef EXTERN 00040 #undef INIT 00041 #ifdef NS_MAIN 00042 #define EXTERN 00043 #define INIT(v) = (v) 00044 #else 00045 #define EXTERN extern 00046 #define INIT(v) 00047 #endif 00048 00049 #ifndef NS_RUN_PID_DIR 00050 #define NS_RUN_PID_DIR 1 00051 #endif 00052 00053 EXTERN isc_mem_t * ns_g_mctx INIT(NULL); 00054 EXTERN unsigned int ns_g_cpus INIT(0); 00055 EXTERN unsigned int ns_g_udpdisp INIT(0); 00056 EXTERN isc_taskmgr_t * ns_g_taskmgr INIT(NULL); 00057 EXTERN dns_dispatchmgr_t * ns_g_dispatchmgr INIT(NULL); 00058 EXTERN isc_entropy_t * ns_g_entropy INIT(NULL); 00059 EXTERN isc_entropy_t * ns_g_fallbackentropy INIT(NULL); 00060 EXTERN unsigned int ns_g_cpus_detected INIT(1); 00061 00062 /* 00063 * XXXRTH We're going to want multiple timer managers eventually. One 00064 * for really short timers, another for client timers, and one 00065 * for zone timers. 00066 */ 00067 EXTERN isc_timermgr_t * ns_g_timermgr INIT(NULL); 00068 EXTERN isc_socketmgr_t * ns_g_socketmgr INIT(NULL); 00069 EXTERN cfg_parser_t * ns_g_parser INIT(NULL); 00070 EXTERN cfg_parser_t * ns_g_addparser INIT(NULL); 00071 EXTERN const char * ns_g_version INIT(VERSION); 00072 EXTERN const char * ns_g_product INIT(PRODUCT); 00073 EXTERN const char * ns_g_description INIT(DESCRIPTION); 00074 EXTERN const char * ns_g_srcid INIT(SRCID); 00075 EXTERN const char * ns_g_configargs INIT(CONFIGARGS); 00076 EXTERN const char * ns_g_builder INIT(BUILDER); 00077 EXTERN in_port_t ns_g_port INIT(0); 00078 EXTERN isc_dscp_t ns_g_dscp INIT(-1); 00079 EXTERN in_port_t lwresd_g_listenport INIT(0); 00080 00081 EXTERN ns_server_t * ns_g_server INIT(NULL); 00082 00083 EXTERN isc_boolean_t ns_g_lwresdonly INIT(ISC_FALSE); 00084 00085 /* 00086 * Logging. 00087 */ 00088 EXTERN isc_log_t * ns_g_lctx INIT(NULL); 00089 EXTERN isc_logcategory_t * ns_g_categories INIT(NULL); 00090 EXTERN isc_logmodule_t * ns_g_modules INIT(NULL); 00091 EXTERN unsigned int ns_g_debuglevel INIT(0); 00092 00093 /* 00094 * Current configuration information. 00095 */ 00096 EXTERN cfg_obj_t * ns_g_config INIT(NULL); 00097 EXTERN const cfg_obj_t * ns_g_defaults INIT(NULL); 00098 EXTERN const char * ns_g_conffile INIT(NS_SYSCONFDIR 00099 "/named.conf"); 00100 EXTERN cfg_obj_t * ns_g_bindkeys INIT(NULL); 00101 EXTERN const char * ns_g_keyfile INIT(NS_SYSCONFDIR 00102 "/rndc.key"); 00103 00104 EXTERN dns_tsigkey_t * ns_g_sessionkey INIT(NULL); 00105 EXTERN dns_name_t ns_g_sessionkeyname; 00106 00107 EXTERN const char * lwresd_g_conffile INIT(NS_SYSCONFDIR 00108 "/lwresd.conf"); 00109 EXTERN const char * lwresd_g_resolvconffile INIT("/etc" 00110 "/resolv.conf"); 00111 EXTERN isc_boolean_t ns_g_conffileset INIT(ISC_FALSE); 00112 EXTERN isc_boolean_t lwresd_g_useresolvconf INIT(ISC_FALSE); 00113 EXTERN isc_uint16_t ns_g_udpsize INIT(4096); 00114 EXTERN cfg_aclconfctx_t * ns_g_aclconfctx INIT(NULL); 00115 00116 /* 00117 * Initial resource limits. 00118 */ 00119 EXTERN isc_resourcevalue_t ns_g_initstacksize INIT(0); 00120 EXTERN isc_resourcevalue_t ns_g_initdatasize INIT(0); 00121 EXTERN isc_resourcevalue_t ns_g_initcoresize INIT(0); 00122 EXTERN isc_resourcevalue_t ns_g_initopenfiles INIT(0); 00123 00124 /* 00125 * Misc. 00126 */ 00127 EXTERN isc_boolean_t ns_g_coreok INIT(ISC_TRUE); 00128 EXTERN const char * ns_g_chrootdir INIT(NULL); 00129 EXTERN isc_boolean_t ns_g_foreground INIT(ISC_FALSE); 00130 EXTERN isc_boolean_t ns_g_logstderr INIT(ISC_FALSE); 00131 EXTERN isc_boolean_t ns_g_nosyslog INIT(ISC_FALSE); 00132 EXTERN const char * ns_g_logfile INIT(NULL); 00133 00134 EXTERN const char * ns_g_defaultsessionkeyfile 00135 INIT(NS_LOCALSTATEDIR "/run/named/" 00136 "session.key"); 00137 EXTERN const char * ns_g_defaultlockfile INIT(NS_LOCALSTATEDIR 00138 "/run/named/" 00139 "named.lock"); 00140 EXTERN isc_boolean_t ns_g_forcelock INIT(ISC_FALSE); 00141 00142 #if NS_RUN_PID_DIR 00143 EXTERN const char * ns_g_defaultpidfile INIT(NS_LOCALSTATEDIR 00144 "/run/named/" 00145 "named.pid"); 00146 EXTERN const char * lwresd_g_defaultpidfile INIT(NS_LOCALSTATEDIR 00147 "/run/lwresd/" 00148 "lwresd.pid"); 00149 #else 00150 EXTERN const char * ns_g_defaultpidfile INIT(NS_LOCALSTATEDIR 00151 "/run/named.pid"); 00152 EXTERN const char * lwresd_g_defaultpidfile INIT(NS_LOCALSTATEDIR 00153 "/run/lwresd.pid"); 00154 #endif 00155 00156 EXTERN const char * ns_g_username INIT(NULL); 00157 00158 #if defined(USE_PKCS11) 00159 EXTERN const char * ns_g_engine INIT(PKCS11_ENGINE); 00160 #else 00161 EXTERN const char * ns_g_engine INIT(NULL); 00162 #endif 00163 00164 EXTERN int ns_g_listen INIT(3); 00165 EXTERN isc_time_t ns_g_boottime; 00166 EXTERN isc_time_t ns_g_configtime; 00167 EXTERN isc_boolean_t ns_g_memstatistics INIT(ISC_FALSE); 00168 EXTERN isc_boolean_t ns_g_clienttest INIT(ISC_FALSE); 00169 EXTERN isc_boolean_t ns_g_dropedns INIT(ISC_FALSE); 00170 EXTERN isc_boolean_t ns_g_noedns INIT(ISC_FALSE); 00171 EXTERN isc_boolean_t ns_g_nosoa INIT(ISC_FALSE); 00172 EXTERN isc_boolean_t ns_g_noaa INIT(ISC_FALSE); 00173 EXTERN unsigned int ns_g_delay INIT(0); 00174 EXTERN isc_boolean_t ns_g_nonearest INIT(ISC_FALSE); 00175 EXTERN isc_boolean_t ns_g_notcp INIT(ISC_FALSE); 00176 EXTERN isc_boolean_t ns_g_disable6 INIT(ISC_FALSE); 00177 EXTERN isc_boolean_t ns_g_disable4 INIT(ISC_FALSE); 00178 00179 #ifdef HAVE_GEOIP 00180 EXTERN dns_geoip_databases_t *ns_g_geoip INIT(NULL); 00181 #endif 00182 00183 #undef EXTERN 00184 #undef INIT 00185 00186 #endif /* NAMED_GLOBALS_H */