Browse code

- small fixes/cosmetic changes

Andrei Pelinescu-Onciul authored on 03/12/2001 16:25:38
Showing 2 changed files
... ...
@@ -41,10 +41,10 @@
41 41
 int forward_request( struct sip_msg* msg, struct proxy_l * p)
42 42
 {
43 43
 	unsigned int len;
44
-	char* buf=NULL;
45
-	struct sockaddr_in* to=NULL;
46
-
44
+	char* buf;
45
+	struct sockaddr_in* to;
47 46
 
47
+	to=0;
48 48
 	buf = build_req_buf_from_sip_req( msg, &len);
49 49
 	if (!buf){
50 50
 		LOG(L_ERR, "ERROR: forward_reply: building failed\n");
... ...
@@ -58,7 +58,7 @@ int forward_request( struct sip_msg* msg, struct proxy_l * p)
58 58
 	}
59 59
 
60 60
 	 /* send it! */
61
-	DBG("Sending:", buf);
61
+	DBG("Sending:\n%s.\n", buf);
62 62
 	DBG("orig. len=%d, new_len=%d\n", msg->len, len );
63 63
 
64 64
 	to->sin_family = AF_INET;
... ...
@@ -102,6 +102,7 @@ error:
102 102
 int update_sock_struct_from_via( struct sockaddr_in* to,  struct via_body* via )
103 103
 {
104 104
 	int err;
105
+	struct hostent* he;
105 106
 
106 107
 	to->sin_family = AF_INET;
107 108
 	to->sin_port = (via->port)?htons(via->port): htons(SIP_PORT);
... ...
@@ -111,7 +112,6 @@ int update_sock_struct_from_via( struct sockaddr_in* to,  struct via_body* via )
111 111
 	if (err)
112 112
 #endif
113 113
 	{
114
-		struct hostent* he;
115 114
 		/* fork? gethostbyname will probably block... */
116 115
 		he=gethostbyname(via->host.s);
117 116
 		if (he==0){
... ...
@@ -129,9 +129,8 @@ int update_sock_struct_from_via( struct sockaddr_in* to,  struct via_body* via )
129 129
 int forward_reply(struct sip_msg* msg)
130 130
 {
131 131
 	int  r;
132
-	char* new_buf=NULL;
133
-	struct hostent* he=NULL;
134
-	struct sockaddr_in* to=NULL;
132
+	char* new_buf;
133
+	struct sockaddr_in* to;
135 134
 	unsigned int new_len;
136 135
 	struct sr_module *mod;
137 136
 #ifdef DNS_IP_HACK
... ...
@@ -140,6 +139,8 @@ int forward_reply(struct sip_msg* msg)
140 140
 
141 141
 
142 142
 
143
+	to=0;
144
+	new_buf=0;
143 145
 	/*check if first via host = us */
144 146
 	if (check_via){
145 147
 		for (r=0; r<addresses_no; r++)
... ...
@@ -162,7 +163,6 @@ int forward_reply(struct sip_msg* msg)
162 162
 		}
163 163
 	}
164 164
 	
165
-	to=0;
166 165
 	to=(struct sockaddr_in*)malloc(sizeof(struct sockaddr));
167 166
 	if (to==0){
168 167
 		LOG(L_ERR, "ERROR: forward_reply: out of memory\n");
... ...
@@ -227,20 +227,19 @@ void free_sip_msg(struct sip_msg* msg);
227 227
    parsed; return 0 if those HFs can't be found
228 228
  */
229 229
 
230
-/*
231 230
 #define check_transaction_quadruple(msg ) \
232
-	(parse_headers(msg, HDR_FROM|HDR_TO|HDR_CALLID|HDR_CSEQ)!=-1 && \
233
-	 msg->from && msg->to && msg->callid && msg->cseq)
234
-*/
231
+	(parse_headers((msg), HDR_FROM|HDR_TO|HDR_CALLID|HDR_CSEQ)!=-1 && \
232
+	(msg)->from && (msg)->to && (msg)->callid && (msg)->cseq)
235 233
 
236 234
 /* restored to the original double-check and put macro params
237 235
    in parenthesses  -jiri */
238
-
236
+/* re-reverted to the shorter version -andrei 
239 237
 #define check_transaction_quadruple(msg ) \
240 238
    ( ((msg)->from || (parse_headers( (msg), HDR_FROM)!=-1 && (msg)->from)) && 	\
241 239
    ((msg)->to|| (parse_headers( (msg), HDR_TO)!=-1 && (msg)->to)) &&		\
242 240
    ((msg)->callid|| (parse_headers( (msg), HDR_CALLID)!=-1 && (msg)->callid)) &&\
243 241
    ((msg)->cseq|| (parse_headers( (msg), HDR_CSEQ)!=-1 && (msg)->cseq)) && \
244 242
    ((msg)->via1|| (parse_headers( (msg), HDR_VIA)!=-1 && (msg)->via1)) ) 
245
-
243
+*/
244
+	
246 245
 #endif