Browse code

*** empty log message ***

Bogdan-Andrei Iancu authored on 06/12/2001 23:27:56
Showing 2 changed files
... ...
@@ -72,6 +72,12 @@ int tm_startup()
72 72
 
73 73
 void tm_shutdown()
74 74
 {
75
+    int i;
76
+
77
+    /*unlink the lists*/
78
+    for( i=NR_OF_TIMER_LISTS ; i>=0 ; i-- )
79
+       hash_table->timers[ i ].first_tl = hash_table->timers[ i ].last_tl = 0;
80
+
75 81
     /* destroy the hash table */
76 82
     free_hash_table( hash_table );
77 83
 }
... ...
@@ -117,40 +117,21 @@ int check_address(unsigned long ip, char *name, int resolver)
117 117
 
118 118
 
119 119
 
120
-char * build_req_buf_from_sip_req(	struct sip_msg* msg,
121
-				unsigned int *returned_len)
120
+
121
+
122
+
123
+char* via_builder( struct sip_msg *msg , unsigned int *len )
122 124
 {
123
-	unsigned int len, new_len, via_len, received_len, uri_len, branch_len;
124
-	char* line_buf;
125
-	char* received_buf;
126
-	char* tmp;
127
-	int tmp_len;
128
-	char* new_buf;
129
-	char* orig;
130
-	char* buf;
131
-	unsigned int offset, s_offset, size;
132
-	unsigned long source_ip;
133
-	struct lump *t,*r;
134
-	struct lump* anchor;
125
+	unsigned int  via_len, branch_len;
126
+	char               *line_buf;
135 127
 
136
-	orig=msg->orig;
137
-	buf=msg->buf;
138
-	len=msg->len;
139
-	source_ip=msg->src_ip;
140
-	received_len=0;
141
-	new_buf=0;
142 128
 	line_buf=0;
143
-	received_buf=0;
144 129
 
145 130
 	line_buf=pkg_malloc(sizeof(char)*MAX_VIA_LINE_SIZE);
146 131
 	if (line_buf==0){
147
-		LOG(L_ERR, "ERROR: build_req_buf_from_sip_req: out of memory\n");
148
-		goto error1;
132
+		LOG(L_ERR, "ERROR: via_builder: out of memory\n");
133
+		goto error;
149 134
 	}
150
-/*
151
-	via_len=snprintf(line_buf, MAX_VIA_LINE_SIZE, "Via: SIP/2.0/UDP %s:%d\r\n",
152
-						names[0], port_no);
153
-*/
154 135
 	via_len=MY_VIA_LEN+names_len[0]; /* space included in MY_VIA*/
155 136
 
156 137
 	/* jku: if we compute branches using MD5 it will take 32 bytes */
... ...
@@ -207,11 +188,58 @@ char * build_req_buf_from_sip_req(	struct sip_msg* msg,
207 207
 	}else{
208 208
 		LOG(L_ERR, "build_req_buf_from_sip_req: ERROR: via too long (%d)\n",
209 209
 				via_len);
210
-		goto error1;
210
+		goto error;
211 211
 	}
212 212
 
213
+	*len = via_len;
214
+	return line_buf;
215
+
216
+error:
217
+	if (line_buf) pkg_free(line_buf);
218
+	return 0;
219
+}
220
+
221
+
222
+
213 223
 
214 224
 
225
+
226
+
227
+
228
+
229
+
230
+
231
+char * build_req_buf_from_sip_req(	struct sip_msg* msg,
232
+				unsigned int *returned_len)
233
+{
234
+	unsigned int len, new_len, received_len, uri_len, via_len;
235
+	char* line_buf;
236
+	char* received_buf;
237
+	char* tmp;
238
+	int tmp_len;
239
+	char* new_buf;
240
+	char* orig;
241
+	char* buf;
242
+	unsigned int offset, s_offset, size;
243
+	unsigned long source_ip;
244
+	struct lump *t,*r;
245
+	struct lump* anchor;
246
+
247
+	orig=msg->orig;
248
+	buf=msg->buf;
249
+	len=msg->len;
250
+	source_ip=msg->src_ip;
251
+	received_len=0;
252
+	new_buf=0;
253
+	received_buf=0;
254
+
255
+
256
+	line_buf = via_builder( msg, &via_len );
257
+	if (!line_buf){
258
+		LOG(L_ERR,"ERROR: build_req_buf_from_sip_req: no via received!\n");
259
+		goto error1;
260
+	}
261
+
215 262
 	/* check if received needs to be added */
216 263
 	if (check_address(source_ip, msg->via1->host.s, received_dns)!=0){
217 264
 		received_buf=pkg_malloc(sizeof(char)*MAX_RECEIVED_SIZE);
... ...
@@ -440,8 +468,8 @@ char * build_req_buf_from_sip_req(	struct sip_msg* msg,
440 440
 	return new_buf;
441 441
 
442 442
 error1:
443
-	if (line_buf) pkg_free(line_buf);
444 443
 	if (received_buf) pkg_free(received_buf);
444
+	if (line_buf) pkg_free(line_buf);
445 445
 error:
446 446
 	if (new_buf) free(new_buf);
447 447
 	*returned_len=0;