Browse code

TM callbacks, acc, flags

Jiri Kuthan authored on 13/05/2002 01:15:40
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,564 +0,0 @@
1
-/*
2
- * $Id$
3
- *
4
- * header name parsing automaton:
5
-
6
- * parsing:           compact form:
7
- * Via:               v:
8
- * From:              f:
9
- * To:                t:
10
- * Cseq:              n/a
11
- * Call-ID:           i:
12
- * Contact:           m:
13
- * Max-Forwards:      n/a
14
- * Route:             n/a
15
- * Record-Route:      n/a
16
- */
17
-
18
-
19
-#include "msg_parser.h"
20
-#include "dprint.h"
21
-
22
-enum { INITIAL=0,
23
-		VIA1, VIA2,
24
-		FROM1, FROM2, FROM3,
25
-		TO1,
26
-		C_START, CSEQ2, CSEQ3,
27
-		         CALLID2, CALLID3, CALLID4, CALLID5, CALLID6,
28
-		         CONTACT2, CONTACT3, CONTACT4, CONTACT5, CONTACT6,
29
-		M_START,      MAXFORWARDS2, MAXFORWARDS3, MAXFORWARDS4, MAXFORWARDS5,
30
-		MAXFORWARDS6, MAXFORWARDS7, MAXFORWARDS8, MAXFORWARDS9, MAXFORWARDS10,
31
-		MAXFORWARDS11,
32
-		ROUTE1, ROUTE2, ROUTE3, ROUTE4,
33
-                RECROUTE1, RECROUTE2, RECROUTE3, RECROUTE4, RECROUTE5, 
34
-                RECROUTE6, RECROUTE7, RECROUTE8, RECROUTE9, RECROUTE10,
35
-       
36
-		/* final states*/
37
-		F_VIA=1000, F_FROM, F_TO, F_CSEQ, F_CALLID, F_CONTACT, F_MAXFORWARDS,
38
-                F_ROUTE, F_RECROUTE,
39
-		I_START,
40
-
41
-		UNKNOWN_HEADER=200,
42
-		BODY=220,
43
-		LF=25000,
44
-	};
45
-
46
-
47
-/* returns end or pointer to next elem*/
48
-char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
49
-{
50
-
51
-	char* t;
52
-	register int state;
53
-	int err;
54
-	err=0;
55
-
56
-	state=INITIAL;
57
-		
58
-	for(t=p;t<end;t++){
59
-		switch(*t){
60
-			case 'V':
61
-			case 'v':
62
-					switch(state){
63
-						case INITIAL:
64
-							state=VIA1;
65
-							hdr->name.s=t;
66
-							break;
67
-						case UNKNOWN_HEADER: break;
68
-						default:
69
-							state=UNKNOWN_HEADER;
70
-					}
71
-					break;
72
-			case 'I':
73
-			case 'i':
74
-					switch(state){
75
-						case VIA1:
76
-							state=VIA2;
77
-							break;
78
-						case CALLID5:
79
-							state=CALLID6;
80
-							break;
81
-						case INITIAL:
82
-							state=I_START;
83
-							hdr->name.s=t;
84
-							break;
85
-						case UNKNOWN_HEADER: break;
86
-						default:
87
-							state=UNKNOWN_HEADER;
88
-					}
89
-					break;
90
-			case 'A':
91
-			case 'a':
92
-					switch(state){
93
-						case INITIAL:
94
-								state=UNKNOWN_HEADER;
95
-								hdr->name.s=t;
96
-								break;
97
-						case VIA2:
98
-								state=F_VIA;
99
-								break;
100
-						case C_START:  /*CALLID1*/
101
-								state=CALLID2;
102
-								break;
103
-						case CONTACT4:
104
-								state=CONTACT5;
105
-								break;
106
-						case M_START:
107
-								state=MAXFORWARDS2;
108
-								break;
109
-						case MAXFORWARDS8:
110
-								state=MAXFORWARDS9;
111
-								break;
112
-						case UNKNOWN_HEADER: break;
113
-						default:
114
-								state=UNKNOWN_HEADER;
115
-					}
116
-					break;
117
-			case 'F':
118
-			case 'f':
119
-					switch(state){
120
-						case INITIAL:
121
-								state=FROM1;
122
-								hdr->name.s=t;
123
-								break;
124
-						case MAXFORWARDS4:
125
-								state=MAXFORWARDS5;
126
-								break;
127
-						case UNKNOWN_HEADER: break;
128
-						default:
129
-								state=UNKNOWN_HEADER;
130
-					}
131
-					break;
132
-			case 'R':
133
-			case 'r':
134
-					switch(state){
135
-						case INITIAL:
136
-							state=ROUTE1;
137
-							hdr->name.s=t;
138
-							break;
139
-						case FROM1:
140
-							state=FROM2;
141
-							break;
142
-						case MAXFORWARDS6:
143
-							state=MAXFORWARDS7;
144
-							break;
145
-						case MAXFORWARDS9:
146
-							state=MAXFORWARDS10;
147
-							break;
148
-					        case RECROUTE3:
149
-							state=RECROUTE4;
150
-							break;
151
-					        case RECROUTE6:
152
-							state=RECROUTE7;
153
-						case UNKNOWN_HEADER: break;
154
-						default:
155
-							state=UNKNOWN_HEADER;
156
-					}
157
-					break;
158
-			case 'O':
159
-			case 'o':
160
-					switch(state){
161
-						case INITIAL:
162
-								state=UNKNOWN_HEADER;
163
-								hdr->name.s=t;
164
-								break;
165
-						case FROM2:
166
-							state=FROM3;
167
-							break;
168
-						case TO1:
169
-							state=F_TO;
170
-							break;
171
-						case C_START: /*CONTACT1 */
172
-							state=CONTACT2;
173
-							break;
174
-						case ROUTE1:
175
-							state=ROUTE2;
176
-							break;
177
-						case MAXFORWARDS5:
178
-							state=MAXFORWARDS6;
179
-							break;
180
-					        case RECROUTE2:
181
-							state=RECROUTE3;
182
-							break;
183
-					        case RECROUTE7:
184
-							state=RECROUTE8;
185
-							break;
186
-						case UNKNOWN_HEADER: break;
187
-						default:
188
-							state=UNKNOWN_HEADER;
189
-					}
190
-					break;
191
-			case 'M':
192
-			case 'm':
193
-						switch(state){
194
-							case INITIAL:
195
-								state=M_START;
196
-								hdr->name.s=t;
197
-								break;
198
-							case FROM3:
199
-								state=F_FROM;
200
-								break;
201
-							case UNKNOWN_HEADER: break;
202
-							default:
203
-								state=UNKNOWN_HEADER;
204
-						}
205
-						break;
206
-			case 'T':
207
-			case 't':
208
-						switch(state){
209
-							case INITIAL:
210
-								state=TO1;
211
-								hdr->name.s=t;
212
-								break;
213
-							case CONTACT3:
214
-								state=CONTACT4;
215
-								break;
216
-							case CONTACT6:
217
-								state=F_CONTACT;
218
-								break;
219
-							case ROUTE3:
220
-								state=ROUTE4;
221
-								break;
222
-						        case RECROUTE9:
223
-								state=RECROUTE10;
224
-								break;
225
-							case UNKNOWN_HEADER: break;
226
-							default:
227
-								state=UNKNOWN_HEADER;
228
-						}
229
-						break;
230
-			case 'C':
231
-			case 'c':
232
-						switch(state){
233
-							case INITIAL:
234
-								state=C_START;
235
-								hdr->name.s=t;
236
-								break;
237
-							case CONTACT5:
238
-								state=CONTACT6;
239
-								break;
240
-						        case RECROUTE1:
241
-								state=RECROUTE2;
242
-								break;
243
-							case UNKNOWN_HEADER: break;
244
-							default:
245
-								state=UNKNOWN_HEADER;
246
-						}
247
-						break;
248
-			case 'S':
249
-			case 's':
250
-						switch(state){
251
-							case INITIAL:
252
-								state=UNKNOWN_HEADER;
253
-								hdr->name.s=t;
254
-								break;
255
-							case C_START:
256
-								state=CSEQ2;
257
-								break;
258
-							case MAXFORWARDS11:
259
-								state=F_MAXFORWARDS;
260
-								break;
261
-							case UNKNOWN_HEADER: break;
262
-							default:
263
-								state=UNKNOWN_HEADER;
264
-						}
265
-						break;
266
-			case 'E':
267
-			case 'e':
268
-						switch(state){
269
-							case INITIAL:
270
-								state=UNKNOWN_HEADER;
271
-								hdr->name.s=t;
272
-								break;
273
-							case CSEQ2:
274
-								state=CSEQ3;
275
-								break;
276
-							case ROUTE4:
277
-								state=F_ROUTE;
278
-								break;
279
-						        case ROUTE1:
280
-								state=RECROUTE1;
281
-								break;
282
-						        case RECROUTE10:
283
-								state=F_RECROUTE;
284
-								break;
285
-							case UNKNOWN_HEADER: break;
286
-							default:
287
-								state=UNKNOWN_HEADER;
288
-						}
289
-						break;
290
-			case 'Q':
291
-			case 'q':
292
-						switch(state){
293
-							case INITIAL:
294
-								state=UNKNOWN_HEADER;
295
-								hdr->name.s=t;
296
-								break;
297
-							case CSEQ3:
298
-								state=F_CSEQ;
299
-								break;
300
-							case UNKNOWN_HEADER: break;
301
-							default:
302
-								state=UNKNOWN_HEADER;
303
-						}
304
-						break;
305
-			case 'L':
306
-			case 'l':
307
-						switch(state){
308
-							case INITIAL:
309
-								state=UNKNOWN_HEADER;
310
-								hdr->name.s=t;
311
-								break;
312
-							case CALLID2:
313
-								state=CALLID3;
314
-								break;
315
-							case CALLID3:
316
-								state=CALLID4;
317
-								break;
318
-							case UNKNOWN_HEADER: break;
319
-							default:
320
-								state=UNKNOWN_HEADER;
321
-						}
322
-						break;
323
-			case 'D':
324
-			case 'd':
325
-						switch(state){
326
-							case INITIAL:
327
-								state=UNKNOWN_HEADER;
328
-								hdr->name.s=t;
329
-								break;
330
-							case CALLID6:
331
-								state=F_CALLID;
332
-								break;
333
-							case MAXFORWARDS10:
334
-								state=MAXFORWARDS11;
335
-								break;
336
-						        case RECROUTE4:
337
-								state=RECROUTE5;
338
-								break;
339
-							case UNKNOWN_HEADER: break;
340
-							default:
341
-								state=UNKNOWN_HEADER;
342
-						}
343
-						break;
344
-			case 'N':
345
-			case 'n':
346
-						switch(state){
347
-							case INITIAL:
348
-								state=UNKNOWN_HEADER;
349
-								hdr->name.s=t;
350
-								break;
351
-							case CONTACT2:
352
-								state=CONTACT3;
353
-								break;
354
-							case UNKNOWN_HEADER: break;
355
-							default:
356
-								state=UNKNOWN_HEADER;
357
-						}
358
-						break;
359
-			case 'X':
360
-			case 'x':
361
-						switch(state){
362
-							case INITIAL:
363
-								state=UNKNOWN_HEADER;
364
-								hdr->name.s=t;
365
-								break;
366
-							case MAXFORWARDS2:
367
-								state=MAXFORWARDS3;
368
-								break;
369
-							case UNKNOWN_HEADER: break;
370
-							default:
371
-								state=UNKNOWN_HEADER;
372
-						}
373
-						break;
374
-			case '-':
375
-						switch(state){
376
-							case INITIAL:
377
-								state=UNKNOWN_HEADER;
378
-								hdr->name.s=t;
379
-								break;
380
-							case CALLID4:
381
-								state=CALLID5;
382
-								break;
383
-							case MAXFORWARDS3:
384
-								state=MAXFORWARDS4;
385
-								break;
386
-						        case RECROUTE5:
387
-								state=RECROUTE6;
388
-								break;
389
-							case UNKNOWN_HEADER: break;
390
-							default:
391
-								state=UNKNOWN_HEADER;
392
-						}
393
-						break;
394
-			case 'W':
395
-			case 'w':
396
-						switch(state){
397
-							case INITIAL:
398
-								state=UNKNOWN_HEADER;
399
-								hdr->name.s=t;
400
-								break;
401
-							case MAXFORWARDS7:
402
-								state=MAXFORWARDS8;
403
-								break;
404
-							case UNKNOWN_HEADER: break;
405
-							default:
406
-								state=UNKNOWN_HEADER;
407
-						}
408
-						break;
409
-			case 'U':
410
-			case 'u':
411
-						switch(state){
412
-							case INITIAL:
413
-								state=UNKNOWN_HEADER;
414
-								hdr->name.s=t;
415
-								break;
416
-							case ROUTE2:
417
-								state=ROUTE3;
418
-								break;
419
-						        case RECROUTE8:
420
-								state=RECROUTE9;
421
-								break;
422
-							case UNKNOWN_HEADER: break;
423
-							default:
424
-								state=UNKNOWN_HEADER;
425
-						}
426
-						break;
427
-			case ' ':
428
-						switch(state){
429
-							case INITIAL:
430
-								break; /*eat space */
431
-							case F_VIA:
432
-							case F_FROM:
433
-							case F_TO:
434
-							case F_CSEQ:
435
-							case F_CALLID:
436
-							case F_CONTACT:
437
-							case F_MAXFORWARDS:
438
-						        case F_ROUTE:
439
-						        case F_RECROUTE:
440
-								break; /* eat trailing space*/
441
-							case VIA1:
442
-								/*compact form: v: */
443
-								state=F_VIA;
444
-								break;
445
-							case FROM1:
446
-								/*compact form f:*/
447
-								state=F_FROM;
448
-								break;
449
-							case TO1:
450
-								/*compact form t:*/
451
-								state=F_TO;
452
-								break;
453
-							case I_START:
454
-								/*compact form i: (Call-ID)*/
455
-								state=F_CALLID;
456
-								break;
457
-							case M_START:
458
-								/*compact form m: (Contact)*/
459
-								state=F_CONTACT;
460
-								break;
461
-							case UNKNOWN_HEADER: break;
462
-							default:
463
-								state=UNKNOWN_HEADER;
464
-						}
465
-						break;
466
-			case ':':
467
-						switch(state){
468
-							case F_VIA:
469
-							case VIA1: /* compact form*/
470
-								*t=0;
471
-								hdr->name.len=t-hdr->name.s;
472
-								hdr->type=HDR_VIA;
473
-								goto skip;
474
-							case F_FROM:
475
-							case FROM1: /*compact form*/
476
-								*t=0;
477
-								hdr->name.len=t-hdr->name.s;
478
-								hdr->type=HDR_FROM;
479
-								goto skip;
480
-							case F_TO:
481
-							case TO1: /*compact form*/
482
-								*t=0;
483
-								hdr->name.len=t-hdr->name.s;
484
-								hdr->type=HDR_TO;
485
-								goto skip;
486
-							case F_CSEQ:
487
-								*t=0;
488
-								hdr->name.len=t-hdr->name.s;
489
-								hdr->type=HDR_CSEQ;
490
-								goto skip;
491
-							case F_CALLID:
492
-							case I_START: /*compact form*/
493
-								*t=0;
494
-								hdr->name.len=t-hdr->name.s;
495
-								hdr->type=HDR_CALLID;
496
-								goto skip;
497
-							case F_CONTACT:
498
-							case M_START: /*compact form*/
499
-								*t=0;
500
-								hdr->name.len=t-hdr->name.s;
501
-								hdr->type=HDR_CONTACT;
502
-								goto skip;
503
-							case F_MAXFORWARDS:
504
-								*t=0;
505
-								hdr->name.len=t-hdr->name.s;
506
-								hdr->type=HDR_MAXFORWARDS;
507
-								goto skip;
508
-							case F_ROUTE:
509
-								*t=0;
510
-								hdr->name.len=t-hdr->name.s;
511
-								hdr->type=HDR_ROUTE;
512
-								goto skip;
513
-						        case F_RECROUTE:
514
-								*t=0;
515
-								hdr->name.len=t-hdr->name.s;
516
-								hdr->type=HDR_RECORDROUTE;
517
-								goto skip;
518
-							case UNKNOWN_HEADER:
519
-								*t=0;
520
-								hdr->name.len=t-hdr->name.s;
521
-								hdr->type=HDR_OTHER;
522
-								goto skip;
523
-							default:
524
-								/* unknown header, e.g: "c:"*/
525
-								*t=0;
526
-								DBG("unknown header found, prev. state=%d\n",
527
-										state);
528
-								state=UNKNOWN_HEADER;
529
-								hdr->name.len=t-hdr->name.s;
530
-								hdr->type=HDR_OTHER;
531
-								goto skip;
532
-						}
533
-						break;
534
-						
535
-			case '\n':
536
-			case '\r': /*not allowed in hname*/
537
-						goto error;
538
-			
539
-			default:
540
-					switch(state){
541
-						case INITIAL:
542
-							hdr->name.s=t;
543
-							state=UNKNOWN_HEADER;
544
-							break;
545
-						case UNKNOWN_HEADER:
546
-							break;
547
-						default:
548
-							state=UNKNOWN_HEADER;
549
-					}
550
-		}
551
-	}
552
-/* if we are here => we didn't find ':' => error*/
553
-	
554
-error:
555
-	hdr->type=HDR_ERROR;
556
-	return t;
557
-
558
-skip:
559
-	DBG("end of header name found, state=%d\n", state);
560
-	t++;
561
-	return t;
562
-
563
-}
564
-
Browse code

- fixed almost all warnings in ser core (gcc-3.0 -Wall, icc, sun cc). (=> fixed a lot of format string bugs) - replaced some of the remaining mallocs w/ pkg_malloc

Andrei Pelinescu-Onciul authored on 02/03/2002 02:20:00
Showing 1 changed files
... ...
@@ -50,7 +50,6 @@ char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
50 50
 
51 51
 	char* t;
52 52
 	register int state;
53
-	int i;
54 53
 	int err;
55 54
 	err=0;
56 55
 
Browse code

added WAIT protection, NEW_HNAME, memory command-line option, first version of SRL

Jiri Kuthan authored on 26/02/2002 00:04:05
Showing 1 changed files
... ...
@@ -45,7 +45,7 @@ enum { INITIAL=0,
45 45
 
46 46
 
47 47
 /* returns end or pointer to next elem*/
48
-char* parse_hname(char* p, char* end, struct hdr_field* hdr)
48
+char* parse_hname1(char* p, char* end, struct hdr_field* hdr)
49 49
 {
50 50
 
51 51
 	char* t;
Browse code

Extended parser automaton, Record-Route is now parsed.

Jan Janak authored on 28/01/2002 18:45:42
Showing 1 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- * $Id�
2
+ * $Id$
3 3
  *
4 4
  * header name parsing automaton:
5 5
 
... ...
@@ -12,6 +12,7 @@
12 12
  * Contact:           m:
13 13
  * Max-Forwards:      n/a
14 14
  * Route:             n/a
15
+ * Record-Route:      n/a
15 16
  */
16 17
 
17 18
 
... ...
@@ -29,9 +30,12 @@ enum { INITIAL=0,
29 30
 		MAXFORWARDS6, MAXFORWARDS7, MAXFORWARDS8, MAXFORWARDS9, MAXFORWARDS10,
30 31
 		MAXFORWARDS11,
31 32
 		ROUTE1, ROUTE2, ROUTE3, ROUTE4,
33
+                RECROUTE1, RECROUTE2, RECROUTE3, RECROUTE4, RECROUTE5, 
34
+                RECROUTE6, RECROUTE7, RECROUTE8, RECROUTE9, RECROUTE10,
35
+       
32 36
 		/* final states*/
33 37
 		F_VIA=1000, F_FROM, F_TO, F_CSEQ, F_CALLID, F_CONTACT, F_MAXFORWARDS,
34
-		F_ROUTE,
38
+                F_ROUTE, F_RECROUTE,
35 39
 		I_START,
36 40
 
37 41
 		UNKNOWN_HEADER=200,
... ...
@@ -142,6 +146,11 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
142 146
 						case MAXFORWARDS9:
143 147
 							state=MAXFORWARDS10;
144 148
 							break;
149
+					        case RECROUTE3:
150
+							state=RECROUTE4;
151
+							break;
152
+					        case RECROUTE6:
153
+							state=RECROUTE7;
145 154
 						case UNKNOWN_HEADER: break;
146 155
 						default:
147 156
 							state=UNKNOWN_HEADER;
... ...
@@ -169,6 +178,12 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
169 178
 						case MAXFORWARDS5:
170 179
 							state=MAXFORWARDS6;
171 180
 							break;
181
+					        case RECROUTE2:
182
+							state=RECROUTE3;
183
+							break;
184
+					        case RECROUTE7:
185
+							state=RECROUTE8;
186
+							break;
172 187
 						case UNKNOWN_HEADER: break;
173 188
 						default:
174 189
 							state=UNKNOWN_HEADER;
... ...
@@ -205,6 +220,9 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
205 220
 							case ROUTE3:
206 221
 								state=ROUTE4;
207 222
 								break;
223
+						        case RECROUTE9:
224
+								state=RECROUTE10;
225
+								break;
208 226
 							case UNKNOWN_HEADER: break;
209 227
 							default:
210 228
 								state=UNKNOWN_HEADER;
... ...
@@ -220,6 +238,9 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
220 238
 							case CONTACT5:
221 239
 								state=CONTACT6;
222 240
 								break;
241
+						        case RECROUTE1:
242
+								state=RECROUTE2;
243
+								break;
223 244
 							case UNKNOWN_HEADER: break;
224 245
 							default:
225 246
 								state=UNKNOWN_HEADER;
... ...
@@ -256,6 +277,12 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
256 277
 							case ROUTE4:
257 278
 								state=F_ROUTE;
258 279
 								break;
280
+						        case ROUTE1:
281
+								state=RECROUTE1;
282
+								break;
283
+						        case RECROUTE10:
284
+								state=F_RECROUTE;
285
+								break;
259 286
 							case UNKNOWN_HEADER: break;
260 287
 							default:
261 288
 								state=UNKNOWN_HEADER;
... ...
@@ -307,6 +334,9 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
307 334
 							case MAXFORWARDS10:
308 335
 								state=MAXFORWARDS11;
309 336
 								break;
337
+						        case RECROUTE4:
338
+								state=RECROUTE5;
339
+								break;
310 340
 							case UNKNOWN_HEADER: break;
311 341
 							default:
312 342
 								state=UNKNOWN_HEADER;
... ...
@@ -354,6 +384,9 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
354 384
 							case MAXFORWARDS3:
355 385
 								state=MAXFORWARDS4;
356 386
 								break;
387
+						        case RECROUTE5:
388
+								state=RECROUTE6;
389
+								break;
357 390
 							case UNKNOWN_HEADER: break;
358 391
 							default:
359 392
 								state=UNKNOWN_HEADER;
... ...
@@ -384,6 +417,9 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
384 417
 							case ROUTE2:
385 418
 								state=ROUTE3;
386 419
 								break;
420
+						        case RECROUTE8:
421
+								state=RECROUTE9;
422
+								break;
387 423
 							case UNKNOWN_HEADER: break;
388 424
 							default:
389 425
 								state=UNKNOWN_HEADER;
... ...
@@ -400,7 +436,8 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
400 436
 							case F_CALLID:
401 437
 							case F_CONTACT:
402 438
 							case F_MAXFORWARDS:
403
-							case F_ROUTE:
439
+						        case F_ROUTE:
440
+						        case F_RECROUTE:
404 441
 								break; /* eat trailing space*/
405 442
 							case VIA1:
406 443
 								/*compact form: v: */
... ...
@@ -474,6 +511,11 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
474 511
 								hdr->name.len=t-hdr->name.s;
475 512
 								hdr->type=HDR_ROUTE;
476 513
 								goto skip;
514
+						        case F_RECROUTE:
515
+								*t=0;
516
+								hdr->name.len=t-hdr->name.s;
517
+								hdr->type=HDR_RECORDROUTE;
518
+								goto skip;
477 519
 							case UNKNOWN_HEADER:
478 520
 								*t=0;
479 521
 								hdr->name.len=t-hdr->name.s;
Browse code

- fixed a header parsing bug found by Bogdan ( thing like "c:" generated a header error instead of being ignored)

Andrei Pelinescu-Onciul authored on 18/01/2002 16:04:10
Showing 1 changed files
... ...
@@ -480,12 +480,14 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
480 480
 								hdr->type=HDR_OTHER;
481 481
 								goto skip;
482 482
 							default:
483
-								/*printf("found unkown header, state=%d\n", 
484
-											state);*/
485
-								LOG(L_ERR, "ERROR : bug?: parse_hname:"
486
-										" on char <%c> state %d\n",
487
-										*t, state);
488
-								goto error;
483
+								/* unknown header, e.g: "c:"*/
484
+								*t=0;
485
+								DBG("unknown header found, prev. state=%d\n",
486
+										state);
487
+								state=UNKNOWN_HEADER;
488
+								hdr->name.len=t-hdr->name.s;
489
+								hdr->type=HDR_OTHER;
490
+								goto skip;
489 491
 						}
490 492
 						break;
491 493
 						
Browse code

- removed -fPIC -DPIC from the Makefile (see comments) - fixed a memory leak in do_action/forward uri - fixed parse_cseq (still buggy, but a little bit better :)) - added error if header name does not end on 1 line (parse_hname) - fixed mem. leak in parse_via (if bad param)

Andrei Pelinescu-Onciul authored on 06/12/2001 20:43:05
Showing 1 changed files
... ...
@@ -488,6 +488,11 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
488 488
 								goto error;
489 489
 						}
490 490
 						break;
491
+						
492
+			case '\n':
493
+			case '\r': /*not allowed in hname*/
494
+						goto error;
495
+			
491 496
 			default:
492 497
 					switch(state){
493 498
 						case INITIAL:
Browse code

- fixed bug in parse_hname (some HEADER_UNKNOWN/OTHER not properly parsed)

Andrei Pelinescu-Onciul authored on 04/12/2001 06:47:58
Showing 1 changed files
... ...
@@ -87,6 +87,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
87 87
 			case 'A':
88 88
 			case 'a':
89 89
 					switch(state){
90
+						case INITIAL:
91
+								state=UNKNOWN_HEADER;
92
+								hdr->name.s=t;
93
+								break;
90 94
 						case VIA2:
91 95
 								state=F_VIA;
92 96
 								break;
... ...
@@ -146,6 +150,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
146 150
 			case 'O':
147 151
 			case 'o':
148 152
 					switch(state){
153
+						case INITIAL:
154
+								state=UNKNOWN_HEADER;
155
+								hdr->name.s=t;
156
+								break;
149 157
 						case FROM2:
150 158
 							state=FROM3;
151 159
 							break;
... ...
@@ -220,6 +228,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
220 228
 			case 'S':
221 229
 			case 's':
222 230
 						switch(state){
231
+							case INITIAL:
232
+								state=UNKNOWN_HEADER;
233
+								hdr->name.s=t;
234
+								break;
223 235
 							case C_START:
224 236
 								state=CSEQ2;
225 237
 								break;
... ...
@@ -234,6 +246,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
234 246
 			case 'E':
235 247
 			case 'e':
236 248
 						switch(state){
249
+							case INITIAL:
250
+								state=UNKNOWN_HEADER;
251
+								hdr->name.s=t;
252
+								break;
237 253
 							case CSEQ2:
238 254
 								state=CSEQ3;
239 255
 								break;
... ...
@@ -248,6 +264,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
248 264
 			case 'Q':
249 265
 			case 'q':
250 266
 						switch(state){
267
+							case INITIAL:
268
+								state=UNKNOWN_HEADER;
269
+								hdr->name.s=t;
270
+								break;
251 271
 							case CSEQ3:
252 272
 								state=F_CSEQ;
253 273
 								break;
... ...
@@ -259,6 +279,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
259 279
 			case 'L':
260 280
 			case 'l':
261 281
 						switch(state){
282
+							case INITIAL:
283
+								state=UNKNOWN_HEADER;
284
+								hdr->name.s=t;
285
+								break;
262 286
 							case CALLID2:
263 287
 								state=CALLID3;
264 288
 								break;
... ...
@@ -273,6 +297,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
273 297
 			case 'D':
274 298
 			case 'd':
275 299
 						switch(state){
300
+							case INITIAL:
301
+								state=UNKNOWN_HEADER;
302
+								hdr->name.s=t;
303
+								break;
276 304
 							case CALLID6:
277 305
 								state=F_CALLID;
278 306
 								break;
... ...
@@ -287,6 +315,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
287 315
 			case 'N':
288 316
 			case 'n':
289 317
 						switch(state){
318
+							case INITIAL:
319
+								state=UNKNOWN_HEADER;
320
+								hdr->name.s=t;
321
+								break;
290 322
 							case CONTACT2:
291 323
 								state=CONTACT3;
292 324
 								break;
... ...
@@ -298,6 +330,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
298 330
 			case 'X':
299 331
 			case 'x':
300 332
 						switch(state){
333
+							case INITIAL:
334
+								state=UNKNOWN_HEADER;
335
+								hdr->name.s=t;
336
+								break;
301 337
 							case MAXFORWARDS2:
302 338
 								state=MAXFORWARDS3;
303 339
 								break;
... ...
@@ -308,6 +344,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
308 344
 						break;
309 345
 			case '-':
310 346
 						switch(state){
347
+							case INITIAL:
348
+								state=UNKNOWN_HEADER;
349
+								hdr->name.s=t;
350
+								break;
311 351
 							case CALLID4:
312 352
 								state=CALLID5;
313 353
 								break;
... ...
@@ -322,6 +362,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
322 362
 			case 'W':
323 363
 			case 'w':
324 364
 						switch(state){
365
+							case INITIAL:
366
+								state=UNKNOWN_HEADER;
367
+								hdr->name.s=t;
368
+								break;
325 369
 							case MAXFORWARDS7:
326 370
 								state=MAXFORWARDS8;
327 371
 								break;
... ...
@@ -333,6 +377,10 @@ char* parse_hname(char* p, char* end, struct hdr_field* hdr)
333 377
 			case 'U':
334 378
 			case 'u':
335 379
 						switch(state){
380
+							case INITIAL:
381
+								state=UNKNOWN_HEADER;
382
+								hdr->name.s=t;
383
+								break;
336 384
 							case ROUTE2:
337 385
 								state=ROUTE3;
338 386
 								break;
Browse code

*** empty log message ***

Andrei Pelinescu-Onciul authored on 23/11/2001 09:15:13
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,468 @@
1
+/*
2
+ * $Id�
3
+ *
4
+ * header name parsing automaton:
5
+
6
+ * parsing:           compact form:
7
+ * Via:               v:
8
+ * From:              f:
9
+ * To:                t:
10
+ * Cseq:              n/a
11
+ * Call-ID:           i:
12
+ * Contact:           m:
13
+ * Max-Forwards:      n/a
14
+ * Route:             n/a
15
+ */
16
+
17
+
18
+#include "msg_parser.h"
19
+#include "dprint.h"
20
+
21
+enum { INITIAL=0,
22
+		VIA1, VIA2,
23
+		FROM1, FROM2, FROM3,
24
+		TO1,