[sr-dev] git:tmp/ruri_branch: core: support for marking a "consumed" r-uri

Andrei Pelinescu-Onciul andrei at iptel.org
Thu May 27 11:08:17 CEST 2010


Module: sip-router
Branch: tmp/ruri_branch
Commit: b4ea43935347d8e8c0b73f3972177670127f7e50
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b4ea43935347d8e8c0b73f3972177670127f7e50

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu May 27 10:51:51 2010 +0200

core: support for marking a "consumed" r-uri

The main/message r-uri can now be marked as "consumed" during
forking or as "new".
New function introduced (dset.h): ruri_mark_new(),
ruri_mark_consumed(), ruri_get_forking_state().
rewrite_uri() will now automatically mark the uri as "new".

---

 dset.c |   15 ++++++++++-----
 dset.h |   10 ++++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/dset.c b/dset.c
index 8223615..1e5c9e7 100644
--- a/dset.c
+++ b/dset.c
@@ -27,11 +27,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-/*!
- * \file
- * \brief SIP-router core :: 
- * \ingroup core
- * Module: \ref core
+/** destination set / branches support.
+ * @file dset.c
+ * @ingroup core
+ * Module: @ref core
  */
 
 #include <string.h>
@@ -68,6 +67,9 @@ unsigned int nr_branches = 0;
 /* branch iterator */
 static int branch_iterator = 0;
 
+/* used to mark ruris "consumed" when branching (1 new, 0 consumed) */
+int ruri_is_new = 0;
+
 /* The q parameter of the Request-URI */
 static qvalue_t ruri_q = Q_UNSPECIFIED;
 
@@ -266,6 +268,7 @@ void clear_branches(void)
 	nr_branches = 0;
 	ruri_q = Q_UNSPECIFIED;
 	ruri_bflags = 0;
+	ruri_mark_consumed();
 }
 
 
@@ -493,6 +496,8 @@ int rewrite_uri(struct sip_msg* _m, str* _s)
 
         _m->new_uri.s = buf;
         _m->new_uri.len = _s->len;
+        /* mark ruri as new and available for forking */
+        ruri_mark_new();
 
         return 1;
 }
diff --git a/dset.h b/dset.h
index ca91211..6f9f067 100644
--- a/dset.h
+++ b/dset.h
@@ -37,6 +37,7 @@
 
 
 extern unsigned int nr_branches;
+extern int ruri_is_new;
 
 /*! \brief
  * Structure for storing branch attributes
@@ -166,6 +167,15 @@ inline static int get_request_uri(struct sip_msg* _m, str* _u)
 }
 
 
+#define ruri_mark_new() (ruri_is_new = 1)
+
+#define ruri_mark_consumed()  (ruri_is_new = 0)
+
+/** returns whether or not ruri should be used when forking.
+  * (usefull for serial forking)
+  * @return 0 if already marked as consumed, 1 if not.
+ */
+#define ruri_get_forking_state() (ruri_is_new)
 
 int rewrite_uri(struct sip_msg* _m, str* _s);
 




More information about the sr-dev mailing list