Browse code

- Copyright statement added to dlg.c and dlg.h - Updated to support loose routing (a message is not necessary forwarded to its R-URI)

Jan Janak authored on 01/04/2003 09:14:29
Showing 5 changed files
... ...
@@ -1,6 +1,29 @@
1 1
 /*
2 2
  * $Id$
3 3
  *
4
+ * Copyright (C) 2001-2003 Fhg Fokus
5
+ *
6
+ * This file is part of ser, a free SIP server.
7
+ *
8
+ * ser is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * For a license to use the ser software under conditions
14
+ * other than those described here, or to purchase support for this
15
+ * software, please contact iptel.org by e-mail at the following addresses:
16
+ *   info@iptel.org
17
+ *
18
+ * ser is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License
24
+ * along with this program; if not, write to the Free Software
25
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ *
4 27
  * History:
5 28
  * -------
6 29
  * 2003-03-29 Created by janakj
... ...
@@ -1,5 +1,27 @@
1 1
 /*
2 2
  * $Id$
3
+ * Copyright (C) 2001-2003 Fhg Fokus
4
+ *
5
+ * This file is part of ser, a free SIP server.
6
+ *
7
+ * ser is free software; you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation; either version 2 of the License, or
10
+ * (at your option) any later version
11
+ *
12
+ * For a license to use the ser software under conditions
13
+ * other than those described here, or to purchase support for this
14
+ * software, please contact iptel.org by e-mail at the following addresses:
15
+ *   info@iptel.org
16
+ *
17
+ * ser is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program; if not, write to the Free Software
24
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
3 25
  *
4 26
  * History:
5 27
  * -------
... ...
@@ -228,10 +228,8 @@ int t_relay_to( struct sip_msg  *p_msg , struct proxy_l *proxy, int proto,
228 228
 	if ( p_msg->REQ_METHOD==METHOD_ACK) {
229 229
 		DBG( "SER: forwarding ACK  statelessly \n");
230 230
 		if (proxy==0) {
231
-			uri=(p_msg->new_uri.s==0 || p_msg->new_uri.len==0) ?
232
-				&p_msg->first_line.u.request.uri :
233
-				&p_msg->new_uri;
234
-			proxy=uri2proxy( uri, proto );
231
+			uri = &GET_RURI(p_msg);
232
+			proxy=uri2proxy(&GET_NEXT_HOP(p_msg), proto);
235 233
 			if (proxy==0) {
236 234
 					ret=E_BAD_ADDRESS;
237 235
 					goto done;
... ...
@@ -160,7 +160,7 @@ int add_blind_uac( /*struct cell *t*/ )
160 160
    or error (<0); it doesn't send a message yet -- a reply to it
161 161
    might interfere with the processes of adding multiple branches
162 162
 */
163
-int add_uac( struct cell *t, struct sip_msg *request, str *uri, 
163
+int add_uac( struct cell *t, struct sip_msg *request, str *uri, str* next_hop,
164 164
 	struct proxy_l *proxy, int proto )
165 165
 {
166 166
 
... ...
@@ -188,7 +188,7 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri,
188 188
 
189 189
 	/* check DNS resolution */
190 190
 	if (proxy) temp_proxy=0; else {
191
-		proxy=uri2proxy( uri, proto );
191
+		proxy=uri2proxy( next_hop ? next_hop : uri, proto );
192 192
 		if (proxy==0)  {
193 193
 			ret=E_BAD_ADDRESS;
194 194
 			goto error;
... ...
@@ -414,10 +414,7 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
414 414
 	   is in additional branches (which may be continuously refilled
415 415
 	*/
416 416
 	if (first_branch==0) {
417
-		branch_ret=add_uac( t, p_msg, 
418
-			p_msg->new_uri.s ? &p_msg->new_uri :  
419
-				&p_msg->first_line.u.request.uri,
420
-				proxy, proto );
417
+		branch_ret=add_uac( t, p_msg, &GET_RURI(p_msg), &GET_NEXT_HOP(p_msg), proxy, proto );
421 418
 		if (branch_ret>=0) 
422 419
 			added_branches |= 1<<branch_ret;
423 420
 		else
... ...
@@ -426,7 +423,7 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
426 423
 
427 424
 	init_branch_iterator();
428 425
 	while((current_uri.s=next_branch( &current_uri.len))) {
429
-		branch_ret=add_uac( t, p_msg, &current_uri, proxy, proto);
426
+		branch_ret=add_uac( t, p_msg, &current_uri, 0, proxy, proto);
430 427
 		/* pick some of the errors in case things go wrong;
431 428
 		   note that picking lowest error is just as good as
432 429
 		   any other algorithm which picks any other negative
... ...
@@ -47,7 +47,7 @@ char *print_uac_request( struct cell *t, struct sip_msg *i_req,
47 47
     int branch, str *uri, unsigned int *len, struct socket_info *send_sock );
48 48
 void e2e_cancel( struct sip_msg *cancel_msg, struct cell *t_cancel, struct cell *t_invite );
49 49
 int e2e_cancel_branch( struct sip_msg *cancel_msg, struct cell *t_cancel, struct cell *t_invite, int branch );
50
-int add_uac(	struct cell *t, struct sip_msg *request, str *uri,
50
+int add_uac(	struct cell *t, struct sip_msg *request, str *uri, str* next_hop,
51 51
 				struct proxy_l *proxy, int proto );
52 52
 int add_blind_uac( /* struct cell *t */ );
53 53
 int t_forward_nonack( struct cell *t, struct sip_msg* p_msg,