[SR-Dev] git:master: Add parsed_uri structure to the to_body structure.

Jan Janak jan at iptel.org
Fri Mar 6 15:22:42 CET 2009


Module: sip-router
Branch: master
Commit: 0873991755f732a3a57cfeb8d0d9437f4fd306bb
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0873991755f732a3a57cfeb8d0d9437f4fd306bb

Author: Jan Janak <jan at iptel.org>
Committer: Jan Janak <jan at 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 */
 };




More information about the sr-dev mailing list