[sr-dev] git:pd/outbound: core: updated get_branch() and next_branch() to return ruid (if set)

Peter Dunkley peter.dunkley at crocodile-rcs.com
Fri Mar 15 00:35:28 CET 2013


Module: sip-router
Branch: pd/outbound
Commit: 8e6c690ea3cdfd9dd1349f2ce144d7dfd432b50d
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8e6c690ea3cdfd9dd1349f2ce144d7dfd432b50d

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Thu Mar 14 23:32:42 2013 +0000

core: updated get_branch() and next_branch() to return ruid (if set)

---

 dset.c |   20 +++++++++++++++-----
 dset.h |    6 ++++--
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/dset.c b/dset.c
index d0aef89..5421d0a 100644
--- a/dset.c
+++ b/dset.c
@@ -215,7 +215,8 @@ void set_branch_iterator(int n)
  */
 char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
 		 str* path, unsigned int *flags,
-		 struct socket_info** force_socket)
+		 struct socket_info** force_socket,
+		 str *ruid)
 {
 	if (i < nr_branches) {
 		*len = branches[i].len;
@@ -232,6 +233,10 @@ char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
 			*force_socket = branches[i].force_send_socket;
 		if (flags)
 			*flags = branches[i].flags;
+		if (ruid) {
+			ruid->len = branches[i].ruid_len;
+			ruid->s = (ruid->len)?branches[i].ruid:0;
+		}
 		return branches[i].uri;
 	} else {
 		*len = 0;
@@ -248,6 +253,10 @@ char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
 			*force_socket = 0;
 		if (flags)
 			*flags = 0;
+		if (ruid) {
+			ruid->s = 0;
+			ruid->len = 0;
+		}
 		return 0;
 	}
 }
@@ -258,12 +267,13 @@ char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
  * 0 is returned if there are no more branches
  */
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
-		  unsigned int* flags, struct socket_info** force_socket)
+		  unsigned int* flags, struct socket_info** force_socket,
+		  str* ruid)
 {
 	char* ret;
 	
 	ret=get_branch(branch_iterator, len, q, dst_uri, path, flags,
-		       force_socket);
+		       force_socket, ruid);
 	if (likely(ret))
 		branch_iterator++;
 	return ret;
@@ -432,7 +442,7 @@ char* print_dset(struct sip_msg* msg, int* len)
 	crt_branch = get_branch_iterator();
 
 	init_branch_iterator();
-	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0))) {
+	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0))) {
 		cnt++;
 		*len += uri.len;
 		if (q != Q_UNSPECIFIED) {
@@ -473,7 +483,7 @@ char* print_dset(struct sip_msg* msg, int* len)
 	}
 
 	init_branch_iterator();
-	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0))) {
+	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0))) {
 		if (i) {
 			memcpy(p, CONTACT_DELIM, CONTACT_DELIM_LEN);
 			p += CONTACT_DELIM_LEN;
diff --git a/dset.h b/dset.h
index 3140f95..2eca07f 100644
--- a/dset.h
+++ b/dset.h
@@ -139,11 +139,13 @@ void set_branch_iterator(int n);
  *  *len) or 0 if there are no more branches.
  */
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
-		  unsigned int* flags, struct socket_info** force_socket);
+		  unsigned int* flags, struct socket_info** force_socket,
+		  str *ruid);
 
 char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
 		  str* path, unsigned int *flags,
-		  struct socket_info** force_socket);
+		  struct socket_info** force_socket,
+		  str* ruid);
 
 /*! \brief
  * Empty the array of branches




More information about the sr-dev mailing list