Browse code

tm: updated to the new snd_flags_t structure

Andrei Pelinescu-Onciul authored on 17/12/2009 12:29:50
Showing 4 changed files
... ...
@@ -659,8 +659,10 @@ static int add_uac( struct cell *t, struct sip_msg *request, str *uri,
659 659
 		t->uac[branch].request.dst.send_sock =
660 660
 		get_send_socket( request, &t->uac[branch].request.dst.to,
661 661
 								t->uac[branch].request.dst.proto);
662
-		t->uac[branch].request.dst.send_flags=request?
663
-												request->fwd_send_flags:0;
662
+		if (request)
663
+			t->uac[branch].request.dst.send_flags=request->fwd_send_flags;
664
+		else
665
+			SND_FLAGS_INIT(&t->uac[branch].request.dst.send_flags);
664 666
 		next_hop=0;
665 667
 	}else {
666 668
 		next_hop= next_hop?next_hop:uri;
... ...
@@ -845,7 +847,7 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
845 847
 				 * in the rest of the message, only in the VIA HF (Miklos) */
846 848
 				ret=add_uac_from_buf(t,  msg, &old_uac->uri,
847 849
 							&old_uac->path,
848
-							 (old_uac->request.dst.send_flags &
850
+							 (old_uac->request.dst.send_flags.f &
849 851
 								SND_F_FORCE_SOCKET)?
850 852
 									old_uac->request.dst.send_sock:0,
851 853
 							old_uac->request.dst.send_flags,
... ...
@@ -858,7 +860,7 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
858 860
 				 *  must be changed and the send_socket might be different =>
859 861
 				 *  re-create the whole uac */
860 862
 				ret=add_uac(t,  msg, &old_uac->uri, 0, &old_uac->path, 0,
861
-							 (old_uac->request.dst.send_flags &
863
+							 (old_uac->request.dst.send_flags.f &
862 864
 								SND_F_FORCE_SOCKET)?
863 865
 									old_uac->request.dst.send_sock:0,
864 866
 							old_uac->request.dst.send_flags,
... ...
@@ -883,6 +885,7 @@ int e2e_cancel_branch( struct sip_msg *cancel_msg, struct cell *t_cancel,
883 885
 	int ret;
884 886
 	char *shbuf;
885 887
 	unsigned int len;
888
+	snd_flags_t snd_flags;
886 889
 
887 890
 	ret=-1;
888 891
 	if (t_cancel->uac[branch].request.buffer) {
... ...
@@ -928,12 +931,13 @@ int e2e_cancel_branch( struct sip_msg *cancel_msg, struct cell *t_cancel,
928 931
 			cancel_msg->first_line.u.request.method.len+1;
929 932
 		t_cancel->uac[branch].uri.len=t_invite->uac[branch].uri.len;
930 933
 	} else {
934
+		SND_FLAGS_INIT(&snd_flags);
931 935
 		/* buffer is constructed from the received CANCEL with lumps applied */
932 936
 		/*  t_cancel...request.dst is already filled (see above) */
933 937
 		if (unlikely((ret=prepare_new_uac( t_cancel, cancel_msg, branch,
934 938
 									&t_invite->uac[branch].uri,
935 939
 									&t_invite->uac[branch].path,
936
-									0, 0, 0, PROTO_NONE, 0)) <0)){
940
+									0, 0, snd_flags, PROTO_NONE, 0)) <0)){
937 941
 			ser_error=ret;
938 942
 			goto error;
939 943
 		}
... ...
@@ -1612,7 +1612,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
1612 1612
 				}
1613 1613
 				/* update send_flags with possible additions from the
1614 1614
 				   reply route */
1615
-				uas_rb->dst.send_flags|=relayed_msg->rpl_send_flags;
1615
+				uas_rb->dst.send_flags.f|=relayed_msg->rpl_send_flags.f;
1616 1616
 			}
1617 1617
 		}
1618 1618
 		update_reply_stats( relayed_code );
... ...
@@ -215,6 +215,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
215 215
 	int sflag_bk;
216 216
 	int backup_route_type;
217 217
 #endif
218
+	snd_flags_t snd_flags;
218 219
 
219 220
 	ret=-1;
220 221
 	hi=0; /* make gcc happy */
... ...
@@ -239,10 +240,11 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
239 240
 			uac_r->dialog->hooks.next_hop->s);
240 241
 	/* new message => take the dialog send_socket if set, or the default
241 242
 	  send_socket if not*/
243
+	SND_FLAGS_INIT(&snd_flags);
242 244
 #ifdef USE_DNS_FAILOVER
243 245
 	if (cfg_get(core, core_cfg, use_dns_failover)){
244 246
 		dns_srv_handle_init(&dns_h);
245
-		if ((uri2dst2(&dns_h, &dst, uac_r->dialog->send_sock, 0,
247
+		if ((uri2dst2(&dns_h, &dst, uac_r->dialog->send_sock, snd_flags,
246 248
 							uac_r->dialog->hooks.next_hop, PROTO_NONE)==0)
247 249
 				|| (dst.send_sock==0)){
248 250
 			dns_srv_handle_put(&dns_h);
... ...
@@ -253,7 +255,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
253 255
 		}
254 256
 		dns_srv_handle_put(&dns_h); /* not needed anymore */
255 257
 	}else{
256
-		if ((uri2dst2(0, &dst, uac_r->dialog->send_sock, 0,
258
+		if ((uri2dst2(0, &dst, uac_r->dialog->send_sock, snd_flags,
257 259
 						uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
258 260
 				(dst.send_sock==0)){
259 261
 			ser_error = E_NO_SOCKET;
... ...
@@ -263,7 +265,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
263 265
 		}
264 266
 	}
265 267
 #else /* USE_DNS_FAILOVER */
266
-	if ((uri2dst2(&dst, uac_r->dialog->send_sock, 0,
268
+	if ((uri2dst2(&dst, uac_r->dialog->send_sock, snd_flags,
267 269
 					uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
268 270
 			(dst.send_sock==0)){
269 271
 		ser_error = E_NO_SOCKET;
... ...
@@ -356,16 +356,24 @@ inline static struct dest_info *uri2dst(struct dns_srv_handle* dns_h,
356 356
 										struct sip_msg *msg, str *uri, 
357 357
 											int proto )
358 358
 {
359
-	return uri2dst2(dns_h, dst, msg?msg->force_send_socket:0,
360
-						msg?msg->fwd_send_flags:0, uri, proto);
359
+	snd_flags_t sflags;
360
+	if (msg)
361
+		return uri2dst2(dns_h, dst, msg->force_send_socket,
362
+							msg->fwd_send_flags, uri, proto);
363
+	SND_FLAGS_INIT(&sflags);
364
+	return uri2dst2(dns_h, dst, 0, sflags, uri, proto);
361 365
 }
362 366
 #else
363 367
 inline static struct dest_info *uri2dst(struct dest_info* dst,
364 368
 										struct sip_msg *msg, str *uri, 
365 369
 											int proto )
366 370
 {
367
-	return uri2dst2(dst, msg?msg->force_send_socket:0,
368
-						msg?msg->fwd_send_flags:0, uri, proto);
371
+	snd_flags_t sflags;
372
+	if (msg)
373
+		return uri2dst2(dst, msg->force_send_socket, msg->fwd_send_flags,
374
+						uri, proto);
375
+	SND_FLAGS_INIT(&sflags);
376
+	return uri2dst2(dst, 0, sflags, uri, proto);
369 377
 }
370 378
 #endif /* USE_DNS_FAILOVER */
371 379