Browse code

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

Peter Dunkley authored on 14/03/2013 23:32:42
Showing 2 changed files
... ...
@@ -215,7 +215,8 @@ void set_branch_iterator(int n)
215 215
  */
216 216
 char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
217 217
 		 str* path, unsigned int *flags,
218
-		 struct socket_info** force_socket)
218
+		 struct socket_info** force_socket,
219
+		 str *ruid)
219 220
 {
220 221
 	if (i < nr_branches) {
221 222
 		*len = branches[i].len;
... ...
@@ -232,6 +233,10 @@ char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
232 233
 			*force_socket = branches[i].force_send_socket;
233 234
 		if (flags)
234 235
 			*flags = branches[i].flags;
236
+		if (ruid) {
237
+			ruid->len = branches[i].ruid_len;
238
+			ruid->s = (ruid->len)?branches[i].ruid:0;
239
+		}
235 240
 		return branches[i].uri;
236 241
 	} else {
237 242
 		*len = 0;
... ...
@@ -248,6 +253,10 @@ char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
248 253
 			*force_socket = 0;
249 254
 		if (flags)
250 255
 			*flags = 0;
256
+		if (ruid) {
257
+			ruid->s = 0;
258
+			ruid->len = 0;
259
+		}
251 260
 		return 0;
252 261
 	}
253 262
 }
... ...
@@ -258,12 +267,13 @@ char* get_branch(unsigned int i, int* len, qvalue_t* q, str* dst_uri,
258 267
  * 0 is returned if there are no more branches
259 268
  */
260 269
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
261
-		  unsigned int* flags, struct socket_info** force_socket)
270
+		  unsigned int* flags, struct socket_info** force_socket,
271
+		  str* ruid)
262 272
 {
263 273
 	char* ret;
264 274
 	
265 275
 	ret=get_branch(branch_iterator, len, q, dst_uri, path, flags,
266
-		       force_socket);
276
+		       force_socket, ruid);
267 277
 	if (likely(ret))
268 278
 		branch_iterator++;
269 279
 	return ret;
... ...
@@ -432,7 +442,7 @@ char* print_dset(struct sip_msg* msg, int* len)
432 442
 	crt_branch = get_branch_iterator();
433 443
 
434 444
 	init_branch_iterator();
435
-	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0))) {
445
+	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0))) {
436 446
 		cnt++;
437 447
 		*len += uri.len;
438 448
 		if (q != Q_UNSPECIFIED) {
... ...
@@ -473,7 +483,7 @@ char* print_dset(struct sip_msg* msg, int* len)
473 483
 	}
474 484
 
475 485
 	init_branch_iterator();
476
-	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0))) {
486
+	while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0, 0))) {
477 487
 		if (i) {
478 488
 			memcpy(p, CONTACT_DELIM, CONTACT_DELIM_LEN);
479 489
 			p += CONTACT_DELIM_LEN;
... ...
@@ -139,11 +139,13 @@ void set_branch_iterator(int n);
139 139
  *  *len) or 0 if there are no more branches.
140 140
  */
141 141
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
142
-		  unsigned int* flags, struct socket_info** force_socket);
142
+		  unsigned int* flags, struct socket_info** force_socket,
143
+		  str *ruid);
143 144
 
144 145
 char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
145 146
 		  str* path, unsigned int *flags,
146
-		  struct socket_info** force_socket);
147
+		  struct socket_info** force_socket,
148
+		  str* ruid);
147 149
 
148 150
 /*! \brief
149 151
  * Empty the array of branches