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,161 +0,0 @@
1
-/* 
2
- * Copyright (C) 2007 iptelorg GmbH
3
- *
4
- * Permission to use, copy, modify, and distribute this software for any
5
- * purpose with or without fee is hereby granted, provided that the above
6
- * copyright notice and this permission notice appear in all copies.
7
- *
8
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
- */
16
-/*! \file
17
- * \brief tcp options
18
- *
19
- */
20
-
21
-#ifndef tcp_options_h
22
-#define tcp_options_h
23
-
24
-#ifdef USE_TCP
25
-
26
-#include <netinet/in.h>
27
-#include <netinet/tcp.h>
28
-#ifndef NO_TCP_ASYNC
29
-#define TCP_ASYNC /* enabled async mode */
30
-#endif
31
-
32
-#if !defined(NO_TCP_CONNECT_WAIT) && defined(TCP_ASYNC)
33
-#define TCP_CONNECT_WAIT /* enable pending connects support */
34
-#endif
35
-
36
-#if defined(TCP_CONNECT_WAIT) && !defined(TCP_ASYNC)
37
-/* check for impossible configuration: TCP_CONNECT_WAIT w/o TCP_ASYNC */
38
-#warning "disabling TCP_CONNECT_WAIT because TCP_ASYNC is not defined"
39
-#undef TCP_CONNECT_WAIT
40
-#endif
41
-
42
-#ifndef NO_TCP_FD_CACHE
43
-#define TCP_FD_CACHE /* enable fd caching */
44
-#endif
45
-
46
-
47
-
48
-/* defer accept */
49
-#ifndef  NO_TCP_DEFER_ACCEPT
50
-#ifdef __OS_linux
51
-#define HAVE_TCP_DEFER_ACCEPT
52
-#elif defined __OS_freebsd
53
-#define HAVE_TCP_ACCEPT_FILTER
54
-#endif /* __OS_ */
55
-#endif /* NO_TCP_DEFER_ACCEPT */
56
-
57
-
58
-/* syn count */
59
-#ifndef NO_TCP_SYNCNT
60
-#ifdef __OS_linux
61
-#define HAVE_TCP_SYNCNT
62
-#endif /* __OS_*/
63
-#endif /* NO_TCP_SYNCNT */
64
-
65
-/* tcp linger2 */
66
-#ifndef NO_TCP_LINGER2
67
-#ifdef __OS_linux
68
-#define HAVE_TCP_LINGER2
69
-#endif /* __OS_ */
70
-#endif /* NO_TCP_LINGER2 */
71
-
72
-/* keepalive */
73
-#ifndef NO_TCP_KEEPALIVE
74
-#define HAVE_SO_KEEPALIVE
75
-#endif /* NO_TCP_KEEPALIVE */
76
-
77
-/* keepintvl */
78
-#ifndef NO_TCP_KEEPINTVL
79
-#ifdef TCP_KEEPINTVL
80
-#define HAVE_TCP_KEEPINTVL
81
-#endif /* TCP_KEEPINTVL */
82
-#endif /* NO_TCP_KEEPINTVL */
83
-
84
-/* keepidle */
85
-#ifndef NO_TCP_KEEPIDLE
86
-#ifdef TCP_KEEPIDLE
87
-#define HAVE_TCP_KEEPIDLE
88
-#endif /* TCP_KEEPIDLE*/
89
-#endif /* NO_TCP_KEEPIDLE */
90
-
91
-
92
-/* keepcnt */
93
-#ifndef NO_TCP_KEEPCNT
94
-#ifdef TCP_KEEPCNT
95
-#define HAVE_TCP_KEEPCNT
96
-#endif /* TCP_KEEPCNT */
97
-#endif /* NO_TCP_KEEPCNT */
98
-
99
-
100
-/* delayed ack (quick_ack) */
101
-#ifndef NO_TCP_QUICKACK
102
-#ifdef __OS_linux
103
-#define HAVE_TCP_QUICKACK
104
-#endif /* __OS_ */
105
-#endif /* NO_TCP_QUICKACK */
106
-
107
-#endif /* USE_TCP */
108
-
109
-struct cfg_group_tcp{
110
-	/* ser tcp options, low level */
111
-	int connect_timeout_s; /* in s */
112
-	int send_timeout; /* in ticks (s fixed to ticks) */
113
-	int con_lifetime; /* in ticks (s fixed to ticks) */
114
-	int max_connections; /* max tcp connections (includes tls connections) */
115
-	int max_tls_connections; /* max tls connections */
116
-	int no_connect; /* do not open any new tcp connection (but accept them) */
117
-	int fd_cache; /* on /off */
118
-	/* tcp async options */
119
-	int async; /* on / off */
120
-	int tcp_connect_wait; /* on / off, depends on async */
121
-	unsigned int tcpconn_wq_max; /* maximum queue len per connection */
122
-	unsigned int tcp_wq_max; /* maximum overall queued bytes */
123
-
124
-	/* tcp socket options */
125
-	int defer_accept; /* on / off */
126
-	int delayed_ack; /* delay ack on connect */ 
127
-	int syncnt;     /* numbers of SYNs retrs. before giving up connecting */
128
-	int linger2;    /* lifetime of orphaned  FIN_WAIT2 state sockets */
129
-	int keepalive;  /* on /off */
130
-	int keepidle;   /* idle time (s) before tcp starts sending keepalives */
131
-	int keepintvl;  /* interval between keep alives */
132
-	int keepcnt;    /* maximum no. of keepalives before giving up */
133
-	
134
-	/* other options */
135
-	int crlf_ping;  /* on/off - reply to double CRLF keepalives */
136
-	int accept_aliases;
137
-	int alias_flags;
138
-	int new_conn_alias_flags;
139
-	int accept_no_cl;  /* on/off - accept messages without content-length */
140
-
141
-	/* internal, "fixed" vars */
142
-	unsigned int rd_buf_size; /* read buffer size (should be > max. datagram)*/
143
-	unsigned int wq_blk_size; /* async write block size (debugging use) */
144
-};
145
-
146
-extern struct cfg_group_tcp tcp_default_cfg;
147
-
148
-/* tcp config handle*/
149
-extern void* tcp_cfg;
150
-
151
-
152
-void init_tcp_options(void);
153
-void tcp_options_check(void);
154
-int tcp_register_cfg(void);
155
-void tcp_options_get(struct cfg_group_tcp* t);
156
-
157
-#ifdef USE_TCP
158
-int tcp_set_clone_rcvbuf(int v);
159
-#endif /* USE_TCP */
160
-
161
-#endif /* tcp_options_h */
Browse code

tcp: fix tcp_options.o compilation

Commit 6627098eb4adad706d20f6b73d1b7e75cc08a21f broke building on OpenBSD

Mikko Lehto authored on 20/02/2016 18:16:26
Showing 1 changed files
... ...
@@ -23,6 +23,7 @@
23 23
 
24 24
 #ifdef USE_TCP
25 25
 
26
+#include <netinet/in.h>
26 27
 #include <netinet/tcp.h>
27 28
 #ifndef NO_TCP_ASYNC
28 29
 #define TCP_ASYNC /* enabled async mode */
Browse code

tcp: include netinet/tcp.h to make certain macros available

Following are tested: TCP_KEEPINTVL, TCP_KEEPIDLE, TCP_KEEPCNT

Mikko Lehto authored on 29/01/2016 12:55:34
Showing 1 changed files
... ...
@@ -23,6 +23,7 @@
23 23
 
24 24
 #ifdef USE_TCP
25 25
 
26
+#include <netinet/tcp.h>
26 27
 #ifndef NO_TCP_ASYNC
27 28
 #define TCP_ASYNC /* enabled async mode */
28 29
 #endif
Browse code

tcp: use macros from netinet/tcp.h to detect TCP feature

makes tcpops module usable on FreeBSD 10

Mikko Lehto authored on 27/01/2016 17:26:46
Showing 1 changed files
... ...
@@ -74,24 +74,24 @@
74 74
 
75 75
 /* keepintvl */
76 76
 #ifndef NO_TCP_KEEPINTVL
77
-#ifdef __OS_linux
77
+#ifdef TCP_KEEPINTVL
78 78
 #define HAVE_TCP_KEEPINTVL
79
-#endif /* __OS_ */
80
-#endif /* NO_TCP_KEEPIDLE */
79
+#endif /* TCP_KEEPINTVL */
80
+#endif /* NO_TCP_KEEPINTVL */
81 81
 
82 82
 /* keepidle */
83 83
 #ifndef NO_TCP_KEEPIDLE
84
-#ifdef __OS_linux
84
+#ifdef TCP_KEEPIDLE
85 85
 #define HAVE_TCP_KEEPIDLE
86
-#endif /* __OS_*/
86
+#endif /* TCP_KEEPIDLE*/
87 87
 #endif /* NO_TCP_KEEPIDLE */
88 88
 
89 89
 
90 90
 /* keepcnt */
91 91
 #ifndef NO_TCP_KEEPCNT
92
-#ifdef __OS_linux
92
+#ifdef TCP_KEEPCNT
93 93
 #define HAVE_TCP_KEEPCNT
94
-#endif /* __OS_ */
94
+#endif /* TCP_KEEPCNT */
95 95
 #endif /* NO_TCP_KEEPCNT */
96 96
 
97 97
 
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,6 +1,4 @@
1 1
 /* 
2
- * $Id$
3
- * 
4 2
  * Copyright (C) 2007 iptelorg GmbH
5 3
  *
6 4
  * Permission to use, copy, modify, and distribute this software for any
... ...
@@ -15,12 +13,9 @@
15 13
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 14
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 15
  */
18
-/*
19
- * tcp options
16
+/*! \file
17
+ * \brief tcp options
20 18
  *
21
- * History:
22
- * --------
23
- *  2007-11-28  created by andrei
24 19
  */
25 20
 
26 21
 #ifndef tcp_options_h
Browse code

core: Fix Content-Length typos

One typo in the HTTP11CONTINUE response headers
One in the tcp option help string for 'accept_no_cl'
Two in code comments

Hugh Waite authored on 14/03/2013 10:41:24
Showing 1 changed files
... ...
@@ -139,7 +139,7 @@ struct cfg_group_tcp{
139 139
 	int accept_aliases;
140 140
 	int alias_flags;
141 141
 	int new_conn_alias_flags;
142
-	int accept_no_cl;  /* on/off - accpet messages without content-lenght */
142
+	int accept_no_cl;  /* on/off - accept messages without content-length */
143 143
 
144 144
 	/* internal, "fixed" vars */
145 145
 	unsigned int rd_buf_size; /* read buffer size (should be > max. datagram)*/
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
... ...
@@ -152,9 +152,9 @@ extern struct cfg_group_tcp tcp_default_cfg;
152 152
 extern void* tcp_cfg;
153 153
 
154 154
 
155
-void init_tcp_options();
156
-void tcp_options_check();
157
-int tcp_register_cfg();
155
+void init_tcp_options(void);
156
+void tcp_options_check(void);
157
+int tcp_register_cfg(void);
158 158
 void tcp_options_get(struct cfg_group_tcp* t);
159 159
 
160 160
 #ifdef USE_TCP
Browse code

core: new cfg global parameter tcp_clone_rcvbuf

- control cloning of tcp receive buffer, default is 0 (no cloning), set
to 1 for cloning

Daniel-Constantin Mierla authored on 06/01/2012 10:42:10
Showing 1 changed files
... ...
@@ -157,4 +157,8 @@ void tcp_options_check();
157 157
 int tcp_register_cfg();
158 158
 void tcp_options_get(struct cfg_group_tcp* t);
159 159
 
160
+#ifdef USE_TCP
161
+int tcp_set_clone_rcvbuf(int v);
162
+#endif /* USE_TCP */
163
+
160 164
 #endif /* tcp_options_h */
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
... ...
@@ -114,7 +114,8 @@ struct cfg_group_tcp{
114 114
 	int connect_timeout_s; /* in s */
115 115
 	int send_timeout; /* in ticks (s fixed to ticks) */
116 116
 	int con_lifetime; /* in ticks (s fixed to ticks) */
117
-	int max_connections;
117
+	int max_connections; /* max tcp connections (includes tls connections) */
118
+	int max_tls_connections; /* max tls connections */
118 119
 	int no_connect; /* do not open any new tcp connection (but accept them) */
119 120
 	int fd_cache; /* on /off */
120 121
 	/* tcp async options */
Browse code

tcp: filled description of tcp_accept_no_cl

- added missing description in tcp options structure

Daniel-Constantin Mierla authored on 25/05/2010 13:15:38
Showing 1 changed files
... ...
@@ -138,10 +138,11 @@ struct cfg_group_tcp{
138 138
 	int accept_aliases;
139 139
 	int alias_flags;
140 140
 	int new_conn_alias_flags;
141
+	int accept_no_cl;  /* on/off - accpet messages without content-lenght */
142
+
141 143
 	/* internal, "fixed" vars */
142 144
 	unsigned int rd_buf_size; /* read buffer size (should be > max. datagram)*/
143 145
 	unsigned int wq_blk_size; /* async write block size (debugging use) */
144
-	int accept_no_cl;  /* on/off - accpet messages without content-lenght */
145 146
 };
146 147
 
147 148
 extern struct cfg_group_tcp tcp_default_cfg;
Browse code

tcp: new parameter to accept messages without CL

- some non-sip messages with empty body do not carry content-length
- useful for http traffic handled locally
- global parameter name: tcp_accept_no_cl
- default is 0 (report error of CL is missing, default behaviour so far)
- value can be changed at runtime

Daniel-Constantin Mierla authored on 25/05/2010 08:48:54
Showing 1 changed files
... ...
@@ -141,6 +141,7 @@ struct cfg_group_tcp{
141 141
 	/* internal, "fixed" vars */
142 142
 	unsigned int rd_buf_size; /* read buffer size (should be > max. datagram)*/
143 143
 	unsigned int wq_blk_size; /* async write block size (debugging use) */
144
+	int accept_no_cl;  /* on/off - accpet messages without content-lenght */
144 145
 };
145 146
 
146 147
 extern struct cfg_group_tcp tcp_default_cfg;
Browse code

tcp internal: send timeout is now kept only in ticks

- removed send_timeout_s and wq_timeout and replaced them with send_timeout,
which is now kept only in ticks. This fixes the cfg.set_delayed_int problem
reported by Miklos.

Andrei Pelinescu-Onciul authored on 20/03/2009 17:26:51
Showing 1 changed files
... ...
@@ -112,8 +112,8 @@
112 112
 struct cfg_group_tcp{
113 113
 	/* ser tcp options, low level */
114 114
 	int connect_timeout_s; /* in s */
115
-	int send_timeout_s; /* in s */
116
-	int con_lifetime; /* s fixed to ticks */
115
+	int send_timeout; /* in ticks (s fixed to ticks) */
116
+	int con_lifetime; /* in ticks (s fixed to ticks) */
117 117
 	int max_connections;
118 118
 	int no_connect; /* do not open any new tcp connection (but accept them) */
119 119
 	int fd_cache; /* on /off */
... ...
@@ -139,7 +139,6 @@ struct cfg_group_tcp{
139 139
 	int alias_flags;
140 140
 	int new_conn_alias_flags;
141 141
 	/* internal, "fixed" vars */
142
-	unsigned int tcp_wq_timeout; /* in ticks, timeout for queued writes */
143 142
 	unsigned int rd_buf_size; /* read buffer size (should be > max. datagram)*/
144 143
 	unsigned int wq_blk_size; /* async write block size (debugging use) */
145 144
 };
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
... ...
@@ -140,6 +140,8 @@ struct cfg_group_tcp{
140 140
 	int new_conn_alias_flags;
141 141
 	/* internal, "fixed" vars */
142 142
 	unsigned int tcp_wq_timeout; /* in ticks, timeout for queued writes */
143
+	unsigned int rd_buf_size; /* read buffer size (should be > max. datagram)*/
144
+	unsigned int wq_blk_size; /* async write block size (debugging use) */
143 145
 };
144 146
 
145 147
 extern struct cfg_group_tcp tcp_default_cfg;
Browse code

tcp: dyn. config fix for tcp_con_lifetime

- cfg.set_delayed_int didn't work (fixup tried to modify another
config variable which doesn't work with cfg.set_delayed*)

Andrei Pelinescu-Onciul authored on 09/03/2009 13:39:10
Showing 1 changed files
... ...
@@ -111,9 +111,9 @@
111 111
 
112 112
 struct cfg_group_tcp{
113 113
 	/* ser tcp options, low level */
114
-	int connect_timeout_s; /* in s, used only in non-async mode */
114
+	int connect_timeout_s; /* in s */
115 115
 	int send_timeout_s; /* in s */
116
-	int con_lifetime_s; /* in s */
116
+	int con_lifetime; /* s fixed to ticks */
117 117
 	int max_connections;
118 118
 	int no_connect; /* do not open any new tcp connection (but accept them) */
119 119
 	int fd_cache; /* on /off */
... ...
@@ -140,7 +140,6 @@ struct cfg_group_tcp{
140 140
 	int new_conn_alias_flags;
141 141
 	/* internal, "fixed" vars */
142 142
 	unsigned int tcp_wq_timeout; /* in ticks, timeout for queued writes */
143
-	unsigned int con_lifetime; /* in ticks, see con_lifetime_s */
144 143
 };
145 144
 
146 145
 extern struct cfg_group_tcp tcp_default_cfg;
Browse code

tcp: config option to disable active connects

- added new config option to disable active connects. If set ser
will only accept new connection, it will not actively open new
ones.
The option can be set both in ser.cfg (tcp_no_connect=yes) or
at runtime (sercmd cfg.set_now_int tcp no_connect 1).

Andrei Pelinescu-Onciul authored on 05/03/2009 17:21:30
Showing 1 changed files
... ...
@@ -115,6 +115,7 @@ struct cfg_group_tcp{
115 115
 	int send_timeout_s; /* in s */
116 116
 	int con_lifetime_s; /* in s */
117 117
 	int max_connections;
118
+	int no_connect; /* do not open any new tcp connection (but accept them) */
118 119
 	int fd_cache; /* on /off */
119 120
 	/* tcp async options */
120 121
 	int async; /* on / off */
Browse code

tcp: async mode on by default

- async mode is now on by default (use tcp_async=no in the config
to disable it)
- renamed tcp_buf_write/TCP_BUF_WRITE into tcp_async/TCP_ASYNC in
the code

Andrei Pelinescu-Onciul authored on 05/03/2009 17:21:11
Showing 1 changed files
... ...
@@ -28,17 +28,17 @@
28 28
 
29 29
 #ifdef USE_TCP
30 30
 
31
-#ifndef NO_TCP_BUF_WRITE
32
-#define TCP_BUF_WRITE /* enabled buffered writing */
33
-#endif 
31
+#ifndef NO_TCP_ASYNC
32
+#define TCP_ASYNC /* enabled async mode */
33
+#endif
34 34
 
35
-#if !defined(NO_TCP_CONNECT_WAIT) && defined(TCP_BUF_WRITE)
35
+#if !defined(NO_TCP_CONNECT_WAIT) && defined(TCP_ASYNC)
36 36
 #define TCP_CONNECT_WAIT /* enable pending connects support */
37 37
 #endif
38 38
 
39
-#if defined(TCP_CONNECT_WAIT) && !defined(TCP_BUF_WRITE)
40
-/* check for impossible configuration: TCP_CONNECT_WAIT w/o TCP_BUF_WRITE */
41
-#warning "disabling TCP_CONNECT_WAIT because TCP_BUF_WRITE is not defined"
39
+#if defined(TCP_CONNECT_WAIT) && !defined(TCP_ASYNC)
40
+/* check for impossible configuration: TCP_CONNECT_WAIT w/o TCP_ASYNC */
41
+#warning "disabling TCP_CONNECT_WAIT because TCP_ASYNC is not defined"
42 42
 #undef TCP_CONNECT_WAIT
43 43
 #endif
44 44
 
... ...
@@ -117,8 +117,8 @@ struct cfg_group_tcp{
117 117
 	int max_connections;
118 118
 	int fd_cache; /* on /off */
119 119
 	/* tcp async options */
120
-	int tcp_buf_write; /* on / off */
121
-	int tcp_connect_wait; /* on / off, depends on tcp_buf_write */
120
+	int async; /* on / off */
121
+	int tcp_connect_wait; /* on / off, depends on async */
122 122
 	unsigned int tcpconn_wq_max; /* maximum queue len per connection */
123 123
 	unsigned int tcp_wq_max; /* maximum overall queued bytes */
124 124
 
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
... ...
@@ -110,14 +110,17 @@
110 110
 #endif /* USE_TCP */
111 111
 
112 112
 struct cfg_group_tcp{
113
-	/* ser tcp options */
113
+	/* ser tcp options, low level */
114
+	int connect_timeout_s; /* in s, used only in non-async mode */
115
+	int send_timeout_s; /* in s */
116
+	int con_lifetime_s; /* in s */
117
+	int max_connections;
114 118
 	int fd_cache; /* on /off */
115 119
 	/* tcp async options */
116 120
 	int tcp_buf_write; /* on / off */
117 121
 	int tcp_connect_wait; /* on / off, depends on tcp_buf_write */
118 122
 	unsigned int tcpconn_wq_max; /* maximum queue len per connection */
119 123
 	unsigned int tcp_wq_max; /* maximum overall queued bytes */
120
-	unsigned int tcp_wq_timeout;      /* timeout for queued writes */
121 124
 
122 125
 	/* tcp socket options */
123 126
 	int defer_accept; /* on / off */
... ...
@@ -131,6 +134,12 @@ struct cfg_group_tcp{
131 134
 	
132 135
 	/* other options */
133 136
 	int crlf_ping;  /* on/off - reply to double CRLF keepalives */
137
+	int accept_aliases;
138
+	int alias_flags;
139
+	int new_conn_alias_flags;
140
+	/* internal, "fixed" vars */
141
+	unsigned int tcp_wq_timeout; /* in ticks, timeout for queued writes */
142
+	unsigned int con_lifetime; /* in ticks, see con_lifetime_s */
134 143
 };
135 144
 
136 145
 extern struct cfg_group_tcp tcp_default_cfg;
Browse code

tcp: use dynamic config framework, part 1

- all tcp config variables from tcp_options.h migrated to the
dynamic configuration framework. For now all are read only, but
write support will come soon where it makes sense.
E.g.: (with the cfg_rpc module loaded)
$ sercmd cfg.help tcp async
async mode for writes and connects
(parameter type is integer)

$ sercmd cfg.get tcp async
0

Andrei Pelinescu-Onciul authored on 05/03/2009 17:20:22
Showing 1 changed files
... ...
@@ -109,15 +109,15 @@
109 109
 
110 110
 #endif /* USE_TCP */
111 111
 
112
-struct tcp_cfg_options{
112
+struct cfg_group_tcp{
113 113
 	/* ser tcp options */
114 114
 	int fd_cache; /* on /off */
115
-	/* tcp buf. write options */
115
+	/* tcp async options */
116 116
 	int tcp_buf_write; /* on / off */
117 117
 	int tcp_connect_wait; /* on / off, depends on tcp_buf_write */
118 118
 	unsigned int tcpconn_wq_max; /* maximum queue len per connection */
119 119
 	unsigned int tcp_wq_max; /* maximum overall queued bytes */
120
-	unsigned int tcp_wq_timeout;      /* timeout for queue writes */
120
+	unsigned int tcp_wq_timeout;      /* timeout for queued writes */
121 121
 
122 122
 	/* tcp socket options */
123 123
 	int defer_accept; /* on / off */
... ...
@@ -128,14 +128,20 @@ struct tcp_cfg_options{
128 128
 	int keepidle;   /* idle time (s) before tcp starts sending keepalives */
129 129
 	int keepintvl;  /* interval between keep alives */
130 130
 	int keepcnt;    /* maximum no. of keepalives before giving up */
131
+	
132
+	/* other options */
131 133
 	int crlf_ping;  /* on/off - reply to double CRLF keepalives */
132 134
 };
133 135
 
136
+extern struct cfg_group_tcp tcp_default_cfg;
137
+
138
+/* tcp config handle*/
139
+extern void* tcp_cfg;
134 140
 
135
-extern struct tcp_cfg_options tcp_options;
136 141
 
137 142
 void init_tcp_options();
138 143
 void tcp_options_check();
139
-void tcp_options_get(struct tcp_cfg_options* t);
144
+int tcp_register_cfg();
145
+void tcp_options_get(struct cfg_group_tcp* t);
140 146
 
141 147
 #endif /* tcp_options_h */
Browse code

- fixed compilation without tcp support (no -DUSE_TCP)

Andrei Pelinescu-Onciul authored on 30/04/2008 19:53:04
Showing 1 changed files
... ...
@@ -26,6 +26,7 @@
26 26
 #ifndef tcp_options_h
27 27
 #define tcp_options_h
28 28
 
29
+#ifdef USE_TCP
29 30
 
30 31
 #ifndef NO_TCP_BUF_WRITE
31 32
 #define TCP_BUF_WRITE /* enabled buffered writing */
... ...
@@ -106,6 +107,7 @@
106 107
 #endif /* __OS_ */
107 108
 #endif /* NO_TCP_QUICKACK */
108 109
 
110
+#endif /* USE_TCP */
109 111
 
110 112
 struct tcp_cfg_options{
111 113
 	/* ser tcp options */
Browse code

added CRLF ping/pong keepalives aka SIP outbound

Alfred E. Heggestad authored on 24/04/2008 13:51:26
Showing 1 changed files
... ...
@@ -126,6 +126,7 @@ struct tcp_cfg_options{
126 126
 	int keepidle;   /* idle time (s) before tcp starts sending keepalives */
127 127
 	int keepintvl;  /* interval between keep alives */
128 128
 	int keepcnt;    /* maximum no. of keepalives before giving up */
129
+	int crlf_ping;  /* on/off - reply to double CRLF keepalives */
129 130
 };
130 131
 
131 132
 
Browse code

- tcp: support for pending connects: add a connection immediately to the connection hash (before even attempting the connect sys call) and just queue possible writes. When the connection completes update the connection info & aliases and send the queued data. This avoids parallel connects when the intial connect takes too long (highly experimental, on by default)

Andrei Pelinescu-Onciul authored on 21/12/2007 17:58:07
Showing 1 changed files
... ...
@@ -31,6 +31,16 @@
31 31
 #define TCP_BUF_WRITE /* enabled buffered writing */
32 32
 #endif 
33 33
 
34
+#if !defined(NO_TCP_CONNECT_WAIT) && defined(TCP_BUF_WRITE)
35
+#define TCP_CONNECT_WAIT /* enable pending connects support */
36
+#endif
37
+
38
+#if defined(TCP_CONNECT_WAIT) && !defined(TCP_BUF_WRITE)
39
+/* check for impossible configuration: TCP_CONNECT_WAIT w/o TCP_BUF_WRITE */
40
+#warning "disabling TCP_CONNECT_WAIT because TCP_BUF_WRITE is not defined"
41
+#undef TCP_CONNECT_WAIT
42
+#endif
43
+
34 44
 #ifndef NO_TCP_FD_CACHE
35 45
 #define TCP_FD_CACHE /* enable fd caching */
36 46
 #endif
... ...
@@ -102,6 +112,7 @@ struct tcp_cfg_options{
102 112
 	int fd_cache; /* on /off */
103 113
 	/* tcp buf. write options */
104 114
 	int tcp_buf_write; /* on / off */
115
+	int tcp_connect_wait; /* on / off, depends on tcp_buf_write */
105 116
 	unsigned int tcpconn_wq_max; /* maximum queue len per connection */
106 117
 	unsigned int tcp_wq_max; /* maximum overall queued bytes */
107 118
 	unsigned int tcp_wq_timeout;      /* timeout for queue writes */
Browse code

fixed typo to fix compilation on OS X

Nils Ohlmeier authored on 05/12/2007 22:04:41
Showing 1 changed files
... ...
@@ -41,7 +41,7 @@
41 41
 #ifndef  NO_TCP_DEFER_ACCEPT
42 42
 #ifdef __OS_linux
43 43
 #define HAVE_TCP_DEFER_ACCEPT
44
-#elif define __OS_freebsd
44
+#elif defined __OS_freebsd
45 45
 #define HAVE_TCP_ACCEPT_FILTER
46 46
 #endif /* __OS_ */
47 47
 #endif /* NO_TCP_DEFER_ACCEPT */
Browse code

- tcp support for queueing writes: if some data cannot be written immediately on the socket (socket buffers full or still connecting), the data will be queued and written at a latter time (max. queue size per socket is controlled by tcp_conn_wq_max, timeout by tcp_send_timeout and total queued bytes / max. mem. used by tcp_wq_max). By default disabled (experimental), to enable it use tcp_buf_write=yes in ser.cfg. To compile without queueing support use -DNO_TCP_BUF_WRITE.

Andrei Pelinescu-Onciul authored on 04/12/2007 20:25:29
Showing 1 changed files
... ...
@@ -26,6 +26,11 @@
26 26
 #ifndef tcp_options_h
27 27
 #define tcp_options_h
28 28
 
29
+
30
+#ifndef NO_TCP_BUF_WRITE
31
+#define TCP_BUF_WRITE /* enabled buffered writing */
32
+#endif 
33
+
29 34
 #ifndef NO_TCP_FD_CACHE
30 35
 #define TCP_FD_CACHE /* enable fd caching */
31 36
 #endif
... ...
@@ -95,6 +100,12 @@
95 100
 struct tcp_cfg_options{
96 101
 	/* ser tcp options */
97 102
 	int fd_cache; /* on /off */
103
+	/* tcp buf. write options */
104
+	int tcp_buf_write; /* on / off */
105
+	unsigned int tcpconn_wq_max; /* maximum queue len per connection */
106
+	unsigned int tcp_wq_max; /* maximum overall queued bytes */
107
+	unsigned int tcp_wq_timeout;      /* timeout for queue writes */
108
+
98 109
 	/* tcp socket options */
99 110
 	int defer_accept; /* on / off */
100 111
 	int delayed_ack; /* delay ack on connect */ 
Browse code

- advanced tcp options support: - support for defering tcp accepts until some data is received (linux & freebsd), default off. See NEWS: tcp_defer_accept. - support for delaying the final ACK from the 3-way handshake until some data is sent (the ACK will come with the 1st data segment). Default on when supported (linux only). See NEWS: tcp_delayed_ack. - support for limiting the number of retransmitted SYNs (linux only, see NEW: tcp_syncnt) - support for limiting the lifetime of orphaned sockets in FIN_WAIT2 (linux only, see NEWS: tcp_linger2) - keepalive support, see NEWS: tcp_keepalive (default on), tcp_keepidle, tcp_keepintvl and tcp_keepcnt

- the FD cache can now be turned off from ser.cfg (see NEW: tcp_fd_cache)

Andrei Pelinescu-Onciul authored on 28/11/2007 19:20:47
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,116 @@
1
+/* 
2
+ * $Id$
3
+ * 
4
+ * Copyright (C) 2007 iptelorg GmbH
5
+ *
6
+ * Permission to use, copy, modify, and distribute this software for any
7
+ * purpose with or without fee is hereby granted, provided that the above
8
+ * copyright notice and this permission notice appear in all copies.
9
+ *
10
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
+ */
18
+/*
19
+ * tcp options
20
+ *
21
+ * History:
22
+ * --------
23
+ *  2007-11-28  created by andrei
24
+ */
25
+
26
+#ifndef tcp_options_h
27
+#define tcp_options_h
28
+
29
+#ifndef NO_TCP_FD_CACHE
30
+#define TCP_FD_CACHE /* enable fd caching */
31
+#endif
32
+
33
+
34
+
35
+/* defer accept */
36
+#ifndef  NO_TCP_DEFER_ACCEPT
37
+#ifdef __OS_linux
38
+#define HAVE_TCP_DEFER_ACCEPT
39
+#elif define __OS_freebsd
40
+#define HAVE_TCP_ACCEPT_FILTER
41
+#endif /* __OS_ */
42
+#endif /* NO_TCP_DEFER_ACCEPT */
43
+
44
+
45
+/* syn count */
46
+#ifndef NO_TCP_SYNCNT
47
+#ifdef __OS_linux
48
+#define HAVE_TCP_SYNCNT
49
+#endif /* __OS_*/
50
+#endif /* NO_TCP_SYNCNT */
51
+
52
+/* tcp linger2 */
53
+#ifndef NO_TCP_LINGER2
54
+#ifdef __OS_linux
55
+#define HAVE_TCP_LINGER2
56
+#endif /* __OS_ */
57
+#endif /* NO_TCP_LINGER2 */
58
+
59
+/* keepalive */
60
+#ifndef NO_TCP_KEEPALIVE
61
+#define HAVE_SO_KEEPALIVE
62
+#endif /* NO_TCP_KEEPALIVE */
63
+
64
+/* keepintvl */
65
+#ifndef NO_TCP_KEEPINTVL
66
+#ifdef __OS_linux
67
+#define HAVE_TCP_KEEPINTVL
68
+#endif /* __OS_ */
69
+#endif /* NO_TCP_KEEPIDLE */
70
+
71
+/* keepidle */
72
+#ifndef NO_TCP_KEEPIDLE
73
+#ifdef __OS_linux
74
+#define HAVE_TCP_KEEPIDLE
75
+#endif /* __OS_*/
76
+#endif /* NO_TCP_KEEPIDLE */
77
+
78
+
79
+/* keepcnt */
80
+#ifndef NO_TCP_KEEPCNT
81
+#ifdef __OS_linux
82
+#define HAVE_TCP_KEEPCNT
83
+#endif /* __OS_ */
84
+#endif /* NO_TCP_KEEPCNT */
85
+
86
+
87
+/* delayed ack (quick_ack) */
88
+#ifndef NO_TCP_QUICKACK
89
+#ifdef __OS_linux
90
+#define HAVE_TCP_QUICKACK
91
+#endif /* __OS_ */
92
+#endif /* NO_TCP_QUICKACK */
93
+
94
+
95
+struct tcp_cfg_options{
96
+	/* ser tcp options */
97
+	int fd_cache; /* on /off */
98
+	/* tcp socket options */
99
+	int defer_accept; /* on / off */
100
+	int delayed_ack; /* delay ack on connect */ 
101
+	int syncnt;     /* numbers of SYNs retrs. before giving up connecting */
102
+	int linger2;    /* lifetime of orphaned  FIN_WAIT2 state sockets */
103
+	int keepalive;  /* on /off */
104
+	int keepidle;   /* idle time (s) before tcp starts sending keepalives */
105
+	int keepintvl;  /* interval between keep alives */
106
+	int keepcnt;    /* maximum no. of keepalives before giving up */
107
+};
108
+
109
+
110
+extern struct tcp_cfg_options tcp_options;
111
+
112
+void init_tcp_options();
113
+void tcp_options_check();
114
+void tcp_options_get(struct tcp_cfg_options* t);
115
+
116
+#endif /* tcp_options_h */