Browse code

- replaced msg->src_ip w/ msg->rcv.src_ip (to be in sync w/ core)$ - updated all get_send_sock , forward_request & via_builder calls to the new format (proto included) [now it compiles and hopefully works on udp]

Andrei Pelinescu-Onciul authored on 12/12/2002 21:42:33
Showing 5 changed files
... ...
@@ -221,7 +221,7 @@ int t_relay_to( struct sip_msg  *p_msg , struct proxy_l *proxy,
221 221
 					ret=E_BAD_ADDRESS;
222 222
 					goto done;
223 223
 			}
224
-			ret=forward_request( p_msg , proxy ) ;
224
+			ret=forward_request( p_msg , proxy, p_msg->rcv.proto) ;
225 225
 			free_proxy( proxy );	
226 226
 			free( proxy );
227 227
 #ifdef ACK_FORKING_HACK
... ...
@@ -238,7 +238,7 @@ int t_relay_to( struct sip_msg  *p_msg , struct proxy_l *proxy,
238 238
 			p_msg->new_uri=backup_uri;
239 239
 #endif
240 240
 		} else {
241
-			ret=forward_request( p_msg , proxy ) ;
241
+			ret=forward_request( p_msg , proxy, p_msg->rcv.proto ) ;
242 242
 #ifdef ACK_FORKING_HACK
243 243
 			backup_uri=p_msg->new_uri;
244 244
 			init_branch_iterator();
... ...
@@ -79,7 +79,7 @@ char *print_uac_request( struct cell *t, struct sip_msg *i_req,
79 79
 	callback_event( TMCB_REQUEST_OUT, t, i_req, -i_req->REQ_METHOD);
80 80
 
81 81
 	/* ... and build it now */
82
-	buf=build_req_buf_from_sip_req( i_req, len, send_sock );
82
+	buf=build_req_buf_from_sip_req( i_req, len, send_sock, i_req->rcv.proto );
83 83
 #ifdef DBG_MSG_QA
84 84
 	if (buf[*len-1]==0) {
85 85
 		LOG(L_ERR, "ERROR: print_uac_request: sanity check failed\n");
... ...
@@ -173,7 +173,7 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri,
173 173
 	hostent2su( &to, &proxy->host, proxy->addr_idx, 
174 174
 		proxy->port ? htons(proxy->port):htons(SIP_PORT));
175 175
 
176
-	send_sock=get_send_socket( &to );
176
+	send_sock=get_send_socket( &to , request->rcv.proto);
177 177
 	if (send_sock==0) {
178 178
 		LOG(L_ERR, "ERROR: add_uac: can't fwd to af %d "
179 179
 			" (no corresponding listening socket)\n",
... ...
@@ -724,7 +724,7 @@ int init_rb( struct retr_buf *rb, struct sip_msg *msg )
724 724
 			return 0;
725 725
 		}
726 726
 	}
727
-	send_sock=get_send_socket(&rb->to);
727
+	send_sock=get_send_socket(&rb->to, msg->rcv.proto);
728 728
 	if (send_sock==0) {
729 729
 		LOG(L_ERR, "ERROR: init_rb: cannot fwd to af %d "
730 730
 			"no socket\n", rb->to.s.sa_family);
... ...
@@ -81,7 +81,7 @@ char *build_local(struct cell *Trans,unsigned int branch,
81 81
 		branch_buf, &branch_len ))
82 82
 		goto error;
83 83
 	via=via_builder(&via_len, Trans->uac[branch].request.send_sock,
84
-		branch_buf, branch_len );
84
+		branch_buf, branch_len, Trans->uac[branch].request.send_sock->proto );
85 85
 	if (!via)
86 86
 	{
87 87
 		LOG(L_ERR, "ERROR: t_build_and_send_CANCEL: "
... ...
@@ -225,7 +225,7 @@ char *build_uac_request(  str msg_type, str dst, str from,
225 225
 		goto error;
226 226
 	}
227 227
 	via=via_builder(&via_len, t->uac[branch].request.send_sock,
228
-		branch_buf, branch_len );
228
+		branch_buf, branch_len, t->uac[branch].request.send_sock->proto);
229 229
 	
230 230
 	if (!via) {
231 231
 		LOG(L_ERR, "ERROR: build_uac_request: via building failed\n");
... ...
@@ -365,7 +365,8 @@ char *build_uac_request_dlg(str* msg,           /* Method */
365 365
 		goto error;
366 366
 	}
367 367
 
368
-	via = via_builder(&via_len, t->uac[branch].request.send_sock, branch_buf, branch_len);
368
+	via = via_builder(&via_len, t->uac[branch].request.send_sock, 
369
+			branch_buf, branch_len, t->uac[branch].request.send_sock->proto);
369 370
 	if (!via) {
370 371
 		LOG(L_ERR, "ERROR: build_uac_request_dlg: via building failed\n");
371 372
 		goto error;
... ...
@@ -202,7 +202,7 @@ int t_uac( str *msg_type, str *dst,
202 202
 	/* T->uac[branch].request.to_len=sizeof(union sockaddr_union); */
203 203
 	hostent2su(&to, &proxy->host, proxy->addr_idx, 
204 204
 		(proxy->port)?htons(proxy->port):htons(SIP_PORT));
205
-	send_sock=get_send_socket( &to );
205
+	send_sock=get_send_socket( &to, PROTO_UDP );
206 206
 	if (send_sock==0) {
207 207
 		LOG(L_ERR, "ERROR: t_uac: no corresponding listening socket "
208 208
 			"for af %d\n", to.s.sa_family );
... ...
@@ -345,7 +345,7 @@ int t_uac_dlg(str* msg,                     /* Type of the message - MESSAGE, OP
345 345
 
346 346
 	branch=0;
347 347
 	hostent2su(&to_su, &proxy->host, proxy->addr_idx, (proxy->port) ? htons(proxy->port) : htons(SIP_PORT));
348
-	send_sock=get_send_socket(&to_su);
348
+	send_sock=get_send_socket(&to_su, PROTO_UDP);
349 349
 	if (send_sock == 0) {
350 350
 		LOG(L_ERR, "ERROR: t_uac_dlg: no corresponding listening socket for af %d\n", to_su.s.sa_family );
351 351
 		ret = E_NO_SOCKET;