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 188
 	}else{
208 189
 		LOG(L_ERR, "build_req_buf_from_sip_req: ERROR: via too long (%d)\n",
209 190
 				via_len);
210
-		goto error1;
191
+		goto error;
211 192
 	}
212 193
 
194
+	*len = via_len;
195
+	return line_buf;
196
+
197
+error:
198
+	if (line_buf) pkg_free(line_buf);
199
+	return 0;
200
+}
201
+
202
+
203
+
213 204
 
214 205
 
206
+
207
+
208
+
209
+
210
+
211
+
212
+char * build_req_buf_from_sip_req(	struct sip_msg* msg,
213
+				unsigned int *returned_len)
214
+{
215
+	unsigned int len, new_len, received_len, uri_len, via_len;
216
+	char* line_buf;
217
+	char* received_buf;
218
+	char* tmp;
219
+	int tmp_len;
220
+	char* new_buf;
221
+	char* orig;
222
+	char* buf;
223
+	unsigned int offset, s_offset, size;
224
+	unsigned long source_ip;
225
+	struct lump *t,*r;
226
+	struct lump* anchor;
227
+
228
+	orig=msg->orig;
229
+	buf=msg->buf;
230
+	len=msg->len;
231
+	source_ip=msg->src_ip;
232
+	received_len=0;
233
+	new_buf=0;
234
+	received_buf=0;
235
+
236
+
237
+	line_buf = via_builder( msg, &via_len );
238
+	if (!line_buf){
239
+		LOG(L_ERR,"ERROR: build_req_buf_from_sip_req: no via received!\n");
240
+		goto error1;
241
+	}
242
+
215 243
 	/* check if received needs to be added */
216 244
 	if (check_address(source_ip, msg->via1->host.s, received_dns)!=0){
217 245
 		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 468
 	return new_buf;
441 469
 
442 470
 error1:
443
-	if (line_buf) pkg_free(line_buf);
444 471
 	if (received_buf) pkg_free(received_buf);
472
+	if (line_buf) pkg_free(line_buf);
445 473
 error:
446 474
 	if (new_buf) free(new_buf);
447 475
 	*returned_len=0;