- 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)
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 |
... | ... |
@@ -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. |
... | ... |
@@ -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 |
|
... | ... |
@@ -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 |
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)
... | ... |
@@ -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 |
|
- 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
... | ... |
@@ -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 |
|
- 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
... | ... |
@@ -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 |
|
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>
... | ... |
@@ -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(); |
- 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.
... | ... |
@@ -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 */ |
- 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
... | ... |
@@ -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 */ |
... | ... |
@@ -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(); |
... | ... |
@@ -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 |
... | ... |
@@ -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 |
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 |