소스 검색

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

Peter Dunkley 12 년 전
부모
커밋
8e6c690ea3
2개의 변경된 파일19개의 추가작업 그리고 7개의 파일을 삭제
  1. 15 5
      dset.c
  2. 4 2
      dset.h

+ 15 - 5
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;

+ 4 - 2
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