Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,330 +0,0 @@
1
-/*
2
- * Copyright (C) 2007 iptelorg GmbH
3
- *
4
- * This file is part of Kamailio, a free SIP server.
5
- *
6
- * Kamailio is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version
10
- *
11
- * Kamailio is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
- *
20
- */
21
-
22
-/** Kamailio core :: core runtime config.
23
- * @file cfg_core.c
24
- * @ingroup core
25
- * Module: @ref core
26
- *
27
- * See
28
- * - @ref ConfigCoreDoc
29
- * - @ref ConfigEngine
30
- * - @ref cfg_core.h
31
- */
32
-/*!
33
- * \page ConfigCoreDoc Documentation of configuration parser
34
- * \section ConfigParser Configuration parser
35
- * Further information
36
- * - \ref ConfigEngine
37
- * - \ref cfg_core.h
38
- * \verbinclude cfg.txt
39
- *
40
- */
41
-
42
-#include "dprint.h"
43
-#ifdef USE_DST_BLACKLIST
44
-#include "dst_blacklist.h"
45
-#endif
46
-#include "resolve.h"
47
-#ifdef USE_DNS_CACHE
48
-#include "dns_cache.h"
49
-#endif
50
-#if defined PKG_MALLOC || defined SHM_MEM
51
-#include "pt.h"
52
-#endif
53
-#include "msg_translator.h" /* fix_global_req_flags() */
54
-#include "globals.h"
55
-#include "sock_ut.h"
56
-#include "cfg/cfg.h"
57
-#include "cfg_core.h"
58
-
59
-struct cfg_group_core default_core_cfg = {
60
-	L_WARN, 	/*!<  print only msg. < L_WARN */
61
-	LOG_DAEMON,	/*!< log_facility -- see syslog(3) */
62
-	L_DBG+1,    /*!< memdbg */
63
-#ifdef USE_DST_BLACKLIST
64
-	/* blacklist */
65
-	0, /*!< dst blacklist is disabled by default */
66
-	DEFAULT_BLST_TIMEOUT,
67
-	DEFAULT_BLST_MAX_MEM,
68
-	0, /* blst_udp_imask */
69
-	0, /* blst_tcp_imask */
70
-	0, /* blst_tls_imask */
71
-	0, /* blst_sctp_imask */
72
-#endif
73
-	/* resolver */
74
-	1,  /*!< dns_try_ipv6 -- on by default */
75
-	0,  /*!< dns_try_naptr -- off by default */
76
-	30,  /*!< udp transport preference (for naptr) */
77
-	20,  /*!< tcp transport preference (for naptr) */
78
-	10,  /*!< tls transport preference (for naptr) */
79
-	20,  /*!< sctp transport preference (for naptr) */
80
-	-1, /*!< dns_retr_time */
81
-	-1, /*!< dns_retr_no */
82
-	-1, /*!< dns_servers_no */
83
-	1,  /*!< dns_search_list */
84
-	1,  /*!< dns_search_fmatch */
85
-	0,  /*!< dns_reinit */
86
-	1,  /*!< dns_naptr_ignore_rfc */
87
-	/* DNS cache */
88
-#ifdef USE_DNS_CACHE
89
-	1,  /*!< use_dns_cache -- on by default */
90
-	0,  /*!< dns_cache_flags */
91
-	0,  /*!< use_dns_failover -- off by default */
92
-	0,  /*!< dns_srv_lb -- off by default */
93
-	DEFAULT_DNS_NEG_CACHE_TTL, /*!< neg. cache ttl */
94
-	DEFAULT_DNS_CACHE_MIN_TTL, /*!< minimum ttl */
95
-	DEFAULT_DNS_CACHE_MAX_TTL, /*!< maximum ttl */
96
-	DEFAULT_DNS_MAX_MEM, /*!< dns_cache_max_mem */
97
-	0, /*!< dns_cache_del_nonexp -- delete only expired entries by default */
98
-	0, /*!< dns_cache_rec_pref -- 0 by default, do not check the existing entries. */
99
-#endif
100
-#ifdef PKG_MALLOC
101
-	0, /*!< mem_dump_pkg */
102
-#endif
103
-#ifdef SHM_MEM
104
-	0, /*!< mem_dump_shm */
105
-#endif
106
-	DEFAULT_MAX_WHILE_LOOPS, /*!< max_while_loops */
107
-	0, /*!< udp_mtu (disabled by default) */
108
-	0, /*!< udp_mtu_try_proto -> default disabled */
109
-	0, /**< udp4_raw (disabled by default) */
110
-	1500, /**< udp4_raw_mtu (1500 by default) */
111
-	-1,  /**< udp4_raw_ttl (auto detect by default) */
112
-	0,  /*!< force_rport */
113
-	L_DBG+1, /*!< memlog */
114
-	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
115
-		4 pkg_sums, 8 shm_sums, 16 short_status */
116
-	0, /*!< mem_safety - 0 disabled */
117
-	0, /*!< mem_join - 0 disabled */
118
-	0, /*!< mem_status_mode - 0 only free fragments, 1 all fragements */
119
-	L_ERR, /*!< corelog */
120
-	L_DBG, /*!< latency cfg log */
121
-	L_ERR, /*!< latency log */
122
-	0, /*!< latency limit db */
123
-	0 /*!< latency limit action */
124
-};
125
-
126
-void	*core_cfg = &default_core_cfg;
127
-
128
-
129
-static int check_raw_sock_support(void* cfg_h, str* gname, str* name,
130
-									void** v)
131
-{
132
-	int val;
133
-
134
-	val = (int)(long)(*v);
135
-#ifndef USE_RAW_SOCKS
136
-	if (val > 0) {
137
-		ERR("no RAW_SOCKS support, please recompile with it enabled\n");
138
-		return -1;
139
-	}
140
-	return 0;
141
-#else /* USE_RAW_SOCKS */
142
-	if (raw_udp4_send_sock < 0) {
143
-		if (val > 0) {
144
-			ERR("could not initialize raw socket on startup, please "
145
-					"restart as root or with CAP_NET_RAW\n");
146
-			return -1;
147
-		} else if (val < 0) {
148
-			/* auto and no socket => disable */
149
-			*v = (void*)(long)0;
150
-		}
151
-	} else if (val < 0) {
152
-		/* auto and socket => enable */
153
-		*v = (void*)(long)1;
154
-	}
155
-	return 0;
156
-#endif /* USE_RAW_SOCKS */
157
-}
158
-
159
-
160
-
161
-static int  udp4_raw_ttl_fixup(void* cfg_h, str* gname, str* name, void** val)
162
-{
163
-	int v;
164
-	v = (int)(long)(*val);
165
-	if (v < 0) {
166
-		if (sendipv4)
167
-			v = sock_get_ttl(sendipv4->socket);
168
-	}
169
-	if (v < 0) {
170
-		/* some error => use a reasonable default */
171
-		v = 63;
172
-	}
173
-	*val = (void*)(long)v;
174
-	return 0;
175
-}
176
-
177
-
178
-
179
-cfg_def_t core_cfg_def[] = {
180
-	{"debug",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
181
-		"debug level"},
182
-	{"log_facility",	CFG_VAR_INT|CFG_INPUT_STRING,	0, 0, log_facility_fixup, 0,
183
-		"syslog facility, see \"man 3 syslog\""},
184
-	{"memdbg",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
185
-		"log level for memory debugging messages"},
186
-#ifdef USE_DST_BLACKLIST
187
-	/* blacklist */
188
-	{"use_dst_blacklist",	CFG_VAR_INT,	0, 1, use_dst_blacklist_fixup, 0,
189
-		"enable/disable destination blacklisting"},
190
-	{"dst_blacklist_expire",	CFG_VAR_INT,	0, 0, 0, 0,
191
-		"how much time (in s) a blacklisted destination is kept in the list"},
192
-	{"dst_blacklist_mem",	CFG_VAR_INT,	0, 0, blst_max_mem_fixup, 0,
193
-		"maximum shared memory amount (in KB) used for keeping the blacklisted"
194
-			" destinations"},
195
-	{"dst_blacklist_udp_imask", CFG_VAR_INT, 0, 0, 0, blst_reinit_ign_masks,
196
-		"blacklist event ignore mask for UDP"},
197
-	{"dst_blacklist_tcp_imask", CFG_VAR_INT, 0, 0, 0, blst_reinit_ign_masks,
198
-		"blacklist event ignore mask for TCP"},
199
-	{"dst_blacklist_tls_imask", CFG_VAR_INT, 0, 0, 0, blst_reinit_ign_masks,
200
-		"blacklist event ignore mask for TLS"},
201
-	{"dst_blacklist_sctp_imask", CFG_VAR_INT, 0, 0, 0, blst_reinit_ign_masks,
202
-		"blacklist event ignore mask for SCTP"},
203
-#endif
204
-	/* resolver */
205
-#ifdef USE_DNS_CACHE
206
-	{"dns_try_ipv6",	CFG_VAR_INT,	0, 1, dns_try_ipv6_fixup, fix_dns_flags,
207
-#else
208
-	{"dns_try_ipv6",	CFG_VAR_INT,	0, 1, dns_try_ipv6_fixup, 0,
209
-#endif
210
-		"enable/disable IPv6 DNS lookups"},
211
-#ifdef USE_DNS_CACHE
212
-	{"dns_try_naptr",	CFG_VAR_INT,	0, 1, 0, fix_dns_flags,
213
-#else
214
-	{"dns_try_naptr",	CFG_VAR_INT,	0, 1, 0, 0,
215
-#endif
216
-		"enable/disable NAPTR DNS lookups"},
217
-	{"dns_udp_pref",	CFG_VAR_INT,	0, 0, 0, reinit_proto_prefs,
218
-		"udp protocol preference when doing NAPTR lookups"},
219
-	{"dns_tcp_pref",	CFG_VAR_INT,	0, 0, 0, reinit_proto_prefs,
220
-		"tcp protocol preference when doing NAPTR lookups"},
221
-	{"dns_tls_pref",	CFG_VAR_INT,	0, 0, 0, reinit_proto_prefs,
222
-		"tls protocol preference when doing NAPTR lookups"},
223
-	{"dns_sctp_pref",	CFG_VAR_INT,	0, 0, 0, reinit_proto_prefs,
224
-		"sctp protocol preference when doing NAPTR lookups"},
225
-	{"dns_retr_time",	CFG_VAR_INT,	0, 0, 0, resolv_reinit,
226
-		"time in s before retrying a dns request"},
227
-	{"dns_retr_no",		CFG_VAR_INT,	0, 0, 0, resolv_reinit,
228
-		"number of dns retransmissions before giving up"},
229
-	{"dns_servers_no",	CFG_VAR_INT,	0, 0, 0, resolv_reinit,
230
-		"how many dns servers from the ones defined in "
231
-		"/etc/resolv.conf will be used"},
232
-	{"dns_use_search_list",	CFG_VAR_INT,	0, 1, 0, resolv_reinit,
233
-		"if set to 0, the search list in /etc/resolv.conf is ignored"},
234
-	{"dns_search_full_match",	CFG_VAR_INT,	0, 1, 0, 0,
235
-		"enable/disable domain name checks against the search list "
236
-		"in DNS answers"},
237
-	{"dns_reinit",		CFG_VAR_INT|CFG_INPUT_INT,	1, 1, dns_reinit_fixup,
238
-		resolv_reinit,
239
-		"set to 1 in order to reinitialize the DNS resolver"},
240
-	{"dns_naptr_ignore_rfc",	CFG_VAR_INT,	0, 0, 0, reinit_proto_prefs,
241
-		"ignore the Order field required by RFC 2915"},
242
-	/* DNS cache */
243
-#ifdef USE_DNS_CACHE
244
-	{"use_dns_cache",	CFG_VAR_INT,	0, 1, use_dns_cache_fixup, 0,
245
-		"enable/disable the dns cache"},
246
-	{"dns_cache_flags",	CFG_VAR_INT,	0, 4, 0, fix_dns_flags,
247
-		"dns cache specific resolver flags "
248
-		"(1=ipv4 only, 2=ipv6 only, 4=prefer ipv6"},
249
-	{"use_dns_failover",	CFG_VAR_INT,	0, 1, use_dns_failover_fixup, 0,
250
-		"enable/disable dns failover in case the destination "
251
-		"resolves to multiple ip addresses and/or multiple SRV records "
252
-		"(depends on use_dns_cache)"},
253
-	{"dns_srv_lb",		CFG_VAR_INT,	0, 1, 0, fix_dns_flags,
254
-		"enable/disable load balancing to different srv records "
255
-		"of the same priority based on the srv records weights "
256
-		"(depends on dns_failover)"},
257
-	{"dns_cache_negative_ttl",	CFG_VAR_INT,	0, 0, 0, 0,
258
-		"time to live for negative results (\"not found\") "
259
-		"in seconds. Use 0 to disable"},
260
-	{"dns_cache_min_ttl",	CFG_VAR_INT,	0, 0, 0, 0,
261
-		"minimum accepted time to live for a record, in seconds"},
262
-	{"dns_cache_max_ttl",	CFG_VAR_INT,	0, 0, 0, 0,
263
-		"maximum accepted time to live for a record, in seconds"},
264
-	{"dns_cache_mem",	CFG_VAR_INT,	0, 0, dns_cache_max_mem_fixup, 0,
265
-		"maximum memory used for the dns cache in Kb"},
266
-	{"dns_cache_del_nonexp",	CFG_VAR_INT,	0, 1, 0, 0,
267
-		"allow deletion of non-expired records from the cache when "
268
-		"there is no more space left for new ones"},
269
-	{"dns_cache_rec_pref",	CFG_VAR_INT,	0, 3, 0, 0,
270
-		"DNS cache record preference: "
271
-		" 0 - do not check duplicates"
272
-		" 1 - prefer old records"
273
-		" 2 - prefer new records"
274
-		" 3 - prefer records with longer lifetime"},
275
-#endif
276
-#ifdef PKG_MALLOC
277
-	{"mem_dump_pkg",	CFG_VAR_INT,	0, 0, 0, mem_dump_pkg_cb,
278
-		"dump process memory status, parameter: pid_number"},
279
-#endif
280
-#ifdef SHM_MEM
281
-	{"mem_dump_shm",	CFG_VAR_INT,	0, 0, mem_dump_shm_fixup, 0,
282
-		"dump shared memory status"},
283
-#endif
284
-	{"max_while_loops",	CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
285
-		"maximum iterations allowed for a while loop" },
286
-	{"udp_mtu",	CFG_VAR_INT|CFG_ATOMIC,	0, 65535, 0, 0,
287
-		"fallback to a congestion controlled protocol if send size"
288
-			" exceeds udp_mtu"},
289
-	{"udp_mtu_try_proto", CFG_VAR_INT, 1, 4, 0, fix_global_req_flags,
290
-		"if send size > udp_mtu use proto (1 udp, 2 tcp, 3 tls, 4 sctp)"},
291
-	{"udp4_raw", CFG_VAR_INT | CFG_ATOMIC, -1, 1, check_raw_sock_support, 0,
292
-		"enable/disable using a raw socket for sending UDP IPV4 packets."
293
-		" Should be  faster on multi-CPU linux running machines."},
294
-	{"udp4_raw_mtu", CFG_VAR_INT | CFG_ATOMIC, 28, 65535, 0, 0,
295
-		"set the MTU used when using raw sockets for udp sending."
296
-		" This  value will be used when deciding whether or not to fragment"
297
-		" the packets."},
298
-	{"udp4_raw_ttl", CFG_VAR_INT | CFG_ATOMIC, -1, 255, udp4_raw_ttl_fixup, 0,
299
-		"set the IP TTL used when using raw sockets for udp sending."
300
-		" -1 will use the same value as for normal udp sockets."},
301
-	{"force_rport",     CFG_VAR_INT, 0, 1,  0, fix_global_req_flags,
302
-		"force rport for all the received messages" },
303
-	{"memlog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
304
-		"log level for memory status/summary information"},
305
-	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 31, 0, 0,
306
-		"memory debugging information displayed on exit (flags): "
307
-		" 0 - off,"
308
-		" 1 - dump all the pkg used blocks (status),"
309
-		" 2 - dump all the shm used blocks (status),"
310
-		" 4 - summary of pkg used blocks,"
311
-		" 8 - summary of shm used blocks,"
312
-		" 16 - short status instead of dump" },
313
-	{"mem_safety",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
314
-		"safety level for memory operations"},
315
-	{"mem_join",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
316
-		"join free memory fragments"},
317
-	{"mem_status_mode",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
318
-		"print status for free or all memory fragments"},
319
-	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
320
-		"log level for non-critical core error messages"},
321
-	{"latency_cfg_log",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
322
-		"log level for printing latency of routing blocks"},
323
-	{"latency_log",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
324
-		"log level for latency limits alert messages"},
325
-	{"latency_limit_db",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
326
-		"limit is ms for alerting on time consuming db commands"},
327
-	{"latency_limit_action",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
328
-		"limit is ms for alerting on time consuming config actions"},
329
-	{0, 0, 0, 0, 0, 0}
330
-};
Browse code

core: added mem_status_mode parameter

- if set to 1, qm allocator dumps used fragments in memory status

Daniel-Constantin Mierla authored on 11/07/2016 14:03:07
Showing 1 changed files
... ...
@@ -115,7 +115,7 @@ struct cfg_group_core default_core_cfg = {
115 115
 		4 pkg_sums, 8 shm_sums, 16 short_status */
116 116
 	0, /*!< mem_safety - 0 disabled */
117 117
 	0, /*!< mem_join - 0 disabled */
118
-	0, /*!< mem_status_all - 0 only free fragments, 1 all fragements */
118
+	0, /*!< mem_status_mode - 0 only free fragments, 1 all fragements */
119 119
 	L_ERR, /*!< corelog */
120 120
 	L_DBG, /*!< latency cfg log */
121 121
 	L_ERR, /*!< latency log */
... ...
@@ -314,7 +314,7 @@ cfg_def_t core_cfg_def[] = {
314 314
 		"safety level for memory operations"},
315 315
 	{"mem_join",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
316 316
 		"join free memory fragments"},
317
-	{"mem_status_all",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
317
+	{"mem_status_mode",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
318 318
 		"print status for free or all memory fragments"},
319 319
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
320 320
 		"log level for non-critical core error messages"},
Browse code

core: mem_status_all - added to cfg core structure

- allow selecting of dumping memory status also for used fragments

Daniel-Constantin Mierla authored on 11/07/2016 11:45:41
Showing 1 changed files
... ...
@@ -115,6 +115,7 @@ struct cfg_group_core default_core_cfg = {
115 115
 		4 pkg_sums, 8 shm_sums, 16 short_status */
116 116
 	0, /*!< mem_safety - 0 disabled */
117 117
 	0, /*!< mem_join - 0 disabled */
118
+	0, /*!< mem_status_all - 0 only free fragments, 1 all fragements */
118 119
 	L_ERR, /*!< corelog */
119 120
 	L_DBG, /*!< latency cfg log */
120 121
 	L_ERR, /*!< latency log */
... ...
@@ -313,6 +314,8 @@ cfg_def_t core_cfg_def[] = {
313 314
 		"safety level for memory operations"},
314 315
 	{"mem_join",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
315 316
 		"join free memory fragments"},
317
+	{"mem_status_all",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
318
+		"print status for free or all memory fragments"},
316 319
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
317 320
 		"log level for non-critical core error messages"},
318 321
 	{"latency_cfg_log",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
Browse code

core: fix spelling errors catched by lintian #688

Victor Seva authored on 29/06/2016 14:29:17
Showing 1 changed files
... ...
@@ -140,7 +140,7 @@ static int check_raw_sock_support(void* cfg_h, str* gname, str* name,
140 140
 #else /* USE_RAW_SOCKS */
141 141
 	if (raw_udp4_send_sock < 0) {
142 142
 		if (val > 0) {
143
-			ERR("could not intialize raw socket on startup, please "
143
+			ERR("could not initialize raw socket on startup, please "
144 144
 					"restart as root or with CAP_NET_RAW\n");
145 145
 			return -1;
146 146
 		} else if (val < 0) {
Browse code

core: new core parameter latency_cfg_log

- if set to a log level less or equal than debug parameter, a log
message with the duration of executing request route or reply route is
printed to syslog
- default value is L_DBG

Daniel-Constantin Mierla authored on 25/04/2016 14:57:19
Showing 1 changed files
... ...
@@ -116,6 +116,7 @@ struct cfg_group_core default_core_cfg = {
116 116
 	0, /*!< mem_safety - 0 disabled */
117 117
 	0, /*!< mem_join - 0 disabled */
118 118
 	L_ERR, /*!< corelog */
119
+	L_DBG, /*!< latency cfg log */
119 120
 	L_ERR, /*!< latency log */
120 121
 	0, /*!< latency limit db */
121 122
 	0 /*!< latency limit action */
... ...
@@ -128,7 +129,7 @@ static int check_raw_sock_support(void* cfg_h, str* gname, str* name,
128 129
 									void** v)
129 130
 {
130 131
 	int val;
131
-	
132
+
132 133
 	val = (int)(long)(*v);
133 134
 #ifndef USE_RAW_SOCKS
134 135
 	if (val > 0) {
... ...
@@ -314,6 +315,8 @@ cfg_def_t core_cfg_def[] = {
314 315
 		"join free memory fragments"},
315 316
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
316 317
 		"log level for non-critical core error messages"},
318
+	{"latency_cfg_log",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
319
+		"log level for printing latency of routing blocks"},
317 320
 	{"latency_log",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
318 321
 		"log level for latency limits alert messages"},
319 322
 	{"latency_limit_db",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
Browse code

core Update headers, change "SIP-router" to "Kamailio", update doxygen file headers

Olle E. Johansson authored on 03/01/2015 14:15:58
Showing 1 changed files
... ...
@@ -1,14 +1,14 @@
1 1
 /*
2 2
  * Copyright (C) 2007 iptelorg GmbH
3 3
  *
4
- * This file is part of SIP-router, a free SIP server.
4
+ * This file is part of Kamailio, a free SIP server.
5 5
  *
6
- * SIP-router is free software; you can redistribute it and/or modify
6
+ * Kamailio is free software; you can redistribute it and/or modify
7 7
  * it under the terms of the GNU General Public License as published by
8 8
  * the Free Software Foundation; either version 2 of the License, or
9 9
  * (at your option) any later version
10 10
  *
11
- * SIP-router is distributed in the hope that it will be useful,
11
+ * Kamailio is distributed in the hope that it will be useful,
12 12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
  * GNU General Public License for more details.
... ...
@@ -19,7 +19,7 @@
19 19
  *
20 20
  */
21 21
 
22
-/** core runtime config.
22
+/** Kamailio core :: core runtime config.
23 23
  * @file cfg_core.c
24 24
  * @ingroup core
25 25
  * Module: @ref core
Browse code

Core Removed history, svn $id$ and doxygen udpates on the .c files

Olle E. Johansson authored on 03/01/2015 09:53:17
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Copyright (C) 2007 iptelorg GmbH
5 3
  *
6 4
  * This file is part of SIP-router, a free SIP server.
... ...
@@ -19,11 +17,8 @@
19 17
  * along with this program; if not, write to the Free Software
20 18
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 19
  *
22
- * History
23
- * -------
24
- *  2007-12-03	Initial version (Miklos)
25
- *  2008-01-31  added DNS resolver parameters (Miklos)
26 20
  */
21
+
27 22
 /** core runtime config.
28 23
  * @file cfg_core.c
29 24
  * @ingroup core
Browse code

core: memlog and memdbg default value is L_DBG+1

- too verbose if just trying to use debug=3 in kamailio.cfg and mem
operations are useful only on troubleshooting memory, which is not the
typical troubleshooting case

Daniel-Constantin Mierla authored on 30/09/2014 16:11:02
Showing 1 changed files
... ...
@@ -64,7 +64,7 @@
64 64
 struct cfg_group_core default_core_cfg = {
65 65
 	L_WARN, 	/*!<  print only msg. < L_WARN */
66 66
 	LOG_DAEMON,	/*!< log_facility -- see syslog(3) */
67
-	L_DBG,  /*!< memdbg */
67
+	L_DBG+1,    /*!< memdbg */
68 68
 #ifdef USE_DST_BLACKLIST
69 69
 	/* blacklist */
70 70
 	0, /*!< dst blacklist is disabled by default */
... ...
@@ -115,7 +115,7 @@ struct cfg_group_core default_core_cfg = {
115 115
 	1500, /**< udp4_raw_mtu (1500 by default) */
116 116
 	-1,  /**< udp4_raw_ttl (auto detect by default) */
117 117
 	0,  /*!< force_rport */
118
-	L_DBG, /*!< memlog */
118
+	L_DBG+1, /*!< memlog */
119 119
 	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
120 120
 		4 pkg_sums, 8 shm_sums, 16 short_status */
121 121
 	0, /*!< mem_safety - 0 disabled */
Browse code

all: updated FSF address in GPL text

Anthony Messina authored on 04/07/2014 09:36:37 • Daniel-Constantin Mierla committed on 04/07/2014 09:37:36
Showing 1 changed files
... ...
@@ -17,7 +17,7 @@
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License
19 19
  * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 21
  *
22 22
  * History
23 23
  * -------
Browse code

core: respect order field in NAPTR, as required by RFC 2915

- the beaviour is controlled by core parameter dns_naptr_ignore_rfc
- default is 1, preserving current behaviouf to ignore rfc requirements
(for backward compatibility)

√ėyvind Kolbu authored on 12/11/2013 14:47:30 • Daniel-Constantin Mierla committed on 12/11/2013 14:49:37
Showing 1 changed files
... ...
@@ -88,6 +88,7 @@ struct cfg_group_core default_core_cfg = {
88 88
 	1,  /*!< dns_search_list */
89 89
 	1,  /*!< dns_search_fmatch */
90 90
 	0,  /*!< dns_reinit */
91
+	1,  /*!< dns_naptr_ignore_rfc */
91 92
 	/* DNS cache */
92 93
 #ifdef USE_DNS_CACHE
93 94
 	1,  /*!< use_dns_cache -- on by default */
... ...
@@ -216,13 +217,13 @@ cfg_def_t core_cfg_def[] = {
216 217
 	{"dns_try_naptr",	CFG_VAR_INT,	0, 1, 0, 0,
217 218
 #endif
218 219
 		"enable/disable NAPTR DNS lookups"},
219
-	{"dns_udp_pref",	CFG_VAR_INT,	0, 0, 0, reinit_naptr_proto_prefs,
220
+	{"dns_udp_pref",	CFG_VAR_INT,	0, 0, 0, reinit_proto_prefs,
220 221
 		"udp protocol preference when doing NAPTR lookups"},
221
-	{"dns_tcp_pref",	CFG_VAR_INT,	0, 0, 0, reinit_naptr_proto_prefs,
222
+	{"dns_tcp_pref",	CFG_VAR_INT,	0, 0, 0, reinit_proto_prefs,
222 223
 		"tcp protocol preference when doing NAPTR lookups"},
223
-	{"dns_tls_pref",	CFG_VAR_INT,	0, 0, 0, reinit_naptr_proto_prefs,
224
+	{"dns_tls_pref",	CFG_VAR_INT,	0, 0, 0, reinit_proto_prefs,
224 225
 		"tls protocol preference when doing NAPTR lookups"},
225
-	{"dns_sctp_pref",	CFG_VAR_INT,	0, 0, 0, reinit_naptr_proto_prefs,
226
+	{"dns_sctp_pref",	CFG_VAR_INT,	0, 0, 0, reinit_proto_prefs,
226 227
 		"sctp protocol preference when doing NAPTR lookups"},
227 228
 	{"dns_retr_time",	CFG_VAR_INT,	0, 0, 0, resolv_reinit,
228 229
 		"time in s before retrying a dns request"},
... ...
@@ -239,6 +240,8 @@ cfg_def_t core_cfg_def[] = {
239 240
 	{"dns_reinit",		CFG_VAR_INT|CFG_INPUT_INT,	1, 1, dns_reinit_fixup,
240 241
 		resolv_reinit,
241 242
 		"set to 1 in order to reinitialize the DNS resolver"},
243
+	{"dns_naptr_ignore_rfc",	CFG_VAR_INT,	0, 0, 0, reinit_proto_prefs,
244
+		"ignore the Order field required by RFC 2915"},
242 245
 	/* DNS cache */
243 246
 #ifdef USE_DNS_CACHE
244 247
 	{"use_dns_cache",	CFG_VAR_INT,	0, 1, use_dns_cache_fixup, 0,
Browse code

core and modules: make IPv6 default, remove compile time flags

* Make IPv6 the default in the core and affected modules
* it has been default switched on since a long time, and was introduced in 2002
* even on embedded systems one probably want now proper IPv6 support
* there was an issue in cygwin in 2008, but IPv6 is there also available since v1.7
* remove over 160 #ifdefs, cleanup the code a lot and removes many of rarely
tested alternative code paths to ease support of the codebase
* note for gentoo maintainer: please review your packages, they will maybe not
work now correctly anymore if somebody specified -ipv6 in the use flags

Henning Westerholt authored on 18/05/2013 08:07:25
Showing 1 changed files
... ...
@@ -76,11 +76,7 @@ struct cfg_group_core default_core_cfg = {
76 76
 	0, /* blst_sctp_imask */
77 77
 #endif
78 78
 	/* resolver */
79
-#ifdef USE_IPV6
80 79
 	1,  /*!< dns_try_ipv6 -- on by default */
81
-#else
82
-	0,  /*!< dns_try_ipv6 -- off, if no ipv6 support */
83
-#endif
84 80
 	0,  /*!< dns_try_naptr -- off by default */
85 81
 	30,  /*!< udp transport preference (for naptr) */
86 82
 	20,  /*!< tcp transport preference (for naptr) */
Browse code

core: mem - join free packets option can be set from config

- better control over existing code for joining free memory fragments
- existing QM_JOIN_FREE renamed to MEM_JOIN_FREE - to be used in other
memory managers than q_malloc
- new cfg parameter mem_join - if set to 1, q_malloc does join of free
memory fragments. default is 0. in use if MEM_JOIN_FREE is defined

Daniel-Constantin Mierla authored on 29/03/2012 11:57:22
Showing 1 changed files
... ...
@@ -122,6 +122,7 @@ struct cfg_group_core default_core_cfg = {
122 122
 	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
123 123
 		4 pkg_sums, 8 shm_sums, 16 short_status */
124 124
 	0, /*!< mem_safety - 0 disabled */
125
+	0, /*!< mem_join - 0 disabled */
125 126
 	L_ERR, /*!< corelog */
126 127
 	L_ERR, /*!< latency log */
127 128
 	0, /*!< latency limit db */
... ...
@@ -315,6 +316,8 @@ cfg_def_t core_cfg_def[] = {
315 316
 		" 16 - short status instead of dump" },
316 317
 	{"mem_safety",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
317 318
 		"safety level for memory operations"},
319
+	{"mem_join",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
320
+		"join free memory fragments"},
318 321
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
319 322
 		"log level for non-critical core error messages"},
320 323
 	{"latency_log",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
Browse code

core: new param mem_safety

- if set to 1, memory free operation does not call abort() for double
freeing a pointer or freeing an invalid address
- default is 0, can be set via config framework

Daniel-Constantin Mierla authored on 29/03/2012 10:55:04
Showing 1 changed files
... ...
@@ -121,6 +121,7 @@ struct cfg_group_core default_core_cfg = {
121 121
 	L_DBG, /*!< memlog */
122 122
 	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
123 123
 		4 pkg_sums, 8 shm_sums, 16 short_status */
124
+	0, /*!< mem_safety - 0 disabled */
124 125
 	L_ERR, /*!< corelog */
125 126
 	L_ERR, /*!< latency log */
126 127
 	0, /*!< latency limit db */
... ...
@@ -312,6 +313,8 @@ cfg_def_t core_cfg_def[] = {
312 313
 		" 4 - summary of pkg used blocks,"
313 314
 		" 8 - summary of shm used blocks,"
314 315
 		" 16 - short status instead of dump" },
316
+	{"mem_safety",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
317
+		"safety level for memory operations"},
315 318
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
316 319
 		"log level for non-critical core error messages"},
317 320
 	{"latency_log",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
Browse code

core: new parameters to control and alert on time consuming ops

- latency_log - log level to print the messages related to latency
- latency_limit_db - limit of latency in ms for db operations. If a db
operation executed via DB API v1 takes longer that its value, a
message is printed in the logs, showing the first 50 characters of the
db query
- latency_limit_action - limit of latency in ms for config actions. If a
config action executed by cfg interpreter takes longer than its value,
a message is printed in the logs, showing config path, line and action
name when it is a module function, as well as intenal action id

Daniel-Constantin Mierla authored on 25/03/2012 11:39:20
Showing 1 changed files
... ...
@@ -121,7 +121,10 @@ struct cfg_group_core default_core_cfg = {
121 121
 	L_DBG, /*!< memlog */
122 122
 	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
123 123
 		4 pkg_sums, 8 shm_sums, 16 short_status */
124
-	L_ERR /*!< corelog */
124
+	L_ERR, /*!< corelog */
125
+	L_ERR, /*!< latency log */
126
+	0, /*!< latency limit db */
127
+	0 /*!< latency limit action */
125 128
 };
126 129
 
127 130
 void	*core_cfg = &default_core_cfg;
... ...
@@ -311,5 +314,11 @@ cfg_def_t core_cfg_def[] = {
311 314
 		" 16 - short status instead of dump" },
312 315
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
313 316
 		"log level for non-critical core error messages"},
317
+	{"latency_log",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
318
+		"log level for latency limits alert messages"},
319
+	{"latency_limit_db",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
320
+		"limit is ms for alerting on time consuming db commands"},
321
+	{"latency_limit_action",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
322
+		"limit is ms for alerting on time consuming config actions"},
314 323
 	{0, 0, 0, 0, 0, 0}
315 324
 };
Browse code

core:mem: short status dumping

- patch by Andrade Ricardo, on Aug 1, 2011

Daniel-Constantin Mierla authored on 26/08/2011 07:32:51
Showing 1 changed files
... ...
@@ -120,7 +120,7 @@ struct cfg_group_core default_core_cfg = {
120 120
 	0,  /*!< force_rport */
121 121
 	L_DBG, /*!< memlog */
122 122
 	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
123
-		4 pkg_sums, 8 shm_sums */
123
+		4 pkg_sums, 8 shm_sums, 16 short_status */
124 124
 	L_ERR /*!< corelog */
125 125
 };
126 126
 
... ...
@@ -301,13 +301,14 @@ cfg_def_t core_cfg_def[] = {
301 301
 		"force rport for all the received messages" },
302 302
 	{"memlog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
303 303
 		"log level for memory status/summary information"},
304
-	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 15, 0, 0,
304
+	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 31, 0, 0,
305 305
 		"memory debugging information displayed on exit (flags): "
306 306
 		" 0 - off,"
307 307
 		" 1 - dump all the pkg used blocks (status),"
308 308
 		" 2 - dump all the shm used blocks (status),"
309 309
 		" 4 - summary of pkg used blocks,"
310
-		" 8 - summary of shm used blocks" },
310
+		" 8 - summary of shm used blocks,"
311
+		" 16 - short status instead of dump" },
311 312
 	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
312 313
 		"log level for non-critical core error messages"},
313 314
 	{0, 0, 0, 0, 0, 0}
Browse code

core: new global parameter corelog

- control the log level for non-critical core error messages
- e.g., useful to disable messages such as:
- tcp connection reset by peer
- error parsing received message for garbage (non-sip/html/...)

Daniel-Constantin Mierla authored on 07/03/2011 12:42:38
Showing 1 changed files
... ...
@@ -119,8 +119,9 @@ struct cfg_group_core default_core_cfg = {
119 119
 	-1,  /**< udp4_raw_ttl (auto detect by default) */
120 120
 	0,  /*!< force_rport */
121 121
 	L_DBG, /*!< memlog */
122
-	3 /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
122
+	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
123 123
 		4 pkg_sums, 8 shm_sums */
124
+	L_ERR /*!< corelog */
124 125
 };
125 126
 
126 127
 void	*core_cfg = &default_core_cfg;
... ...
@@ -307,5 +308,7 @@ cfg_def_t core_cfg_def[] = {
307 308
 		" 2 - dump all the shm used blocks (status),"
308 309
 		" 4 - summary of pkg used blocks,"
309 310
 		" 8 - summary of shm used blocks" },
311
+	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
312
+		"log level for non-critical core error messages"},
310 313
 	{0, 0, 0, 0, 0, 0}
311 314
 };
Browse code

Merge remote branch 'origin/andrei/raw_sock'

Raw socket support for sending UDP IPv4 packets
(major performance increase on multi-cpu machines running linux:
40-50% faster at least in stateless mode).

* origin/andrei/raw_sock:
NEWS: notes about the new udp4_raw mode
raw sockets: added info rpc
core: compile raw socket support by default on freebsd
raw sockets: freebsd support
cfg: delay cfg_shmize to just before forking
core: always compile the raw sockets code on linux
raw sockets: ttl can be set from the config file
raw sockets: ttl can be set or auto-detected
core: include raw socket support in version info
raw sockets: use BSD ip & udp structure versions
raw sockets: config file support
raw sockets: udp send will use now raw sockets if enabled
raw sockets: runtime config support
raw sockets: build ip header & fragmentation support
raw socket: compilation fixes
raw sockets: get dst. ip from the ip header
core: basic support for receiving udp sip packets on raw sockets
core: basic raw socket support functions

Andrei Pelinescu-Onciul authored on 11/08/2010 20:49:04
Showing 0 changed files
Browse code

raw sockets: ttl can be set or auto-detected

The IP TTL used when sending on raw sockets can be set using the
core.udp4_raw_ttl config variable.
By default it is auto-detected on startup (the same IP TTL as the
one for the first udp4 socket is used).

Andrei Pelinescu-Onciul authored on 10/08/2010 09:09:19
Showing 1 changed files
... ...
@@ -56,6 +56,8 @@
56 56
 #include "pt.h"
57 57
 #endif
58 58
 #include "msg_translator.h" /* fix_global_req_flags() */
59
+#include "globals.h"
60
+#include "sock_ut.h"
59 61
 #include "cfg/cfg.h"
60 62
 #include "cfg_core.h"
61 63
 
... ...
@@ -113,6 +115,7 @@ struct cfg_group_core default_core_cfg = {
113 115
 	0, /*!< udp_mtu_try_proto -> default disabled */
114 116
 	0, /**< udp4_raw (disabled by default) */
115 117
 	1500, /**< udp4_raw_mtu (1500 by default) */
118
+	-1,  /**< udp4_raw_ttl (auto detect by default) */
116 119
 	0,  /*!< force_rport */
117 120
 	L_DBG, /*!< memlog */
118 121
 	1 /*!< mem_summary -flags: 0 off, 1 shm/pkg_status, 2 shm/pkg_sums */
... ...
@@ -153,6 +156,24 @@ static int check_raw_sock_support(void* cfg_h, str* gname, str* name,
153 156
 
154 157
 
155 158
 
159
+static int  udp4_raw_ttl_fixup(void* cfg_h, str* gname, str* name, void** val)
160
+{
161
+	int v;
162
+	v = (int)(long)(*val);
163
+	if (v < 0) {
164
+		if (sendipv4)
165
+			v = sock_get_ttl(sendipv4->socket);
166
+	}
167
+	if (v < 0) {
168
+		/* some error => use a reasonable default */
169
+		v = 63;
170
+	}
171
+	*val = (void*)(long)v;
172
+	return 0;
173
+}
174
+
175
+
176
+
156 177
 cfg_def_t core_cfg_def[] = {
157 178
 	{"debug",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
158 179
 		"debug level"},
... ...
@@ -264,6 +285,9 @@ cfg_def_t core_cfg_def[] = {
264 285
 		"set the MTU used when using raw sockets for udp sending."
265 286
 		" This  value will be used when deciding whether or not to fragment"
266 287
 		" the packets."},
288
+	{"udp4_raw_ttl", CFG_VAR_INT | CFG_ATOMIC, -1, 255, udp4_raw_ttl_fixup, 0,
289
+		"set the IP TTL used when using raw sockets for udp sending."
290
+		" -1 will use the same value as for normal udp sockets."},
267 291
 	{"force_rport",     CFG_VAR_INT, 0, 1,  0, fix_global_req_flags,
268 292
 		"force rport for all the received messages" },
269 293
 	{"memlog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
Browse code

core: updated help msg for mem_summary cfg var

Daniel-Constantin Mierla authored on 21/07/2010 19:26:53
Showing 1 changed files
... ...
@@ -236,7 +236,10 @@ cfg_def_t core_cfg_def[] = {
236 236
 		"log level for memory status/summary information"},
237 237
 	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 15, 0, 0,
238 238
 		"memory debugging information displayed on exit (flags): "
239
-		" 0 - off, 1 - dump all the used blocks (status),"
240
-		" 2 - summary of used blocks" },
239
+		" 0 - off,"
240
+		" 1 - dump all the pkg used blocks (status),"
241
+		" 2 - dump all the shm used blocks (status),"
242
+		" 4 - summary of pkg used blocks,"
243
+		" 8 - summary of shm used blocks" },
241 244
 	{0, 0, 0, 0, 0, 0}
242 245
 };
Browse code

core: more control on mem usage printing

- mem_summary value controls separately printing pkg and shm status
- 0 - disabled
- 1 - pkg status
- 2 - shm status
- 4 - pkg summary
- 8 - shm summary
- default is 3 - pkg/shm status
- the value can be updated via rpc, making easier to troubleshoot
separately shm or pkg

Daniel-Constantin Mierla authored on 21/07/2010 19:21:38
Showing 1 changed files
... ...
@@ -115,7 +115,8 @@ struct cfg_group_core default_core_cfg = {
115 115
 	0, /*!< udp_mtu_try_proto -> default disabled */
116 116
 	0,  /*!< force_rport */
117 117
 	L_DBG, /*!< memlog */
118
-	1 /*!< mem_summary -flags: 0 off, 1 shm/pkg_status, 2 shm/pkg_sums */
118
+	3 /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
119
+		4 pkg_sums, 8 shm_sums */
119 120
 };
120 121
 
121 122
 void	*core_cfg = &default_core_cfg;
... ...
@@ -233,7 +234,7 @@ cfg_def_t core_cfg_def[] = {
233 234
 		"force rport for all the received messages" },
234 235
 	{"memlog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
235 236
 		"log level for memory status/summary information"},
236
-	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 3, 0, 0,
237
+	{"mem_summary",	CFG_VAR_INT|CFG_ATOMIC,	0, 15, 0, 0,
237 238
 		"memory debugging information displayed on exit (flags): "
238 239
 		" 0 - off, 1 - dump all the used blocks (status),"
239 240
 		" 2 - summary of used blocks" },
Browse code

dns cache: dns_cache_rec_pref config var added

The config variable, dns_cache_rec_pref, can be used
to set the DNS cache preference as follows:

0 - do not check duplicates (default)
1 - prefer old records
2 - prefer new records
3 - prefer records with longer lifetime

This variable is checked when a duplicated record is
tried to be inserted into the cache. For instance the
SRV query answer contains also an A record which is
already in the cache.
If the config var is not 0, then permanent entries
are always preferred.

Note: works only with #define CACHE_RELEVANT_RECS_ONLY
at the moment.

Miklos Tirpak authored on 23/06/2010 14:34:56
Showing 1 changed files
... ...
@@ -102,6 +102,7 @@ struct cfg_group_core default_core_cfg = {
102 102
 	DEFAULT_DNS_CACHE_MAX_TTL, /*!< maximum ttl */
103 103
 	DEFAULT_DNS_MAX_MEM, /*!< dns_cache_max_mem */
104 104
 	0, /*!< dns_cache_del_nonexp -- delete only expired entries by default */
105
+	0, /*!< dns_cache_rec_pref -- 0 by default, do not check the existing entries. */
105 106
 #endif
106 107
 #ifdef PKG_MALLOC
107 108
 	0, /*!< mem_dump_pkg */
... ...
@@ -206,6 +207,12 @@ cfg_def_t core_cfg_def[] = {
206 207
 	{"dns_cache_del_nonexp",	CFG_VAR_INT,	0, 1, 0, 0,
207 208
 		"allow deletion of non-expired records from the cache when "
208 209
 		"there is no more space left for new ones"},
210
+	{"dns_cache_rec_pref",	CFG_VAR_INT,	0, 3, 0, 0,
211
+		"DNS cache record preference: "
212
+		" 0 - do not check duplicates"
213
+		" 1 - prefer old records"
214
+		" 2 - prefer new records"
215
+		" 3 - prefer records with longer lifetime"},
209 216
 #endif
210 217
 #ifdef PKG_MALLOC
211 218
 	{"mem_dump_pkg",	CFG_VAR_INT,	0, 0, 0, mem_dump_pkg_cb,
Browse code

raw sockets: runtime config support

Usage of raw sockets for send and the used mtu can now be set
at runtime via the 2 new added core config variables:
udp4_raw and udp4_raw_mtu.
udp4_raw can have 3 values: disabled (0), on (1) and auto (-1). If
set to auto raw sockets will be used if possible.

E.g.:
sercmd cfg.set_now_int core udp4_raw_mtu 576

Andrei Pelinescu-Onciul authored on 15/06/2010 14:31:16
Showing 1 changed files
... ...
@@ -24,16 +24,15 @@
24 24
  *  2007-12-03	Initial version (Miklos)
25 25
  *  2008-01-31  added DNS resolver parameters (Miklos)
26 26
  */
27
-/*!
28
- * \file
29
- * \brief SIP-router core ::  Core configuration parser
30
- * \ingroup core
31
- * Module: \ref core
27
+/** core runtime config.
28
+ * @file cfg_core.c
29
+ * @ingroup core
30
+ * Module: @ref core
32 31
  *
33
- * See 
34
- * - \ref ConfigCoreDoc
35
- * - \ref ConfigEngine
36
- * - \ref cfg_core.h
32
+ * See
33
+ * - @ref ConfigCoreDoc
34
+ * - @ref ConfigEngine
35
+ * - @ref cfg_core.h
37 36
  */
38 37
 /*!
39 38
  * \page ConfigCoreDoc Documentation of configuration parser
... ...
@@ -112,6 +111,8 @@ struct cfg_group_core default_core_cfg = {
112 111
 	DEFAULT_MAX_WHILE_LOOPS, /*!< max_while_loops */
113 112
 	0, /*!< udp_mtu (disabled by default) */
114 113
 	0, /*!< udp_mtu_try_proto -> default disabled */
114
+	0, /**< udp4_raw (disabled by default) */
115
+	1500, /**< udp4_raw_mtu (1500 by default) */
115 116
 	0,  /*!< force_rport */
116 117
 	L_DBG, /*!< memlog */
117 118
 	1 /*!< mem_summary -flags: 0 off, 1 shm/pkg_status, 2 shm/pkg_sums */
... ...
@@ -119,6 +120,39 @@ struct cfg_group_core default_core_cfg = {
119 120
 
120 121
 void	*core_cfg = &default_core_cfg;
121 122
 
123
+
124
+static int check_raw_sock_support(void* cfg_h, str* gname, str* name,
125
+									void** v)
126
+{
127
+	int val;
128
+	
129
+	val = (int)(long)(*v);
130
+#ifndef USE_RAW_SOCKS
131
+	if (val > 0) {
132
+		ERR("no RAW_SOCKS support, please recompile with it enabled\n");
133
+		return -1;
134
+	}
135
+	return 0;
136
+#else /* USE_RAW_SOCKS */
137
+	if (raw_udp4_send_sock < 0) {
138
+		if (val > 0) {
139
+			ERR("could not intialize raw socket on startup, please "
140
+					"restart as root or with CAP_NET_RAW\n");
141
+			return -1;
142
+		} else if (val < 0) {
143
+			/* auto and no socket => disable */
144
+			*v = (void*)(long)0;
145
+		}
146
+	} else if (val < 0) {
147
+		/* auto and socket => enable */
148
+		*v = (void*)(long)1;
149
+	}
150
+	return 0;
151
+#endif /* USE_RAW_SOCKS */
152
+}
153
+
154
+
155
+
122 156
 cfg_def_t core_cfg_def[] = {
123 157
 	{"debug",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
124 158
 		"debug level"},
... ...
@@ -177,7 +211,8 @@ cfg_def_t core_cfg_def[] = {
177 211
 	{"dns_search_full_match",	CFG_VAR_INT,	0, 1, 0, 0,
178 212
 		"enable/disable domain name checks against the search list "
179 213
 		"in DNS answers"},
180
-	{"dns_reinit",		CFG_VAR_INT|CFG_INPUT_INT,	1, 1, dns_reinit_fixup, resolv_reinit,
214
+	{"dns_reinit",		CFG_VAR_INT|CFG_INPUT_INT,	1, 1, dns_reinit_fixup,
215
+		resolv_reinit,
181 216
 		"set to 1 in order to reinitialize the DNS resolver"},
182 217
 	/* DNS cache */
183 218
 #ifdef USE_DNS_CACHE
... ...
@@ -222,6 +257,13 @@ cfg_def_t core_cfg_def[] = {
222 257
 			" exceeds udp_mtu"},
223 258
 	{"udp_mtu_try_proto", CFG_VAR_INT, 1, 4, 0, fix_global_req_flags,
224 259
 		"if send size > udp_mtu use proto (1 udp, 2 tcp, 3 tls, 4 sctp)"},
260
+	{"udp4_raw", CFG_VAR_INT | CFG_ATOMIC, -1, 1, check_raw_sock_support, 0,
261
+		"enable/disable using a raw socket for sending UDP IPV4 packets."
262
+		" Should be  faster on multi-CPU linux running machines."},
263
+	{"udp4_raw_mtu", CFG_VAR_INT | CFG_ATOMIC, 28, 65535, 0, 0,
264
+		"set the MTU used when using raw sockets for udp sending."
265
+		" This  value will be used when deciding whether or not to fragment"
266
+		" the packets."},
225 267
 	{"force_rport",     CFG_VAR_INT, 0, 1,  0, fix_global_req_flags,
226 268
 		"force rport for all the received messages" },
227 269
 	{"memlog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
Browse code

Merge remote branch 'origin/andrei/blst_send_flags'

Support for blacklist ignore flags, both global and on a per
message basis.
E.g.:
per message:
if (method=~"MESSAGE")
blst_set_ignore(6);

global:
sercmd cfg.set_now_int core dst_blacklist_tcp_imask 16

* origin/andrei/blst_send_flags:
NEWS: minor blacklist flag number correction
tm: blacklist on 503 reply fixed for send flags
NEWS: mentioned blacklist ignore masks
core: cfg script support for blacklist ignore masks
blst: global config variables for ignoring blacklist events
blst: docs for blst_{set,clear}_ignore script functions
blst: functions for ignoring blacklist events
blst: use dst_blacklist_force_add
tm: simplified blacklist add code
blacklist: ignore mask support
tm: updated to the new snd_flags_t structure
core: send_flags preliminary blacklist support

Conflicts:
NEWS
cfg.lex
cfg.y
dst_blacklist.h

Andrei Pelinescu-Onciul authored on 19/02/2010 15:37:51
Showing 0 changed files
Browse code

blst: global config variables for ignoring blacklist events

Blacklist events can now be ignored on a per protocol basis, by
setting the corresponding new config variable:
dst_blacklist_udp_imask
dst_blacklist_tcp_imask
dst_blacklist_tls_imask
dst_blacklist_sctp_imask

E.g.: sercmd cfg.set_now_int core dst_blacklist_tcp_imask 6
(ignore send and connect errors on tcp when deciding whether or
not to blacklist)

Andrei Pelinescu-Onciul authored on 15/02/2010 20:37:28
Showing 1 changed files
... ...
@@ -54,6 +54,10 @@ struct cfg_group_core default_core_cfg = {
54 54
 	0, /* dst blacklist is disabled by default */
55 55
 	DEFAULT_BLST_TIMEOUT,
56 56
 	DEFAULT_BLST_MAX_MEM,
57
+	0, /* blst_udp_imask */
58
+	0, /* blst_tcp_imask */
59
+	0, /* blst_tls_imask */
60
+	0, /* blst_sctp_imask */
57 61
 #endif
58 62
 	/* resolver */
59 63
 #ifdef USE_IPV6
... ...
@@ -114,7 +118,16 @@ cfg_def_t core_cfg_def[] = {
114 118
 	{"dst_blacklist_expire",	CFG_VAR_INT,	0, 0, 0, 0,
115 119
 		"how much time (in s) a blacklisted destination is kept in the list"},
116 120
 	{"dst_blacklist_mem",	CFG_VAR_INT,	0, 0, blst_max_mem_fixup, 0,
117
-		"maximum shared memory amount (in KB) used for keeping the blacklisted destinations"},
121
+		"maximum shared memory amount (in KB) used for keeping the blacklisted"
122
+			" destinations"},
123
+	{"dst_blacklist_udp_imask", CFG_VAR_INT, 0, 0, 0, blst_reinit_ign_masks,
124
+		"blacklist event ignore mask for UDP"},
125
+	{"dst_blacklist_tcp_imask", CFG_VAR_INT, 0, 0, 0, blst_reinit_ign_masks,
126
+		"blacklist event ignore mask for TCP"},
127
+	{"dst_blacklist_tls_imask", CFG_VAR_INT, 0, 0, 0, blst_reinit_ign_masks,
128
+		"blacklist event ignore mask for TLS"},
129
+	{"dst_blacklist_sctp_imask", CFG_VAR_INT, 0, 0, 0, blst_reinit_ign_masks,
130
+		"blacklist event ignore mask for SCTP"},
118 131
 #endif
119 132
 	/* resolver */
120 133
 #ifdef USE_DNS_CACHE
Browse code

Including configuration documentation from doc/cfg.txt in doxygen.

Note: This implements a change in the doxygen configuration file that needs to be implementted
on the web server too.

oej authored on 21/10/2009 07:56:25
Showing 1 changed files
... ...
@@ -26,11 +26,24 @@
26 26
  */
27 27
 /*!
28 28
  * \file
29
- * \brief SIP-router core ::  Core configuration
29
+ * \brief SIP-router core ::  Core configuration parser
30 30
  * \ingroup core
31 31
  * Module: \ref core
32
+ *
33
+ * See 
34
+ * - \ref ConfigCoreDoc
35
+ * - \ref ConfigEngine
36
+ * - \ref cfg_core.h
37
+ */
38
+/*!
39
+ * \page ConfigCoreDoc Documentation of configuration parser
40
+ * \section ConfigParser Configuration parser
41
+ * Further information
42
+ * - \ref ConfigEngine
43