Browse code

core/dset: Add options field to print_dset()

Will be used later on to optionally enhance the contacts.

Alex Hermann authored on 31/01/2019 16:28:28 • Henning Westerholt committed on 11/02/2019 20:42:26
Showing 6 changed files
... ...
@@ -472,7 +472,7 @@ int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
472 472
  * end = end of target buffer
473 473
  * Returns 0 on success or -1 on error (buffer is too short)
474 474
  */
475
-static int print_contact_str(char **dest, str *uri, qvalue_t q, char *end)
475
+static int print_contact_str(char **dest, str *uri, qvalue_t q, char *end, int options)
476 476
 {
477 477
 	char *p = *dest;
478 478
 	str buf;
... ...
@@ -507,7 +507,7 @@ static int print_contact_str(char **dest, str *uri, qvalue_t q, char *end)
507 507
  * Create a Contact header field from the dset
508 508
  * array
509 509
  */
510
-char* print_dset(struct sip_msg* msg, int* len)
510
+char* print_dset(struct sip_msg* msg, int* len, int options)
511 511
 {
512 512
 	int cnt = 0;
513 513
 	qvalue_t q;
... ...
@@ -529,7 +529,7 @@ char* print_dset(struct sip_msg* msg, int* len)
529 529
 
530 530
 	/* current uri */
531 531
 	if (msg->new_uri.s) {
532
-		if (print_contact_str(&p, &msg->new_uri, ruri_q, end) < 0) {
532
+		if (print_contact_str(&p, &msg->new_uri, ruri_q, end, options) < 0) {
533 533
 			goto memfail;
534 534
 		}
535 535
 		cnt++;
... ...
@@ -546,7 +546,7 @@ char* print_dset(struct sip_msg* msg, int* len)
546 546
 			p += CONTACT_DELIM_LEN;
547 547
 		}
548 548
 
549
-		if (print_contact_str(&p, &uri, q, end) < 0) {
549
+		if (print_contact_str(&p, &uri, q, end, options) < 0) {
550 550
 			goto memfail;
551 551
 		}
552 552
 
... ...
@@ -158,7 +158,7 @@ void clear_branches(void);
158 158
  * Create a Contact header field from the
159 159
  * list of current branches
160 160
  */
161
-char* print_dset(struct sip_msg* msg, int* len);
161
+char* print_dset(struct sip_msg* msg, int* len, int options);
162 162
 
163 163
 
164 164
 /*! \brief
... ...
@@ -1335,7 +1335,7 @@ int pv_get_dset(struct sip_msg *msg, pv_param_t *param,
1335 1335
 	if(msg==NULL)
1336 1336
 		return -1;
1337 1337
 
1338
-	s.s = print_dset(msg, &s.len);
1338
+	s.s = print_dset(msg, &s.len, 0);
1339 1339
 	if (s.s == NULL)
1340 1340
 		return pv_get_null(msg, param, res);
1341 1341
 	s.len -= CRLF_LEN;
... ...
@@ -150,7 +150,7 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str *tag)
150 150
 
151 151
 	/* if that is a redirection message, dump current message set to it */
152 152
 	if (code>=300 && code<400) {
153
-		dset.s=print_dset(msg, &dset.len);
153
+		dset.s=print_dset(msg, &dset.len, 0);
154 154
 		if (dset.s) {
155 155
 			add_lump_rpl(msg, dset.s, dset.len, LUMP_RPL_HDR);
156 156
 		}
... ...
@@ -640,7 +640,7 @@ static int _reply( struct cell *trans, struct sip_msg* p_msg,
640 640
 
641 641
 	/* if that is a redirection message, dump current message set to it */
642 642
 	if (code>=300 && code<400) {
643
-		dset=print_dset(p_msg, &dset_len);
643
+		dset=print_dset(p_msg, &dset_len, 0);
644 644
 		if (dset) {
645 645
 			add_lump_rpl(p_msg, dset, dset_len, LUMP_RPL_HDR);
646 646
 		}
... ...
@@ -559,7 +559,7 @@ static int xl_get_dset(struct sip_msg *msg, str *res, str *hp, int hi, int hf)
559 559
     if(msg==NULL || res==NULL)
560 560
 	return -1;
561 561
 
562
-    res->s = print_dset(msg, &res->len);
562
+    res->s = print_dset(msg, &res->len, 0);
563 563
 
564 564
     if ((res->s) == NULL) return xl_get_null(msg, res, hp, hi, hf);
565 565