Module: sip-router
Branch: master
Commit: 0873991755f732a3a57cfeb8d0d9437f4fd306bb
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0873991…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Thu Mar 5 23:47:02 2009 +0100
Add parsed_uri structure to the to_body structure.
This is a compatiblity change inspired by kamailio changes. It makes
it possible to store already parsed to and from URIs in the sip
message structure and there is no need to reparse such URIs later.
To and From headers are often parsed repeatedly in modules.
As a side effect I had to avoid a nasty cyclic dependency in parser
headers. I removed parse_to from msg_parser.h, the header does not have
to be included there because nothing in msg_parser.h uses stuff from
parse_to. In addition to that many files that previously included only
msg_parser.h, and assumed that the header would pull parse_to.h as well,
needed to be modified to include parse_to.h explicitly.
---
msg_translator.c | 1 +
parser/msg_parser.c | 1 +
parser/msg_parser.h | 1 -
parser/parse_from.h | 1 +
parser/parse_to.h | 2 ++
5 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/msg_translator.c b/msg_translator.c
index ae52878..3df42d4 100644
--- a/msg_translator.c
+++ b/msg_translator.c
@@ -139,6 +139,7 @@
#include "ut.h"
#include "pt.h"
#include "cfg/cfg.h"
+#include "parser/parse_to.h"
#include "forward.h"
diff --git a/parser/msg_parser.c b/parser/msg_parser.c
index a7df061..e50d3ff 100644
--- a/parser/msg_parser.c
+++ b/parser/msg_parser.c
@@ -58,6 +58,7 @@
#include "parse_hname2.h"
#include "parse_uri.h"
#include "parse_content.h"
+#include "parse_to.h"
#include "../compiler_opt.h"
#ifdef DEBUG_DMALLOC
diff --git a/parser/msg_parser.h b/parser/msg_parser.h
index b1541b7..86855e8 100644
--- a/parser/msg_parser.h
+++ b/parser/msg_parser.h
@@ -59,7 +59,6 @@
#include "../config.h"
#include "parse_def.h"
#include "parse_cseq.h"
-#include "parse_to.h"
#include "parse_via.h"
#include "parse_fline.h"
#include "parse_retry_after.h"
diff --git a/parser/parse_from.h b/parser/parse_from.h
index f9e149a..1618627 100644
--- a/parser/parse_from.h
+++ b/parser/parse_from.h
@@ -29,6 +29,7 @@
#ifndef _PARSE_FROM_H
#define _PARSE_FROM_H
+#include "parse_to.h"
#include "msg_parser.h"
diff --git a/parser/parse_to.h b/parser/parse_to.h
index c032cb1..08e4fc4 100644
--- a/parser/parse_to.h
+++ b/parser/parse_to.h
@@ -30,6 +30,7 @@
#define PARSE_TO
#include "../str.h"
+#include "msg_parser.h"
enum {
TAG_PARAM = 400, GENERAL_PARAM
@@ -49,6 +50,7 @@ struct to_body{
str uri; /* URI */
str display; /* Display Name */
str tag_value; /* Value of tag */
+ struct sip_uri parsed_uri;
struct to_param *param_lst; /* Linked list of parameters */
struct to_param *last_param; /* Last parameter in the list */
};
Module: sip-router
Branch: master
Commit: d7a5e7bc4343c6638207c7343891126e37e20495
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d7a5e7b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Mar 5 18:43:52 2009 +0100
Merge branch 'ser_core_cvs' of ssh://git.sip-router.org/sip-router
* 'ser_core_cvs' of ssh://git.sip-router.org/sip-router:
tcp: config option to disable active connects
tcp: async mode on by default
tcp: enable runtime changing for most of the cfg vars
tcp: use dynamic config framework, part 2
tcp: use dynamic config framework, part 1
test: updated parse uri test program
sctp: rpc info command
sctp: connection reuse & connection tracking
sctp: empty sctp_handle_assoc_change added
regfree() function call is added to free the memory allocated by regcomp().
Conflicts:
usr_avp.c - regex free fix from sip-router conflicted with the
one from ser (they were the same)
---
Module: sip-router
Branch: ser_core_cvs
Commit: 22db42e4efe8cd4a85e05a54cf513b3d1fd0ee53
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=22db42e…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Mar 5 17:20:22 2009 +0000
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
---
cfg.y | 26 ++++++------
core_cmd.c | 2 +-
main.c | 46 +++++++++++---------
tcp_main.c | 86 ++++++++++++++++++------------------
tcp_options.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++---------
tcp_options.h | 16 +++++--
tcp_read.c | 2 +-
7 files changed, 207 insertions(+), 105 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=22d…
Module: sip-router
Branch: ser_core_cvs
Commit: de223f0173f640973cfda1f3b4ffc4dde5b6b5d4
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=de223f0…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Mar 5 17:21:30 2009 +0000
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).
---
NEWS | 8 +++++++-
cfg.lex | 3 +++
cfg.y | 9 +++++++++
core_cmd.c | 3 ++-
tcp_main.c | 3 +++
tcp_options.c | 2 ++
tcp_options.h | 1 +
7 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index ad12ca4..e889550 100644
--- a/NEWS
+++ b/NEWS
@@ -209,12 +209,15 @@ modules:
- t_set_retr(t1, t2) - changes the retransmissions
intervals on the fly, on a per transaction basis.
core:
+ - most tcp config vars migrated to the dynamic config framework
+ (can be changed at runtime, e.g.
+ sercmd cfg.set_now_int tcp connection_lifetime 180 )
- fallback to tcp or other congestion controlled transport
protocol if a forwarded udp sip request is greater then
udp_mtu (config). Default off. See udp_mtu and
udp_mtu_try_proto.
- sctp support (one-to-many, work in progress, for now linux
- only with no fallback to one-to-one on full send buffers)
+ and freebsd only)
- partial cygwin (windows) support revived: core+static modules,
no ipv6, no tcp, no dynamic modules
- most of the config variables can now be changed on the fly,
@@ -233,6 +236,9 @@ core:
between the short name and long name in cache as CNAME record
new config variables:
+ tcp_no_connect = yes/no - disable connects, ser will only accept new
+ connections, it will never try to open new ones.
+ Default: no, can be changed at runtime.
udp_mtu = number - fallback to another protocol (udp_mtu_try_proto must be
set also either globally or per packet) if the constructed
request size is greater then udp_mtu.
diff --git a/cfg.lex b/cfg.lex
index e36a625..b8d2877 100644
--- a/cfg.lex
+++ b/cfg.lex
@@ -298,6 +298,7 @@ TCP_CONNECT_TIMEOUT "tcp_connect_timeout"
TCP_CON_LIFETIME "tcp_connection_lifetime"
TCP_POLL_METHOD "tcp_poll_method"
TCP_MAX_CONNECTIONS "tcp_max_connections"
+TCP_NO_CONNECT "tcp_no_connect"
TCP_SOURCE_IPV4 "tcp_source_ipv4"
TCP_SOURCE_IPV6 "tcp_source_ipv6"
TCP_OPT_FD_CACHE "tcp_fd_cache"
@@ -592,6 +593,8 @@ EAT_ABLE [\ \t\b\r]
return TCP_POLL_METHOD; }
<INITIAL>{TCP_MAX_CONNECTIONS} { count(); yylval.strval=yytext;
return TCP_MAX_CONNECTIONS; }
+<INITIAL>{TCP_NO_CONNECT} { count(); yylval.strval=yytext;
+ return TCP_NO_CONNECT; }
<INITIAL>{TCP_SOURCE_IPV4} { count(); yylval.strval=yytext;
return TCP_SOURCE_IPV4; }
<INITIAL>{TCP_SOURCE_IPV6} { count(); yylval.strval=yytext;
diff --git a/cfg.y b/cfg.y
index 1523af1..04d5d3e 100644
--- a/cfg.y
+++ b/cfg.y
@@ -351,6 +351,7 @@ static void free_socket_id_lst(struct socket_id* i);
%token TCP_CON_LIFETIME
%token TCP_POLL_METHOD
%token TCP_MAX_CONNECTIONS
+%token TCP_NO_CONNECT
%token TCP_SOURCE_IPV4
%token TCP_SOURCE_IPV6
%token TCP_OPT_FD_CACHE
@@ -839,6 +840,14 @@ assign_stm:
#endif
}
| TCP_MAX_CONNECTIONS EQUAL error { yyerror("number expected"); }
+ | TCP_NO_CONNECT EQUAL NUMBER {
+ #ifdef USE_TCP
+ tcp_default_cfg.no_connect=$3;
+ #else
+ warn("tcp support not compiled in");
+ #endif
+ }
+ | TCP_NO_CONNECT EQUAL error { yyerror("boolean value expected"); }
| TCP_SOURCE_IPV4 EQUAL ipv4 {
#ifdef USE_TCP
if (tcp_set_src_addr($3)<0)
diff --git a/core_cmd.c b/core_cmd.c
index d2d7aed..c22e59e 100644
--- a/core_cmd.c
+++ b/core_cmd.c
@@ -565,11 +565,12 @@ static void core_tcp_options(rpc_t* rpc, void* c)
if (!tcp_disable){
tcp_options_get(&t);
rpc->add(c, "{", &handle);
- rpc->struct_add(handle, "dddddddddddddddddddddd",
+ rpc->struct_add(handle, "ddddddddddddddddddddddd",
"connect_timeout", t.connect_timeout_s,
"send_timeout", t.send_timeout_s,
"connection_lifetime", t.con_lifetime_s,
"max_connections(soft)", t.max_connections,
+ "no_connect", t.no_connect,
"fd_cache", t.fd_cache,
"async", t.async,
"connect_wait", t.tcp_connect_wait,
diff --git a/tcp_main.c b/tcp_main.c
index 86fedb7..ecf9ebf 100644
--- a/tcp_main.c
+++ b/tcp_main.c
@@ -1659,6 +1659,9 @@ int tcp_send(struct dest_info* dst, union sockaddr_union* from,
}
no_id:
if (unlikely(c==0)){
+ /* check if connect() is disabled */
+ if (cfg_get(tcp, tcp_cfg, no_connect))
+ return -1;
DBG("tcp_send: no open tcp connection found, opening new one\n");
/* create tcp connection */
if (likely(from==0)){
diff --git a/tcp_options.c b/tcp_options.c
index f66a7ae..21591d1 100644
--- a/tcp_options.c
+++ b/tcp_options.c
@@ -88,6 +88,8 @@ static cfg_def_t tcp_cfg_def[] = {
{ "max_connections", CFG_VAR_INT | CFG_ATOMIC, 0, (1U<<31)-1,
fix_max_conns, 0,
"maximum connection number, soft limit"},
+ { "no_connect", CFG_VAR_INT | CFG_ATOMIC, 0, 1, 0, 0,
+ "if set only accept new connections, never actively open new ones"},
{ "fd_cache", CFG_VAR_INT | CFG_READONLY, 0, 1, 0, 0,
"file descriptor cache for tcp_send"},
/* tcp async options */
diff --git a/tcp_options.h b/tcp_options.h
index 7a05e59..24df41e 100644
--- a/tcp_options.h
+++ b/tcp_options.h
@@ -115,6 +115,7 @@ struct cfg_group_tcp{
int send_timeout_s; /* in s */
int con_lifetime_s; /* in s */
int max_connections;
+ int no_connect; /* do not open any new tcp connection (but accept them) */
int fd_cache; /* on /off */
/* tcp async options */
int async; /* on / off */