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,68 +0,0 @@
1
-/*
2
- * Copyright (C) 2001-2003 FhG Fokus
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
-#ifndef tcp_init_h
22
-#define tcp_init_h
23
-#include "ip_addr.h"
24
-
25
-#define DEFAULT_TCP_CONNECTION_LIFETIME_S 120 /* in  seconds */
26
-/* maximum accepted lifetime in ticks (maximum possible is  ~ MAXINT/2) */
27
-#define MAX_TCP_CON_LIFETIME	((1U<<(sizeof(ticks_t)*8-1))-1)
28
-
29
-#define DEFAULT_TCP_SEND_TIMEOUT 10 /* if a send can't write for more then 10s,
30
-									   timeout */
31
-#define DEFAULT_TCP_CONNECT_TIMEOUT 10 /* if a connect doesn't complete in this
32
-										  time, timeout */
33
-#define DEFAULT_TCP_MAX_CONNECTIONS 2048 /* maximum tcp connections */
34
-
35
-#define DEFAULT_TLS_MAX_CONNECTIONS 2048 /* maximum tls connections */
36
-
37
-#define DEFAULT_TCP_BUF_SIZE	16384  /* 16k - buffer size used for reads */
38
-
39
-#define DEFAULT_TCP_WBUF_SIZE	2100 /*  after debugging switch to 4-16k */
40
-
41
-struct tcp_child{
42
-	pid_t pid;
43
-	int proc_no; /* ser proc_no, for debugging */
44
-	int unix_sock; /* unix "read child" sock fd */
45
-	int busy;
46
-	struct socket_info *mysocket; /* listen socket to handle traffic on it */
47
-	int n_reqs; /* number of requests serviced so far */
48
-};
49
-
50
-#define TCP_ALIAS_FORCE_ADD 1
51
-#define TCP_ALIAS_REPLACE   2
52
-
53
-
54
-int init_tcp(void);
55
-void destroy_tcp(void);
56
-int tcp_init(struct socket_info* sock_info);
57
-int tcp_init_children(void);
58
-void tcp_main_loop(void);
59
-void tcp_receive_loop(int unix_sock);
60
-int tcp_fix_child_sockets(int* fd);
61
-
62
-/* sets source address used when opening new sockets and no source is specified
63
- *  (by default the address is choosen by the kernel)
64
- * Should be used only on init.
65
- * returns -1 on error */
66
-int tcp_set_src_addr(struct ip_addr* ip);
67
-
68
-#endif
Browse code

core: Modify doxygen, remove history, remove SVN IDs, change "ser" and "sip-router" to "KAMAILIO"

Olle E. Johansson authored on 16/01/2015 16:38:46
Showing 1 changed files
... ...
@@ -1,21 +1,14 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Copyright (C) 2001-2003 FhG Fokus
5 3
  *
6
- * This file is part of ser, a free SIP server.
4
+ * This file is part of Kamailio, a free SIP server.
7 5
  *
8
- * ser is free software; you can redistribute it and/or modify
6
+ * Kamailio is free software; you can redistribute it and/or modify
9 7
  * it under the terms of the GNU General Public License as published by
10 8
  * the Free Software Foundation; either version 2 of the License, or
11 9
  * (at your option) any later version
12 10
  *
13
- * For a license to use the ser software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18
- * ser is distributed in the hope that it will be useful,
11
+ * Kamailio is distributed in the hope that it will be useful,
19 12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 14
  * GNU General Public License for more details.
Browse code

core: default tcp read buffer size set to 16kB

Daniel-Constantin Mierla authored on 13/10/2014 11:07:17
Showing 1 changed files
... ...
@@ -41,7 +41,7 @@
41 41
 
42 42
 #define DEFAULT_TLS_MAX_CONNECTIONS 2048 /* maximum tls connections */
43 43
 
44
-#define DEFAULT_TCP_BUF_SIZE	4096  /* buffer size used for reads */
44
+#define DEFAULT_TCP_BUF_SIZE	16384  /* 16k - buffer size used for reads */
45 45
 
46 46
 #define DEFAULT_TCP_WBUF_SIZE	2100 /*  after debugging switch to 4-16k */
47 47
 
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
... ...
@@ -22,7 +22,7 @@
22 22
  *
23 23
  * You should have received a copy of the GNU General Public License 
24 24
  * along with this program; if not, write to the Free Software 
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
26 26
  */
27 27
 
28 28
 #ifndef tcp_init_h
Browse code

core: Added void to declarations of functions with empty argument list

In C language, a declaration in the form int f(); is equivalent to int f(...);, thus being able to accept an indefinit number of parameters. With the -Wstrict-prototypes GCC options, these declarations are reported as "function declaration isn’t a prototype".
On some cases, this may trick the compiler into generating unoptimized code (like preparing to handle variadic argument list).
In all cases having a declaration int f() and a definition inf f(int) is missleading, even if standard compliant.
This is still Work in Progress. (maybe adding the -Wstrict-prototypes option to default is desireable)

Marius Zbihlei authored on 02/04/2012 14:19:17
Showing 1 changed files
... ...
@@ -58,11 +58,11 @@ struct tcp_child{
58 58
 #define TCP_ALIAS_REPLACE   2
59 59
 
60 60
 
61
-int init_tcp();
62
-void destroy_tcp();
61
+int init_tcp(void);
62
+void destroy_tcp(void);
63 63
 int tcp_init(struct socket_info* sock_info);
64
-int tcp_init_children();
65
-void tcp_main_loop();
64
+int tcp_init_children(void);
65
+void tcp_main_loop(void);
66 66
 void tcp_receive_loop(int unix_sock);
67 67
 int tcp_fix_child_sockets(int* fd);
68 68
 
Browse code

core: option to set number of workers per listen socket

- new cfg global parameter: socket_workers - set the number of worker
processes for the next listen socket
- used before listen on udp and sctp socket - overwrites
children/sctp_children value for that socket
- used bofer listen on tcp and tls socket - adds extra tcp workers,
these handling traffic only on that socket
- socket_workers is reset with next listen socket that is added, thus
use it for each listen socket where you want custom number of workers
- if this parameter is not used at all, it is the same behaviour as so
far

Example for udp sockets:

children=4
socket_workers=2
listen=udp:127.0.0.1:5080
listen=udp:127.0.0.1:5070
listen=udp:127.0.0.1:5060

- it will start 2 workers to handle traffic on udp:127.0.0.1:5080 and 4
for each of udp:127.0.0.1:5070 and udp:127.0.0.1:5060. In total there
are 10 worker processes

Example for tcp sockets:

children=4
socket_workers=2
listen=tcp:127.0.0.1:5080
listen=tcp:127.0.0.1:5070
listen=tcp:127.0.0.1:5060

- it will start 2 workers to handle traffic on tcp:127.0.0.1:5080 and 4
to handle traffic on both tcp:127.0.0.1:5070 and tcp:127.0.0.1:5060.
In total there are 6 worker processes

Daniel-Constantin Mierla authored on 12/01/2012 17:55:22
Showing 1 changed files
... ...
@@ -50,6 +50,7 @@ struct tcp_child{
50 50
 	int proc_no; /* ser proc_no, for debugging */
51 51
 	int unix_sock; /* unix "read child" sock fd */
52 52
 	int busy;
53
+	struct socket_info *mysocket; /* listen socket to handle traffic on it */
53 54
 	int n_reqs; /* number of requests serviced so far */
54 55
 };
55 56
 
Browse code

core/tcp/tls: added tls_max_connections global parameter

- set a limit to active tls connections
- its management is done in tcp code, as tls is encryption layer over
tcp
- tls connections are still counted as tcp connections, thus this limit
cannot exceed tcp_max_connections
- default value 2048
- core.tcp_options lists also the tls connections number

Daniel-Constantin Mierla authored on 13/12/2011 22:01:48
Showing 1 changed files
... ...
@@ -37,7 +37,9 @@
37 37
 									   timeout */
38 38
 #define DEFAULT_TCP_CONNECT_TIMEOUT 10 /* if a connect doesn't complete in this
39 39
 										  time, timeout */
40
-#define DEFAULT_TCP_MAX_CONNECTIONS 2048 /* maximum connections */
40
+#define DEFAULT_TCP_MAX_CONNECTIONS 2048 /* maximum tcp connections */
41
+
42
+#define DEFAULT_TLS_MAX_CONNECTIONS 2048 /* maximum tls connections */
41 43
 
42 44
 #define DEFAULT_TCP_BUF_SIZE	4096  /* buffer size used for reads */
43 45
 
Browse code

tcp: remove unused var. decls

Removed tcp_new_conn_alias_flags and tcp_alias_flags declaration,
since they have been replaced by runtime cfg. equivalents
(tcp alias_flags and new_conn_alias_flags).

Reported-by: Libor Chocholaty <libor@iptel.org>

Andrei Pelinescu-Onciul authored on 08/06/2009 08:50:40
Showing 1 changed files
... ...
@@ -54,10 +54,6 @@ struct tcp_child{
54 54
 #define TCP_ALIAS_FORCE_ADD 1
55 55
 #define TCP_ALIAS_REPLACE   2
56 56
 
57
-/* flags used for adding new aliases */
58
-extern int tcp_alias_flags;
59
-/* flags used for adding the default aliases of a new tcp connection */
60
-extern int tcp_new_conn_alias_flags;
61 57
 
62 58
 int init_tcp();
63 59
 void destroy_tcp();
Browse code

tcp: config option for the async write block size

- the block size used for the async writes can now be configured
both from ser.cfg (tcp_wq_blk_size) and at runtime. This value
has only a little performance impact and only when writes are
delayed. Small values are safer (big values on proxies that
open thousands of connections over slow links would eat up a
lot of memory). For now it's main use is debugging.

Andrei Pelinescu-Onciul authored on 09/03/2009 13:45:49
Showing 1 changed files
... ...
@@ -39,6 +39,10 @@
39 39
 										  time, timeout */
40 40
 #define DEFAULT_TCP_MAX_CONNECTIONS 2048 /* maximum connections */
41 41
 
42
+#define DEFAULT_TCP_BUF_SIZE	4096  /* buffer size used for reads */
43
+
44
+#define DEFAULT_TCP_WBUF_SIZE	2100 /*  after debugging switch to 4-16k */
45
+
42 46
 struct tcp_child{
43 47
 	pid_t pid;
44 48
 	int proc_no; /* ser proc_no, for debugging */
Browse code

tcp: use dynamic config framework, part 2

- added tcp_connect_timeout, tcp_send_timeout,
tcp_connection_lifetime, tcp_max_connections, tcp_accept_aliases
to the config framework.

- added 2 new tcp related variables: tcp alias_flags and tcp
new_conn_alias_flags

Andrei Pelinescu-Onciul authored on 05/03/2009 17:20:42
Showing 1 changed files
... ...
@@ -29,6 +29,16 @@
29 29
 #define tcp_init_h
30 30
 #include "ip_addr.h"
31 31
 
32
+#define DEFAULT_TCP_CONNECTION_LIFETIME_S 120 /* in  seconds */
33
+/* maximum accepted lifetime in ticks (maximum possible is  ~ MAXINT/2) */
34
+#define MAX_TCP_CON_LIFETIME	((1U<<(sizeof(ticks_t)*8-1))-1)
35
+
36
+#define DEFAULT_TCP_SEND_TIMEOUT 10 /* if a send can't write for more then 10s,
37
+									   timeout */
38
+#define DEFAULT_TCP_CONNECT_TIMEOUT 10 /* if a connect doesn't complete in this
39
+										  time, timeout */
40
+#define DEFAULT_TCP_MAX_CONNECTIONS 2048 /* maximum connections */
41
+
32 42
 struct tcp_child{
33 43
 	pid_t pid;
34 44
 	int proc_no; /* ser proc_no, for debugging */
Browse code

- tcp add alias policy changes (experimental): now new aliases are added even if matching aliases for different connections exists. Until now an existing alias pointing to some other connection would trigger an error, the reason being that someone could try to "steal" a connection. However this turned out to affect also normal usage, like UAs behind nats that change the ip, or rebooted UAs (that didn't have a chance to close the tcp connection).

Andrei Pelinescu-Onciul authored on 05/09/2007 17:20:35
Showing 1 changed files
... ...
@@ -37,6 +37,13 @@ struct tcp_child{
37 37
 	int n_reqs; /* number of requests serviced so far */
38 38
 };
39 39
 
40
+#define TCP_ALIAS_FORCE_ADD 1
41
+#define TCP_ALIAS_REPLACE   2
42
+
43
+/* flags used for adding new aliases */
44
+extern int tcp_alias_flags;
45
+/* flags used for adding the default aliases of a new tcp connection */
46
+extern int tcp_new_conn_alias_flags;
40 47
 
41 48
 int init_tcp();
42 49
 void destroy_tcp();
Browse code

- tcpconn_connect takes a new optional param.: the address to bind the new socket on - tcpconn_new takes a new param: the local socket address - tcp_use_source_ipv[46] cleanup - MAX_TCP_CON_LIFETIME fix

Andrei Pelinescu-Onciul authored on 25/07/2007 19:40:32
Showing 1 changed files
... ...
@@ -46,5 +46,10 @@ void tcp_main_loop();
46 46
 void tcp_receive_loop(int unix_sock);
47 47
 int tcp_fix_child_sockets(int* fd);
48 48
 
49
+/* sets source address used when opening new sockets and no source is specified
50
+ *  (by default the address is choosen by the kernel)
51
+ * Should be used only on init.
52
+ * returns -1 on error */
53
+int tcp_set_src_addr(struct ip_addr* ip);
49 54
 
50 55
 #endif
Browse code

- applied patch from Dragos Vingarzan <vingarzan@fokus.fraunhofer.de> which moves all the forking part into 2 functions in pt.c (fork_process and fork_tcp_process). - added PROC_NOCHLDINIT rank value for Dragos's fork_process (if this value is used as child_id/rank_value the mod_child functions will not be called) - added register_procs(processes_no), used from mod_init when a module knows that it will fork some children (replaces the old process_count++ / the patch's estimated_process_count++) - added get_max_procs(): returns the maximum (estimated) number of processes

Andrei Pelinescu-Onciul authored on 19/09/2006 16:13:27
Showing 1 changed files
... ...
@@ -29,12 +29,22 @@
29 29
 #define tcp_init_h
30 30
 #include "ip_addr.h"
31 31
 
32
+struct tcp_child{
33
+	pid_t pid;
34
+	int proc_no; /* ser proc_no, for debugging */
35
+	int unix_sock; /* unix "read child" sock fd */
36
+	int busy;
37
+	int n_reqs; /* number of requests serviced so far */
38
+};
39
+
40
+
32 41
 int init_tcp();
33 42
 void destroy_tcp();
34 43
 int tcp_init(struct socket_info* sock_info);
35 44
 int tcp_init_children();
36 45
 void tcp_main_loop();
37 46
 void tcp_receive_loop(int unix_sock);
47
+int tcp_fix_child_sockets(int* fd);
38 48
 
39 49
 
40 50
 #endif
Browse code

- Spelling checked - READMEs updated

Jan Janak authored on 24/08/2004 08:45:09
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * $Id$
3 3
  *
4
- * Copyright (C) 2001-2003 Fhg Fokus
4
+ * Copyright (C) 2001-2003 FhG Fokus
5 5
  *
6 6
  * This file is part of ser, a free SIP server.
7 7
  *
Browse code

- more tcp stuff (uses locking.h, hashtables, mostly untested) - main exit cleanups (created cleanup(show_status() function that should prepare ser for exiting: dellocate everything, free sems a.s.o).

Andrei Pelinescu-Onciul authored on 20/01/2003 18:35:09
Showing 1 changed files
... ...
@@ -30,6 +30,7 @@
30 30
 #include "ip_addr.h"
31 31
 
32 32
 int init_tcp();
33
+void destroy_tcp();
33 34
 int tcp_init(struct socket_info* sock_info);
34 35
 int tcp_init_children();
35 36
 void tcp_main_loop();
Browse code

- changed sip_msg (new rcv member containing all the ips, ports, protocol) - added a "proto" parameter to forward_request, via_builder, get_send_sock etc. - added 2 new script commands: forward_udp & forward_tcp - lots of tcp bloat - changed parse_via to recognize TCP - more functions added to ip_addr.h (cmp for ips & sockaddrs etc.)

Andrei Pelinescu-Onciul authored on 12/12/2002 21:46:37
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,39 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * Copyright (C) 2001-2003 Fhg Fokus
5
+ *
6
+ * This file is part of ser, a free SIP server.
7
+ *
8
+ * ser is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * For a license to use the ser software under conditions
14
+ * other than those described here, or to purchase support for this
15
+ * software, please contact iptel.org by e-mail at the following addresses:
16
+ *    info@iptel.org
17
+ *
18
+ * ser is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License 
24
+ * along with this program; if not, write to the Free Software 
25
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ */
27
+
28
+#ifndef tcp_init_h
29
+#define tcp_init_h
30
+#include "ip_addr.h"
31
+
32
+int init_tcp();
33
+int tcp_init(struct socket_info* sock_info);
34
+int tcp_init_children();
35
+void tcp_main_loop();
36
+void tcp_receive_loop(int unix_sock);
37
+
38
+
39
+#endif