globals.h 4.61 KB
Newer Older
Bob Halley's avatar
add  
Bob Halley committed
1
/*
2
 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3
 *
4 5 6
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 8 9
 *
 * See the COPYRIGHT file distributed with this work for additional
 * information regarding copyright ownership.
Bob Halley's avatar
add  
Bob Halley committed
10 11
 */

12 13
#ifndef NAMED_GLOBALS_H
#define NAMED_GLOBALS_H 1
Bob Halley's avatar
add  
Bob Halley committed
14

15 16
/*! \file */

17 18
#include <stdbool.h>

Bob Halley's avatar
add  
Bob Halley committed
19
#include <isc/rwlock.h>
Andreas Gustafsson's avatar
Andreas Gustafsson committed
20
#include <isc/log.h>
21
#include <isc/net.h>
Bob Halley's avatar
add  
Bob Halley committed
22

23
#include <isccfg/aclconf.h>
24 25
#include <isccfg/cfg.h>

Evan Hunt's avatar
Evan Hunt committed
26
#include <dns/acl.h>
27 28
#include <dns/zone.h>

29 30
#include <dst/dst.h>

31
#include <named/types.h>
32
#include <named/fuzz.h>
Bob Halley's avatar
add  
Bob Halley committed
33 34 35

#undef EXTERN
#undef INIT
36
#ifdef NAMED_MAIN
Bob Halley's avatar
add  
Bob Halley committed
37 38 39 40 41 42 43
#define EXTERN
#define INIT(v)	= (v)
#else
#define EXTERN extern
#define INIT(v)
#endif

44 45
#ifndef NAMED_RUN_PID_DIR
#define NAMED_RUN_PID_DIR 1
46 47
#endif

48 49 50 51 52 53
EXTERN isc_mem_t *		named_g_mctx		INIT(NULL);
EXTERN unsigned int		named_g_cpus		INIT(0);
EXTERN unsigned int		named_g_udpdisp		INIT(0);
EXTERN isc_taskmgr_t *		named_g_taskmgr		INIT(NULL);
EXTERN dns_dispatchmgr_t *	named_g_dispatchmgr	INIT(NULL);
EXTERN unsigned int		named_g_cpus_detected	INIT(1);
54

55
#ifdef ENABLE_AFL
56
EXTERN bool		named_g_run_done	INIT(false);
57
#endif
Bob Halley's avatar
add  
Bob Halley committed
58 59 60 61 62
/*
 * XXXRTH  We're going to want multiple timer managers eventually.  One
 *         for really short timers, another for client timers, and one
 *         for zone timers.
 */
63 64 65 66 67 68 69 70 71 72 73 74 75 76
EXTERN isc_timermgr_t *		named_g_timermgr	INIT(NULL);
EXTERN isc_socketmgr_t *	named_g_socketmgr	INIT(NULL);
EXTERN cfg_parser_t *		named_g_parser		INIT(NULL);
EXTERN cfg_parser_t *		named_g_addparser	INIT(NULL);
EXTERN const char *		named_g_version		INIT(VERSION);
EXTERN const char *		named_g_product		INIT(PRODUCT);
EXTERN const char *		named_g_description	INIT(DESCRIPTION);
EXTERN const char *		named_g_srcid		INIT(SRCID);
EXTERN const char *		named_g_configargs	INIT(CONFIGARGS);
EXTERN const char *		named_g_builder		INIT(BUILDER);
EXTERN in_port_t		named_g_port		INIT(0);
EXTERN isc_dscp_t		named_g_dscp		INIT(-1);

EXTERN named_server_t *		named_g_server		INIT(NULL);
77

78 79 80
/*
 * Logging.
 */
81 82 83 84
EXTERN isc_log_t *		named_g_lctx		INIT(NULL);
EXTERN isc_logcategory_t *	named_g_categories	INIT(NULL);
EXTERN isc_logmodule_t *	named_g_modules		INIT(NULL);
EXTERN unsigned int		named_g_debuglevel	INIT(0);
85 86

/*
87
 * Current configuration information.
88
 */
89 90 91
EXTERN cfg_obj_t *		named_g_config		INIT(NULL);
EXTERN const cfg_obj_t *	named_g_defaults	INIT(NULL);
EXTERN const char *		named_g_conffile	INIT(NAMED_SYSCONFDIR
92
							     "/named.conf");
93
EXTERN const char *		named_g_defaultbindkeys	INIT(NAMED_SYSCONFDIR
94
							     "/bind.keys");
95
EXTERN const char *		named_g_keyfile		INIT(NAMED_SYSCONFDIR
Mark Andrews's avatar
Mark Andrews committed
96
							     "/rndc.key");
97

98 99
EXTERN dns_tsigkey_t *		named_g_sessionkey	INIT(NULL);
EXTERN dns_name_t		named_g_sessionkeyname;
100
EXTERN bool		named_g_conffileset	INIT(false);
101
EXTERN cfg_aclconfctx_t *	named_g_aclconfctx	INIT(NULL);
Bob Halley's avatar
add  
Bob Halley committed
102

103 104 105
/*
 * Initial resource limits.
 */
106 107 108 109
EXTERN isc_resourcevalue_t	named_g_initstacksize	INIT(0);
EXTERN isc_resourcevalue_t	named_g_initdatasize	INIT(0);
EXTERN isc_resourcevalue_t	named_g_initcoresize	INIT(0);
EXTERN isc_resourcevalue_t	named_g_initopenfiles	INIT(0);
110

Bob Halley's avatar
Bob Halley committed
111 112 113
/*
 * Misc.
 */
114
EXTERN bool		named_g_coreok		INIT(true);
115
EXTERN const char *		named_g_chrootdir	INIT(NULL);
116 117 118
EXTERN bool		named_g_foreground	INIT(false);
EXTERN bool		named_g_logstderr	INIT(false);
EXTERN bool		named_g_nosyslog	INIT(false);
119 120 121 122
EXTERN const char *		named_g_logfile		INIT(NULL);

EXTERN const char *		named_g_defaultsessionkeyfile
					INIT(NAMED_LOCALSTATEDIR "/run/named/"
123
							      "session.key");
124
EXTERN const char *		named_g_defaultlockfile	INIT(NAMED_LOCALSTATEDIR
125 126
							     "/run/named/"
							     "named.lock");
127
EXTERN bool		named_g_forcelock	INIT(false);
128

129 130
#if NAMED_RUN_PID_DIR
EXTERN const char *		named_g_defaultpidfile 	INIT(NAMED_LOCALSTATEDIR
Mark Andrews's avatar
Mark Andrews committed
131
							     "/run/named/"
Automatic Updater's avatar
Automatic Updater committed
132
							     "named.pid");
Mark Andrews's avatar
Mark Andrews committed
133
#else
134
EXTERN const char *		named_g_defaultpidfile 	INIT(NAMED_LOCALSTATEDIR
Mark Andrews's avatar
Mark Andrews committed
135 136 137
							     "/run/named.pid");
#endif

138
EXTERN const char *		named_g_username	INIT(NULL);
Bob Halley's avatar
Bob Halley committed
139

140
EXTERN const char *		named_g_engine		INIT(NULL);
Francis Dupont's avatar
Francis Dupont committed
141

142 143
EXTERN isc_time_t		named_g_boottime;
EXTERN isc_time_t		named_g_configtime;
144 145
EXTERN bool		named_g_memstatistics	INIT(false);
EXTERN bool		named_g_keepstderr	INIT(false);
146 147

EXTERN unsigned int		named_g_tat_interval	INIT(24*3600);
148

149
#if defined(HAVE_GEOIP2)
150
EXTERN dns_geoip_databases_t	*named_g_geoip		INIT(NULL);
Evan Hunt's avatar
Evan Hunt committed
151 152
#endif

153 154
EXTERN const char *		named_g_fuzz_addr	INIT(NULL);
EXTERN isc_fuzztype_t		named_g_fuzz_type	INIT(isc_fuzz_none);
155

156
EXTERN dns_acl_t *		named_g_mapped		INIT(NULL);
157

Bob Halley's avatar
add  
Bob Halley committed
158 159 160
#undef EXTERN
#undef INIT

161
#endif /* NAMED_GLOBALS_H */