-
Notifications
You must be signed in to change notification settings - Fork 581
/
globals.c
184 lines (161 loc) · 5.75 KB
/
globals.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
* Copyright (C) 2001-2003 FhG Fokus
* Copyright (C) 2005-2006 Voice Sistem S.R.L
*
* This file is part of opensips, a free SIP server.
*
* opensips is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* opensips is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <syslog.h>
#include <stdarg.h>
#include <stddef.h>
#include <time.h>
#include "config.h"
#include "poll_types.h"
#include "ip_addr.h"
#include "str.h"
#include "globals.h"
/* global vars */
/*
* when enabled ("-T <module>" cmdline param), OpenSIPS will behave as follows:
* - enable debug mode
* - fork workers normally
* - run all currently enabled unit tests
* (if module != "core", the modules/<module>/test/ suite is ran,
* otherwise the core's ./test/ suite)
* - print the unit test summary
* - exit with 0 on success, non-zero otherwise
*/
int testing_framework;
char *testing_module = "core";
char* cfg_file = 0;
char *preproc = NULL;
unsigned int maxbuffer = MAX_RECV_BUFFER_SIZE; /* maximum buffer size we do
not want to exceed during the
auto-probing procedure; may
be re-configured */
/* number of UDP workers processing requests */
int udp_workers_no = UDP_WORKERS_NO;
/* the global UDP auto scaling profile */
char *udp_auto_scaling_profile = NULL;
/* if the auto-scaling engine is enabled or not - this is autodetected */
int auto_scaling_enabled = 0;
/* auto-scaling sampling and checking time cycle is 1 sec by default */
int auto_scaling_cycle = 1;
/*!< by default choose the best method */
enum poll_types io_poll_method=0;
/* activate debug mode */
int debug_mode = 0;
/* do not become daemon, stay attached to the console */
int no_daemon_mode = 0;
/* assertion statements in script. disabled by default, except for DEV build */
#if defined(CC_O0) || defined(EXTRA_DEBUG)
int enable_asserts = 1;
#else
int enable_asserts = 0;
#endif
/* abort process on failed assertion. disabled by default */
int abort_on_assert = 0;
/* start by only logging to stderr */
int log_stdout = 0;
int stderr_enabled = 1;
int syslog_enabled = 0;
/* log facility (see syslog(3)) */
int log_facility = LOG_DAEMON;
/* the id to be printed in syslog */
char *log_name = 0;
int config_check = 0;
/* check if reply first via host==us */
int check_via = 0;
/* debugging level for memory stats */
int memlog = L_DBG + 11;
int memdump = L_DBG + 10;
unsigned int shm_memlog_size = 0;
/* debugging in case msg processing takes. too long disabled by default */
int execmsgthreshold = 0;
/* debugging in case dns takes too long. disabled by default */
int execdnsthreshold = 0;
/* debugging in case tcp stuff take too long. disabled by default */
int tcpthreshold = 0;
/* should replies include extensive warnings? by default yes,
good for trouble-shooting
*/
int sip_warning = 0;
/* should localy-generated messages include server's signature? */
int server_signature=1;
/* Server header to be used when proxy generates a reply as UAS.
Default is to use SERVER_HDR CRLF (assigned later).
*/
str * const server_header = &str_init(SERVER_HDR);
/* User-Agent header to be used when proxy generates request as UAC.
Default is to use USER_AGENT CRLF (assigned later).
*/
str * const user_agent_header = &str_init(USER_AGENT);
/* should opensips try to locate outbound interface on multihomed
* host? by default not -- too expensive
*/
int mhomed=0;
/* use dns and/or rdns or to see if we need to add
a ;received=x.x.x.x to via: */
int received_dns = 0;
char* working_dir = 0;
char* chroot_dir = 0;
char* user=0;
char* group=0;
/* more config stuff */
int disable_core_dump=0; /* by default enabled */
int open_files_limit=-1; /* don't touch it by default */
#ifdef USE_MCAST
int mcast_loopback = 0;
int mcast_ttl = -1; /* if -1, don't touch it, use the default (usually 1) */
#endif /* USE_MCAST */
int tos = IPTOS_LOWDELAY; // lgtm [cpp/short-global-name]
const struct socket_info* bind_address=NULL; /* pointer to the crt. proc.
listening address*/
/* if aliases should be automatically discovered and added
* during fixing listening sockets */
int auto_aliases=0;
/* if the stateless forwarding support in core should be
* disabled or not */
int sl_fwd_disabled=-1;
/* process number - 0 is the main process */
int process_no = 0;
/* cfg parsing */
int cfg_errors=0;
/**
* @startup_time - near to OpenSIPS launch time, see init_mi_uptime()
* @ready_time - per process, denotes completion of mod_init + child_init
* @ready_delay - difference between above two UNIX timestamps
*/
time_t startup_time, ready_time, ready_delay;
/* shared memory (in MB) */
unsigned long shm_mem_size=SHM_MEM_SIZE * 1024 * 1024;
unsigned int shm_hash_split_percentage = DEFAULT_SHM_HASH_SPLIT_PERCENTAGE;
unsigned int shm_secondary_hash_size = DEFAULT_SHM_SECONDARY_HASH_SIZE;
/* packaged memory (in MB) */
unsigned long pkg_mem_size=PKG_MEM_SIZE * 1024 * 1024;
/* export command-line to anywhere else */
int my_argc;
char **my_argv;
int is_main = 1; /* flag = is this the "main" process? */
/* flag = is this an initial, pre-daemon process ? */
int is_pre_daemon = 1;
char* pid_file = 0; /* filename as asked by user */
char* pgid_file = 0;