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 112
 
113 113
 
114 114
 
115
-char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_len)
115
+char * build_req_buf_from_sip_req(	struct sip_msg* msg,
116
+									unsigned int *returned_len)
116 117
 {
117 118
 	unsigned int len, new_len, via_len, received_len, uri_len, branch_len;
118 119
 	char* line_buf;
... ...
@@ -148,7 +154,8 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
148 148
 	via_len=MY_VIA_LEN+names_len[0]; /* space included in MY_VIA*/
149 149
 
150 150
 	/* 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;
151
+	branch_len= (loop_checks ? MY_BRANCH_LEN : MY_BRANCH_LEN -1 + MD5_LEN)+
152
+					msg->add_to_branch.len;
152 153
 
153 154
 	if ((via_len+port_no_str_len+branch_len+CRLF_LEN)<MAX_VIA_LINE_SIZE){
154 155
 		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 175
 				src[4]= get_cseq( msg )->number;
176 176
 
177 177
 				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",
178
+				DBG("DEBUG: build_req_buf_from_sip_req: branch loop "
179
+						"detection: %s, %s, %s, %s, %s -> %s32\n",
179 180
 					msg->from->body.s, msg->to->body.s, msg->callid->body.s, 
180 181
 					msg->first_line.u.request.uri.s,
181 182
 					((struct cseq_body *)(msg->cseq->parsed))->number.s,
182 183
 					line_buf+via_len-1 );
183
-				DBG("WARNING: build_req_buf_from_sip_req: branch computation NOT over canonical values\n");
184
+				DBG("WARNING: build_req_buf_from_sip_req: branch computation "
185
+						"NOT over canonical values\n");
184 186
 				via_len+=MD5_LEN - 1;
185 187
 				
186
-			} else DBG("DEBUG: build_req_buf_from_sip_req: required HFs for loop checking missing\n");
188
+			} else DBG("DEBUG: build_req_buf_from_sip_req: required HFs for "
189
+					"loop checking missing\n");
187 190
 		}
188 191
 		/* 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 );
192
+		memcpy(line_buf+via_len, msg->add_to_branch.s,
193
+				msg->add_to_branch.len );
190 194
 		via_len+=msg->add_to_branch.len;
191 195
 
192 196
 		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 257
 					break;
258 258
 				default:
259 259
 					/* 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);
260
+					LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: invalid op "
261
+							"for data lump (%x)\n", r->op);
262 262
 			}
263 263
 		}
264 264
 		switch(t->op){
... ...
@@ -340,8 +351,8 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
340 340
 							break;
341 341
 						default:
342 342
 							/* 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);
343
+							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: "
344
+									"invalid op for data lump (%x)\n", r->op);
345 345
 
346 346
 					}
347 347
 				}
... ...
@@ -358,8 +369,8 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
358 358
 							break;
359 359
 						default:
360 360
 							/* 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);
361
+							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: "
362
+									"invalid op for data lump (%x)\n", r->op);
363 363
 					}
364 364
 				}
365 365
 				break;
... ...
@@ -389,8 +400,8 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
389 389
 							break;
390 390
 						default:
391 391
 							/* 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);
392
+							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: "
393
+									"invalid op for data lump (%x)\n", r->op);
394 394
 
395 395
 					}
396 396
 				}
... ...
@@ -409,14 +420,14 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, unsigned int *returned_le
409 409
 							break;
410 410
 						default:
411 411
 							/* 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);
412
+							LOG(L_CRIT, "BUG:build_req_buf_from_sip_req: "
413
+									"invalid op for data lump (%x)\n", r->op);
414 414
 					}
415 415
 				}
416 416
 				break;
417 417
 			default:
418
-					LOG(L_CRIT, "BUG: build_req_buf_from_sip_req: unknown op (%x)\n",
419
-							t->op);
418
+					LOG(L_CRIT, "BUG: build_req_buf_from_sip_req: "
419
+							"unknown op (%x)\n", t->op);
420 420
 		}
421 421
 	}
422 422
 	/* copy the rest of the message */
... ...
@@ -438,7 +449,8 @@ error:
438 438
 
439 439
 
440 440
 
441
-char * build_res_buf_from_sip_res(struct sip_msg* msg, unsigned int *returned_len)
441
+char * build_res_buf_from_sip_res(	struct sip_msg* msg,
442
+									unsigned int *returned_len)
442 443
 {
443 444
 	unsigned int new_len, via_len,r;
444 445
 	char* new_buf;
... ...
@@ -500,7 +512,10 @@ error:
500 500
 
501 501
 
502 502
 
503
-char * build_res_buf_from_sip_req(unsigned int code , char *text , struct sip_msg* msg, unsigned int *returned_len)
503
+char * build_res_buf_from_sip_req(	unsigned int code ,
504
+									char *text ,
505
+									struct sip_msg* msg, 
506
+									unsigned int *returned_len)
504 507
 {
505 508
 	char                    *buf=0, *p;
506 509
 	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 512
 	len += 3/*code*/ + 1/*space*/ + strlen(text) + 1/*new line*/;
513 513
 	/*headers that will be copied (TO, FROM, CSEQ,CALLID,VIA)*/
514 514
 	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 )
515
+		if ( hdr->type==HDR_VIA || hdr->type==HDR_FROM ||
516
+				hdr->type==HDR_CALLID || hdr->type==HDR_TO ||
517
+				hdr->type==HDR_CSEQ )
516 518
 			len += ((hdr->body.s+hdr->body.len ) - hdr->name.s ) +1;
517 519
 	/* end of message */
518 520
 	len += 1; /*new line*/
... ...
@@ -536,9 +553,12 @@ char * build_res_buf_from_sip_req(unsigned int code , char *text , struct sip_ms
536 536
 	*(p++) = '\n';
537 537
 	/* headers*/
538 538
 	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 )
539
+		if ( hdr->type==HDR_VIA || hdr->type==HDR_FROM ||
540
+				hdr->type==HDR_CALLID || hdr->type==HDR_TO ||
541
+				hdr->type==HDR_CSEQ )
540 542
 		{
541
-			memcpy( p , hdr->name.s ,  ((hdr->body.s+hdr->body.len ) - hdr->name.s ) );
543
+			memcpy( p , hdr->name.s ,  ((hdr->body.s+hdr->body.len ) -
544
+						hdr->name.s ) );
542 545
 			len += ((hdr->body.s+hdr->body.len ) - hdr->name.s );
543 546
 			*(p++) = '\n';
544 547
 		}
... ...
@@ -551,7 +571,3 @@ error:
551 551
 	*returned_len=0;
552 552
 	return 0;
553 553
 }
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