Browse code

- cosmetic changes

Andrei Pelinescu-Onciul authored on 29/11/2001 19:51:32
Showing 3 changed files
... ...
@@ -50,7 +50,6 @@ int forward_request( struct sip_msg* msg, struct proxy_l * p)
50 50
 		goto error;
51 51
 	}
52 52
 
53
-	to=0;
54 53
 	to=(struct sockaddr_in*)malloc(sizeof(struct sockaddr));
55 54
 	if (to==0){
56 55
 		LOG(L_ERR, "ERROR: forward_reply: out of memory\n");
... ...
@@ -1,3 +1,8 @@
1
+/* $Id$
2
+ *
3
+ */
4
+
5
+
1 6
 #include <sys/socket.h>
2 7
 
3 8
 #include "msg_translator.h"
... ...
@@ -112,7 +117,8 @@ int check_address(unsigned long ip, char *name, int resolver)
112 117
 
113 118
 
114 119
 
115
-char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_len)
120
+char * build_req_buf_from_sip_req(	struct sip_msg* msg,
121
+									unsigned int *returned_len)
116 122
 {
117 123
 	unsigned int len, new_len, via_len, received_len, uri_len, branch_len;
118 124
 	char* line_buf;
... ...
@@ -148,7 +154,8 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
148 154
 	via_len=MY_VIA_LEN+names_len[0]; /* space included in MY_VIA*/
149 155
 
150 156
 	/* jku: if we compute branches using MD5 it will take 32 bytes */
151
-	branch_len= (loop_checks ? MY_BRANCH_LEN : MY_BRANCH_LEN -1 + MD5_LEN) + msg->add_to_branch.len;
157
+	branch_len= (loop_checks ? MY_BRANCH_LEN : MY_BRANCH_LEN -1 + MD5_LEN)+
158
+					msg->add_to_branch.len;
152 159
 
153 160
 	if ((via_len+port_no_str_len+branch_len+CRLF_LEN)<MAX_VIA_LINE_SIZE){
154 161
 		memcpy(line_buf, MY_VIA, MY_VIA_LEN);
... ...
@@ -175,18 +182,22 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
175 182
 				src[4]= get_cseq( msg )->number;
176 183
 
177 184
 				MDStringArray ( line_buf+via_len-1, src, 5 );
178
-				DBG("DEBUG: build_req_buf_from_sip_req: branch loop detection: %s, %s, %s, %s, %s -> %s32\n",
185
+				DBG("DEBUG: build_req_buf_from_sip_req: branch loop "
186
+						"detection: %s, %s, %s, %s, %s -> %s32\n",
179 187
 					msg->from->body.s, msg->to->body.s, msg->callid->body.s, 
180 188
 					msg->first_line.u.request.uri.s,
181 189
 					((struct cseq_body *)(msg->cseq->parsed))->number.s,
182 190
 					line_buf+via_len-1 );
183
-				DBG("WARNING: build_req_buf_from_sip_req: branch computation NOT over canonical values\n");
191
+				DBG("WARNING: build_req_buf_from_sip_req: branch computation "
192
+						"NOT over canonical values\n");
184 193
 				via_len+=MD5_LEN - 1;
185 194
 				
186
-			} else DBG("DEBUG: build_req_buf_from_sip_req: required HFs for loop checking missing\n");
195
+			} else DBG("DEBUG: build_req_buf_from_sip_req: required HFs for "
196
+					"loop checking missing\n");
187 197
 		}
188 198
 		/* someone wants me to add something to branch here ? */
189
-		memcpy(line_buf+via_len, msg->add_to_branch.s, msg->add_to_branch.len );
199
+		memcpy(line_buf+via_len, msg->add_to_branch.s,
200
+				msg->add_to_branch.len );
190 201
 		via_len+=msg->add_to_branch.len;
191 202
 
192 203
 		memcpy(line_buf+via_len, CRLF, CRLF_LEN);
... ...
@@ -257,8 +268,8 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
257 268
 					break;
258 269
 				default:
259 270
 					/* only ADD allowed for before/after */
260
-					LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: invalid op for"
261
-								" data lump (%x)\n", r->op);
271
+					LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: invalid op "
272
+							"for data lump (%x)\n", r->op);
262 273
 			}
263 274
 		}
264 275
 		switch(t->op){
... ...
@@ -340,8 +351,8 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
340 351
 							break;
341 352
 						default:
342 353
 							/* only ADD allowed for before/after */
343
-							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: invalid op for"
344
-									" data lump (%x)\n", r->op);
354
+							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: "
355
+									"invalid op for data lump (%x)\n", r->op);
345 356
 
346 357
 					}
347 358
 				}
... ...
@@ -358,8 +369,8 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
358 369
 							break;
359 370
 						default:
360 371
 							/* only ADD allowed for before/after */
361
-							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: invalid op for"
362
-									" data lump (%x)\n", r->op);
372
+							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: "
373
+									"invalid op for data lump (%x)\n", r->op);
363 374
 					}
364 375
 				}
365 376
 				break;
... ...
@@ -389,8 +400,8 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
389 400
 							break;
390 401
 						default:
391 402
 							/* only ADD allowed for before/after */
392
-							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: invalid op for"
393
-									" data lump (%x)\n", r->op);
403
+							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: "
404
+									"invalid op for data lump (%x)\n", r->op);
394 405
 
395 406
 					}
396 407
 				}
... ...
@@ -409,14 +420,14 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
409 420
 							break;
410 421
 						default:
411 422
 							/* only ADD allowed for before/after */
412
-							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: invalid op for"
413
-									" data lump (%x)\n", r->op);
423
+							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: "
424
+									"invalid op for data lump (%x)\n", r->op);
414 425
 					}
415 426
 				}
416 427
 				break;
417 428
 			default:
418
-					LOG(L_CRIT, "BUG: build_req_buf_from_sip_req: unknown op (%x)\n",
419
-							t->op);
429
+					LOG(L_CRIT, "BUG: build_req_buf_from_sip_req: "
430
+							"unknown op (%x)\n", t->op);
420 431
 		}
421 432
 	}
422 433
 	/* copy the rest of the message */
... ...
@@ -438,7 +449,8 @@ error:
438 449
 
439 450
 
440 451
 
441
-char * build_res_buf_from_sip_res(struct sip_msg* msg, unsigned int *returned_len)
452
+char * build_res_buf_from_sip_res(	struct sip_msg* msg,
453
+									unsigned int *returned_len)
442 454
 {
443 455
 	unsigned int new_len, via_len,r;
444 456
 	char* new_buf;
... ...
@@ -500,7 +512,10 @@ error:
500 512
 
501 513
 
502 514
 
503
-char * build_res_buf_from_sip_req(unsigned int code , char *text , struct sip_msg* msg, unsigned int *returned_len)
515
+char * build_res_buf_from_sip_req(	unsigned int code ,
516
+									char *text ,
517
+									struct sip_msg* msg, 
518
+									unsigned int *returned_len)
504 519
 {
505 520
 	char                    *buf=0, *p;
506 521
 	unsigned int       len,foo,i;
... ...
@@ -512,7 +527,9 @@ char * build_res_buf_from_sip_req(unsigned int code , char *text , struct sip_ms
512 527
 	len += 3/*code*/ + 1/*space*/ + strlen(text) + 1/*new line*/;
513 528
 	/*headers that will be copied (TO, FROM, CSEQ,CALLID,VIA)*/
514 529
 	for ( hdr=msg->headers ; hdr ; hdr=hdr->next )
515
-		if ( hdr->type==HDR_VIA || hdr->type==HDR_FROM || hdr->type==HDR_CALLID || hdr->type==HDR_TO || hdr->type==HDR_CSEQ )
530
+		if ( hdr->type==HDR_VIA || hdr->type==HDR_FROM ||
531
+				hdr->type==HDR_CALLID || hdr->type==HDR_TO ||
532
+				hdr->type==HDR_CSEQ )
516 533
 			len += ((hdr->body.s+hdr->body.len ) - hdr->name.s ) +1;
517 534
 	/* end of message */
518 535
 	len += 1; /*new line*/
... ...
@@ -536,9 +553,12 @@ char * build_res_buf_from_sip_req(unsigned int code , char *text , struct sip_ms
536 553
 	*(p++) = '\n';
537 554
 	/* headers*/
538 555
 	for ( hdr=msg->headers ; hdr ; hdr=hdr->next )
539
-		if ( hdr->type==HDR_VIA || hdr->type==HDR_FROM || hdr->type==HDR_CALLID || hdr->type==HDR_TO || hdr->type==HDR_CSEQ )
556
+		if ( hdr->type==HDR_VIA || hdr->type==HDR_FROM ||
557
+				hdr->type==HDR_CALLID || hdr->type==HDR_TO ||
558
+				hdr->type==HDR_CSEQ )
540 559
 		{
541
-			memcpy( p , hdr->name.s ,  ((hdr->body.s+hdr->body.len ) - hdr->name.s ) );
560
+			memcpy( p , hdr->name.s ,  ((hdr->body.s+hdr->body.len ) -
561
+						hdr->name.s ) );
542 562
 			len += ((hdr->body.s+hdr->body.len ) - hdr->name.s );
543 563
 			*(p++) = '\n';
544 564
 		}
... ...
@@ -551,7 +571,3 @@ error:
551 571
 	*returned_len=0;
552 572
 	return 0;
553 573
 }
554
-
555
-
556
-
557
-
... ...
@@ -1,13 +1,22 @@
1
+/*$Id$
2
+ * 
3
+ */
4
+
1 5
 #ifndef  _MSG_TRANSLATOR_H
2 6
 #define _MSG_TRANSLATOR_H
3 7
 
4 8
 #include "msg_parser.h"
5 9
 
6
-char * build_req_buf_from_sip_req  (struct sip_msg* msg, unsigned int *returned_len);
10
+char * build_req_buf_from_sip_req (	struct sip_msg* msg, 
11
+									unsigned int *returned_len);
7 12
 
8
-char * build_res_buf_from_sip_res(struct sip_msg* msg, unsigned int *returned_len);
13
+char * build_res_buf_from_sip_res(	struct sip_msg* msg,
14
+									unsigned int *returned_len);
9 15
 
10
-char * build_res_buf_from_sip_req(unsigned int code , char *text , struct sip_msg* msg, unsigned int *returned_len);
16
+char * build_res_buf_from_sip_req(	unsigned int code , 
17
+									char *text ,
18
+									struct sip_msg* msg,
19
+									unsigned int *returned_len);
11 20
 
12 21
 
13 22