Browse code

- support for REGISTER,SUBSCRIBE, and NOTIFY - removed code not being used (cvs history should be enough)

Jan Janak authored on 20/01/2006 11:19:43
Showing 3 changed files
... ...
@@ -67,7 +67,8 @@
67 67
 
68 68
 /* number methods as power of two to allow bitmap matching */
69 69
 enum request_method { METHOD_UNDEF=0, METHOD_INVITE=1, METHOD_CANCEL=2, METHOD_ACK=4, 
70
-	METHOD_BYE=8, METHOD_INFO=16, METHOD_OTHER=32 };
70
+	METHOD_BYE=8, METHOD_INFO=16, METHOD_REGISTER=32, METHOD_SUBSCRIBE=64,
71
+        METHOD_NOTIFY=128, METHOD_OTHER=256 };
71 72
 
72 73
 #define FL_FORCE_RPORT 1   /* force rport */
73 74
 #define FL_FORCE_ACTIVE 2  /* force active SDP */
... ...
@@ -48,1100 +48,6 @@
48 48
 	(version = "SIP/2.0")
49 49
 */
50 50
 
51
-/*known methods: INVITE, ACK, CANCEL, BYE*/
52
-
53
-enum { START,
54
-       INVITE1, INVITE2, INVITE3, INVITE4, INVITE5,
55
-       ACK1, ACK2,
56
-       CANCEL1, CANCEL2, CANCEL3, CANCEL4, CANCEL5,
57
-       BYE1, BYE2,
58
-       SIP1, SIP2, SIP3, SIP4, SIP5, SIP6,
59
-       FIN_INVITE = 100, FIN_ACK, FIN_CANCEL, FIN_BYE, FIN_SIP,
60
-       P_METHOD = 200, L_URI, P_URI, L_VER, 
61
-       VER1, VER2, VER3, VER4, VER5, VER6, FIN_VER,
62
-       L_STATUS, P_STATUS, L_REASON, P_REASON,
63
-       L_LF, F_CR, F_LF
64
-};
65
-
66
-
67
-#ifdef _CURRENTLY_UNUSED
68
-char* parse_fline(char* buffer, char* end, struct msg_start* fl)
69
-{
70
-	char* tmp;
71
-	register int state;
72
-	unsigned short stat;
73
-
74
-	stat=0;
75
-	fl->type=SIP_REQUEST;
76
-	state=START;
77
-	for(tmp=buffer;tmp<end;tmp++){
78
-		switch(*tmp){
79
-			case ' ':
80
-			case '\t':
81
-				switch(state){
82
-					case START: /*allow space at the begining, although not
83
-								  legal*/
84
-						break;
85
-					case L_URI:
86
-					case L_VER:
87
-					case L_STATUS:
88
-					case L_REASON:
89
-					case L_LF:
90
-						 /*eat  space*/
91
-						break;
92
-					case FIN_INVITE:
93
-						*tmp=0;
94
-						fl->u.request.method.len=tmp-fl->u.request.method.s;
95
-						fl->u.request.method_value=METHOD_INVITE;
96
-						state=L_URI;
97
-						break;
98
-					case FIN_ACK:
99
-						*tmp=0;
100
-						fl->u.request.method.len=tmp-fl->u.request.method.s;
101
-						fl->u.request.method_value=METHOD_ACK;
102
-						state=L_URI;
103
-						break;
104
-					case FIN_CANCEL:
105
-						*tmp=0;
106
-						fl->u.request.method.len=tmp-fl->u.request.method.s;
107
-						fl->u.request.method_value=METHOD_CANCEL;
108
-						state=L_URI;
109
-						break;
110
-					case FIN_BYE:
111
-						*tmp=0;
112
-						fl->u.request.method.len=tmp-fl->u.request.method.s;
113
-						fl->u.request.method_value=METHOD_BYE;
114
-						state=L_URI;
115
-						break;
116
-					case FIN_SIP:
117
-						*tmp=0;
118
-						fl->u.reply.version.len=tmp-fl->u.reply.version.s;
119
-						state=L_STATUS;
120
-						fl->type=SIP_REPLY;
121
-						break;
122
-					case P_URI:
123
-						*tmp=0;
124
-						fl->u.request.uri.len=tmp-fl->u.request.uri.s;
125
-						state=L_VER;
126
-						break;
127
-					case FIN_VER:
128
-						*tmp=0;
129
-						fl->u.request.version.len=tmp-fl->u.request.version.s;
130
-						state=L_LF;
131
-						break;
132
-					case P_STATUS:
133
-						*tmp=0;
134
-						fl->u.reply.status.len=tmp-fl->u.reply.status.s;
135
-						state=L_REASON;
136
-						break;
137
-					case P_REASON:
138
-					 /*	*tmp=0;
139
-						fl->u.reply.reason.len=tmp-fl->u.reply.reason.s;
140
-						*/
141
-						break;
142
-					case VER1:
143
-					case VER2:
144
-					case VER3:
145
-					case VER4:
146
-					case VER5:
147
-					case VER6:
148
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
149
-								" in request\n");
150
-						goto error;
151
-					case P_METHOD:
152
-					default:
153
-						*tmp=0;
154
-						fl->u.request.method.len=tmp-fl->u.request.method.s;
155
-						fl->u.request.method_value=METHOD_OTHER;
156
-						state=L_URI;
157
-				}
158
-				break;
159
-			case 's':
160
-			case 'S':
161
-				switch(state){
162
-					case START:
163
-						state=SIP1;
164
-						fl->u.reply.version.s=tmp;
165
-						break;
166
-					case P_URI:
167
-					case P_REASON:
168
-					case P_METHOD:
169
-						break;
170
-					case L_REASON:
171
-						fl->u.reply.reason.s=tmp;
172
-						state=P_REASON;
173
-						break;
174
-					case P_STATUS:
175
-					case L_STATUS:
176
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
177
-								"character <%c> in request status\n", *tmp);
178
-						goto error;
179
-					case L_LF:
180
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
181
-								"character <%c> in request\n", *tmp);
182
-						goto error;
183
-					case L_URI:
184
-						fl->u.request.uri.s=tmp;
185
-						state=P_URI;
186
-						break;
187
-					case L_VER:
188
-						fl->u.request.version.s=tmp;
189
-						state=VER1;
190
-						break;
191
-					case VER1:
192
-					case VER2:
193
-					case VER3:
194
-					case VER4:
195
-					case VER5:
196
-					case VER6:
197
-					case FIN_VER:
198
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
199
-								" in request\n");
200
-						goto error;
201
-					default:
202
-						state=P_METHOD;
203
-				}
204
-				break;
205
-					
206
-			case 'i':
207
-			case 'I':
208
-				switch(state){
209
-					case START:
210
-						state=INVITE1;
211
-						fl->u.request.method.s=tmp;
212
-						break;
213
-					case INVITE3:
214
-						state=INVITE4;
215
-						break;
216
-					case SIP1:
217
-						state=SIP2;
218
-						break;
219
-					case P_URI:
220
-					case P_REASON:
221
-					case P_METHOD:
222
-						break;
223
-					case L_REASON:
224
-						fl->u.reply.reason.s=tmp;
225
-						state=P_REASON;
226
-						break;
227
-					case P_STATUS:
228
-					case L_STATUS:
229
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
230
-								"character <%c> in request status\n", *tmp);
231
-						goto error;
232
-					case L_LF:
233
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
234
-								"character <%c> in request\n", *tmp);
235
-						goto error;
236
-					case L_URI:
237
-						fl->u.request.uri.s=tmp;
238
-						state=P_URI;
239
-						break;
240
-					case VER1:
241
-						state=VER2;
242
-						break;
243
-					case L_VER:
244
-					case VER2:
245
-					case VER3:
246
-					case VER4:
247
-					case VER5:
248
-					case VER6:
249
-					case FIN_VER:
250
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
251
-								" in request\n");
252
-						goto error;
253
-					default:
254
-						state=P_METHOD;
255
-				}
256
-				break;
257
-				
258
-			case 'p':
259
-			case 'P':
260
-				switch(state){
261
-					case START:
262
-						state=P_METHOD;
263
-						fl->u.request.method.s=tmp;
264
-						break;
265
-					case SIP2:
266
-						state=SIP3;
267
-						break;
268
-					case P_URI:
269
-					case P_REASON:
270
-					case P_METHOD:
271
-						break;
272
-					case L_REASON:
273
-						fl->u.reply.reason.s=tmp;
274
-						state=P_REASON;
275
-						break;
276
-					case P_STATUS:
277
-					case L_STATUS:
278
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
279
-								"character <%c> in request status\n", *tmp);
280
-						goto error;
281
-					case L_LF:
282
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
283
-								"character <%c> in request\n", *tmp);
284
-						goto error;
285
-					case L_URI:
286
-						fl->u.request.uri.s=tmp;
287
-						state=P_URI;
288
-						break;
289
-					case VER2:
290
-						state=VER3;
291
-						break;
292
-					case L_VER:
293
-					case VER1:
294
-					case VER3:
295
-					case VER4:
296
-					case VER5:
297
-					case VER6:
298
-					case FIN_VER:
299
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
300
-								" in request\n");
301
-						goto error;
302
-					default:
303
-						state=P_METHOD;
304
-				}
305
-				break;
306
-
307
-			
308
-			case '/':
309
-				switch(state){
310
-					case START:
311
-						state=P_METHOD;
312
-						fl->u.request.method.s=tmp;
313
-						break;
314
-					case SIP3:
315
-						state=SIP4;
316
-						break;
317
-					case P_URI:
318
-					case P_REASON:
319
-					case P_METHOD:
320
-						break;
321
-					case L_REASON:
322
-						fl->u.reply.reason.s=tmp;
323
-						state=P_REASON;
324
-						break;
325
-					case P_STATUS:
326
-					case L_STATUS:
327
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
328
-								"character <%c> in request status\n", *tmp);
329
-						goto error;
330
-					case L_LF:
331
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
332
-								"character <%c> in request\n", *tmp);
333
-						goto error;
334
-					case L_URI:
335
-						fl->u.request.uri.s=tmp;
336
-						state=P_URI;
337
-						break;
338
-					case VER3:
339
-						state=VER4;
340
-						break;
341
-					case L_VER:
342
-					case VER1:
343
-					case VER2:
344
-					case VER4:
345
-					case VER5:
346
-					case VER6:
347
-					case FIN_VER:
348
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
349
-								" in request\n");
350
-						goto error;
351
-					default:
352
-						state=P_METHOD;
353
-				}
354
-				break;
355
-			
356
-			case '2':
357
-				switch(state){
358
-					case START:
359
-						state=P_METHOD;
360
-						fl->u.request.method.s=tmp;
361
-						break;
362
-					case SIP4:
363
-						state=SIP5;
364
-						break;
365
-					case P_URI:
366
-					case P_REASON:
367
-					case P_METHOD:
368
-						break;
369
-					case L_REASON:
370
-						fl->u.reply.reason.s=tmp;
371
-						state=P_REASON;
372
-						break;
373
-					case P_STATUS:
374
-						stat=stat*10+*tmp-'0';
375
-						break;
376
-					case L_STATUS:
377
-						stat=*tmp-'0';
378
-						fl->u.reply.status.s=tmp;
379
-						break;
380
-					case L_LF:
381
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
382
-								"character <%c> in request\n", *tmp);
383
-						goto error;
384
-					case L_URI:
385
-						fl->u.request.uri.s=tmp;
386
-						state=P_URI;
387
-						break;
388
-					case VER4:
389
-						state=VER5;
390
-						break;
391
-					case L_VER:
392
-					case VER1:
393
-					case VER2:
394
-					case VER3:
395
-					case VER5:
396
-					case VER6:
397
-					case FIN_VER:
398
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
399
-								" in request\n");
400
-						goto error;
401
-					default:
402
-						state=P_METHOD;
403
-				}
404
-				break;
405
-			
406
-			case '.':
407
-				switch(state){
408
-					case START:
409
-						state=P_METHOD;
410
-						fl->u.request.method.s=tmp;
411
-						break;
412
-					case SIP5:
413
-						state=SIP6;
414
-						break;
415
-					case P_URI:
416
-					case P_REASON:
417
-					case P_METHOD:
418
-						break;
419
-					case L_REASON:
420
-						fl->u.reply.reason.s=tmp;
421
-						state=P_REASON;
422
-						break;
423
-					case P_STATUS:
424
-					case L_STATUS:
425
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
426
-								"character <%c> in request status\n", *tmp);
427
-						goto error;
428
-					case L_LF:
429
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
430
-								"character <%c> in request\n", *tmp);
431
-						goto error;
432
-					case L_URI:
433
-						fl->u.request.uri.s=tmp;
434
-						state=P_URI;
435
-						break;
436
-					case VER5:
437
-						state=VER6;
438
-						break;
439
-					case L_VER:
440
-					case VER1:
441
-					case VER2:
442
-					case VER3:
443
-					case VER4:
444
-					case VER6:
445
-					case FIN_VER:
446
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
447
-								" in request\n");
448
-						goto error;
449
-					default:
450
-						state=P_METHOD;
451
-				}
452
-				break;
453
-			
454
-			case '0':
455
-				switch(state){
456
-					case START:
457
-						state=P_METHOD;
458
-						fl->u.request.method.s=tmp;
459
-						break;
460
-					case SIP6:
461
-						state=FIN_SIP;
462
-						break;
463
-					case P_URI:
464
-					case P_REASON:
465
-					case P_METHOD:
466
-						break;
467
-					case L_REASON:
468
-						fl->u.reply.reason.s=tmp;
469
-						state=P_REASON;
470
-						break;
471
-					case P_STATUS:
472
-						stat=stat*10;
473
-						break;
474
-					case L_STATUS:
475
-						stat=0;
476
-						fl->u.reply.status.s=tmp;
477
-						break;
478
-					case L_LF:
479
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
480
-								"character <%c> in request\n", *tmp);
481
-						goto error;
482
-					case L_URI:
483
-						fl->u.request.uri.s=tmp;
484
-						state=P_URI;
485
-						break;
486
-					case VER6:
487
-						state=FIN_VER;
488
-						break;
489
-					case L_VER:
490
-					case VER1:
491
-					case VER2:
492
-					case VER3:
493
-					case VER4:
494
-					case VER5:
495
-					case FIN_VER:
496
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
497
-								" in request\n");
498
-						goto error;
499
-					default:
500
-						state=P_METHOD;
501
-				}
502
-				break;
503
-			
504
-			case 'n':
505
-			case 'N':
506
-				switch(state){
507
-					case START:
508
-						state=P_METHOD;
509
-						fl->u.request.method.s=tmp;
510
-						break;
511
-					case INVITE1:
512
-						state=INVITE2;
513
-						break;
514
-					case CANCEL2:
515
-						state=CANCEL3;
516
-						break;
517
-					case P_URI:
518
-					case P_REASON:
519
-					case P_METHOD:
520
-						break;
521
-					case L_REASON:
522
-						fl->u.reply.reason.s=tmp;
523
-						state=P_REASON;
524
-						break;
525
-					case P_STATUS:
526
-					case L_STATUS:
527
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
528
-								"character <%c> in request status\n", *tmp);
529
-						goto error;
530
-					case L_LF:
531
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
532
-								"character <%c> in request\n", *tmp);
533
-						goto error;
534
-					case L_URI:
535
-						fl->u.request.uri.s=tmp;
536
-						state=P_URI;
537
-						break;
538
-					case L_VER:
539
-					case VER1:
540
-					case VER2:
541
-					case VER3:
542
-					case VER4:
543
-					case VER5:
544
-					case VER6:
545
-					case FIN_VER:
546
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
547
-								" in request\n");
548
-						goto error;
549
-					default:
550
-						state=P_METHOD;
551
-				}
552
-				break;
553
-
554
-			case 'v':
555
-			case 'V':
556
-				switch(state){
557
-					case START:
558
-						state=P_METHOD;
559
-						fl->u.request.method.s=tmp;
560
-						break;
561
-					case INVITE2:
562
-						state=INVITE3;
563
-						break;
564
-					case P_URI:
565
-					case P_REASON:
566
-					case P_METHOD:
567
-						break;
568
-					case L_REASON:
569
-						fl->u.reply.reason.s=tmp;
570
-						state=P_REASON;
571
-						break;
572
-					case P_STATUS:
573
-					case L_STATUS:
574
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
575
-								"character <%c> in request status\n", *tmp);
576
-						goto error;
577
-					case L_LF:
578
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
579
-								"character <%c> in request\n", *tmp);
580
-						goto error;
581
-					case L_URI:
582
-						fl->u.request.uri.s=tmp;
583
-						state=P_URI;
584
-						break;
585
-					case L_VER:
586
-					case VER1:
587
-					case VER2:
588
-					case VER3:
589
-					case VER4:
590
-					case VER5:
591
-					case VER6:
592
-					case FIN_VER:
593
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
594
-								" in request\n");
595
-						goto error;
596
-					default:
597
-						state=P_METHOD;
598
-				}
599
-				break;
600
-
601
-			case 't':
602
-			case 'T':
603
-				switch(state){
604
-					case START:
605
-						state=P_METHOD;
606
-						fl->u.request.method.s=tmp;
607
-						break;
608
-					case INVITE4:
609
-						state=INVITE5;
610
-						break;
611
-					case P_URI:
612
-					case P_REASON:
613
-					case P_METHOD:
614
-						break;
615
-					case L_REASON:
616
-						fl->u.reply.reason.s=tmp;
617
-						state=P_REASON;
618
-						break;
619
-					case P_STATUS:
620
-					case L_STATUS:
621
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
622
-								"character <%c> in request status\n", *tmp);
623
-						goto error;
624
-					case L_LF:
625
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
626
-								"character <%c> in request\n", *tmp);
627
-						goto error;
628
-					case L_URI:
629
-						fl->u.request.uri.s=tmp;
630
-						state=P_URI;
631
-						break;
632
-					case L_VER:
633
-					case VER1:
634
-					case VER2:
635
-					case VER3:
636
-					case VER4:
637
-					case VER5:
638
-					case VER6:
639
-					case FIN_VER:
640
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
641
-								" in request\n");
642
-						goto error;
643
-					default:
644
-						state=P_METHOD;
645
-				}
646
-				break;
647
-
648
-			case 'e':
649
-			case 'E':
650
-				switch(state){
651
-					case START:
652
-						state=P_METHOD;
653
-						fl->u.request.method.s=tmp;
654
-						break;
655
-					case INVITE5:
656
-						state=FIN_INVITE;
657
-						break;
658
-					case CANCEL4:
659
-						state=CANCEL5;
660
-						break;
661
-					case BYE2:
662
-						state=FIN_BYE;
663
-						break;
664
-					case P_URI:
665
-					case P_REASON:
666
-					case P_METHOD:
667
-						break;
668
-					case L_REASON:
669
-						fl->u.reply.reason.s=tmp;
670
-						state=P_REASON;
671
-						break;
672
-					case P_STATUS:
673
-					case L_STATUS:
674
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
675
-								"character <%c> in request status\n", *tmp);
676
-						goto error;
677
-					case L_LF:
678
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
679
-								"character <%c> in request\n", *tmp);
680
-						goto error;
681
-					case L_URI:
682
-						fl->u.request.uri.s=tmp;
683
-						state=P_URI;
684
-						break;
685
-					case L_VER:
686
-					case VER1:
687
-					case VER2:
688
-					case VER3:
689
-					case VER4:
690
-					case VER5:
691
-					case VER6:
692
-					case FIN_VER:
693
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
694
-								" in request\n");
695
-						goto error;
696
-					default:
697
-						state=P_METHOD;
698
-				}
699
-				break;
700
-
701
-			case 'a':
702
-			case 'A':
703
-				switch(state){
704
-					case START:
705
-						state=ACK1;
706
-						fl->u.request.method.s=tmp;
707
-						break;
708
-					case CANCEL1:
709
-						state=CANCEL2;
710
-						break;
711
-					case BYE2:
712
-						state=FIN_BYE;
713
-						break;
714
-					case P_URI:
715
-					case P_REASON:
716
-					case P_METHOD:
717
-						break;
718
-					case L_REASON:
719
-						fl->u.reply.reason.s=tmp;
720
-						state=P_REASON;
721
-						break;
722
-					case P_STATUS:
723
-					case L_STATUS:
724
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
725
-								"character <%c> in request status\n", *tmp);
726
-						goto error;
727
-					case L_LF:
728
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
729
-								"character <%c> in request\n", *tmp);
730
-						goto error;
731
-					case L_URI:
732
-						fl->u.request.uri.s=tmp;
733
-						state=P_URI;
734
-						break;
735
-					case L_VER:
736
-					case VER1:
737
-					case VER2:
738
-					case VER3:
739
-					case VER4:
740
-					case VER5:
741
-					case VER6:
742
-					case FIN_VER:
743
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
744
-								" in request\n");
745
-						goto error;
746
-					default:
747
-						state=P_METHOD;
748
-				}
749
-				break;
750
-
751
-			case 'c':
752
-			case 'C':
753
-				switch(state){
754
-					case START:
755
-						state=CANCEL1;
756
-						fl->u.request.method.s=tmp;
757
-						break;
758
-					case CANCEL3:
759
-						state=CANCEL4;
760
-						break;
761
-					case ACK1:
762
-						state=ACK2;
763
-						break;
764
-					case P_URI:
765
-					case P_REASON:
766
-					case P_METHOD:
767
-						break;
768
-					case L_REASON:
769
-						fl->u.reply.reason.s=tmp;
770
-						state=P_REASON;
771
-						break;
772
-					case P_STATUS:
773
-					case L_STATUS:
774
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
775
-								"character <%c> in request status\n", *tmp);
776
-						goto error;
777
-					case L_LF:
778
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
779
-								"character <%c> in request\n", *tmp);
780
-						goto error;
781
-					case L_URI:
782
-						fl->u.request.uri.s=tmp;
783
-						state=P_URI;
784
-						break;
785
-					case L_VER:
786
-					case VER1:
787
-					case VER2:
788
-					case VER3:
789
-					case VER4:
790
-					case VER5:
791
-					case VER6:
792
-					case FIN_VER:
793
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
794
-								" in request\n");
795
-						goto error;
796
-					default:
797
-						state=P_METHOD;
798
-				}
799
-				break;
800
-
801
-			case 'k':
802
-			case 'K':
803
-				switch(state){
804
-					case START:
805
-						state=P_METHOD;
806
-						fl->u.request.method.s=tmp;
807
-						break;
808
-					case ACK2:
809
-						state=FIN_ACK;
810
-						break;
811
-					case P_URI:
812
-					case P_REASON:
813
-					case P_METHOD:
814
-						break;
815
-					case L_REASON:
816
-						fl->u.reply.reason.s=tmp;
817
-						state=P_REASON;
818
-						break;
819
-					case P_STATUS:
820
-					case L_STATUS:
821
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
822
-								"character <%c> in request status\n", *tmp);
823
-						goto error;
824
-					case L_LF:
825
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
826
-								"character <%c> in request\n", *tmp);
827
-						goto error;
828
-					case L_URI:
829
-						fl->u.request.uri.s=tmp;
830
-						state=P_URI;
831
-						break;
832
-					case L_VER:
833
-					case VER1:
834
-					case VER2:
835
-					case VER3:
836
-					case VER4:
837
-					case VER5:
838
-					case VER6:
839
-					case FIN_VER:
840
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
841
-								" in request\n");
842
-						goto error;
843
-					default:
844
-						state=P_METHOD;
845
-				}
846
-				break;
847
-
848
-			case 'l':
849
-			case 'L':
850
-				switch(state){
851
-					case START:
852
-						state=P_METHOD;
853
-						fl->u.request.method.s=tmp;
854
-						break;
855
-					case CANCEL5:
856
-						state=FIN_CANCEL;
857
-						break;
858
-					case P_URI:
859
-					case P_REASON:
860
-					case P_METHOD:
861
-						break;
862
-					case L_REASON:
863
-						fl->u.reply.reason.s=tmp;
864
-						state=P_REASON;
865
-						break;
866
-					case P_STATUS:
867
-					case L_STATUS:
868
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
869
-								"character <%c> in request status\n", *tmp);
870
-						goto error;
871
-					case L_LF:
872
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
873
-								"character <%c> in request\n", *tmp);
874
-						goto error;
875
-					case L_URI:
876
-						fl->u.request.uri.s=tmp;
877
-						state=P_URI;
878
-						break;
879
-					case L_VER:
880
-					case VER1:
881
-					case VER2:
882
-					case VER3:
883
-					case VER4:
884
-					case VER5:
885
-					case VER6:
886
-					case FIN_VER:
887
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
888
-								" in request\n");
889
-						goto error;
890
-					default:
891
-						state=P_METHOD;
892
-				}
893
-				break;
894
-
895
-			case 'b':
896
-			case 'B':
897
-				switch(state){
898
-					case START:
899
-						state=BYE1;
900
-						fl->u.request.method.s=tmp;
901
-						break;
902
-					case P_URI:
903
-					case P_REASON:
904
-					case P_METHOD:
905
-						break;
906
-					case L_REASON:
907
-						fl->u.reply.reason.s=tmp;
908
-						state=P_REASON;
909
-						break;
910
-					case P_STATUS:
911
-					case L_STATUS:
912
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
913
-								"character <%c> in request status\n", *tmp);
914
-						goto error;
915
-					case L_LF:
916
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
917
-								"character <%c> in request\n", *tmp);
918
-						goto error;
919
-					case L_URI:
920
-						fl->u.request.uri.s=tmp;
921
-						state=P_URI;
922
-						break;
923
-					case L_VER:
924
-					case VER1:
925
-					case VER2:
926
-					case VER3:
927
-					case VER4:
928
-					case VER5:
929
-					case VER6:
930
-					case FIN_VER:
931
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
932
-								" in request\n");
933
-						goto error;
934
-					default:
935
-						state=P_METHOD;
936
-				}
937
-				break;
938
-
939
-			case 'y':
940
-			case 'Y':
941
-				switch(state){
942
-					case START:
943
-						state=P_METHOD;
944
-						fl->u.request.method.s=tmp;
945
-						break;
946
-					case BYE1:
947
-						state=BYE2;
948
-						break;
949
-					case P_URI:
950
-					case P_REASON:
951
-					case P_METHOD:
952
-						break;
953
-					case L_REASON:
954
-						fl->u.reply.reason.s=tmp;
955
-						state=P_REASON;
956
-						break;
957
-					case P_STATUS:
958
-					case L_STATUS:
959
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
960
-								"character <%c> in request status\n", *tmp);
961
-						goto error;
962
-					case L_LF:
963
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
964
-								"character <%c> in request\n", *tmp);
965
-						goto error;
966
-					case L_URI:
967
-						fl->u.request.uri.s=tmp;
968
-						state=P_URI;
969
-						break;
970
-					case L_VER:
971
-					case VER1:
972
-					case VER2:
973
-					case VER3:
974
-					case VER4:
975
-					case VER5:
976
-					case VER6:
977
-					case FIN_VER:
978
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
979
-								" in request\n");
980
-						goto error;
981
-					default:
982
-						state=P_METHOD;
983
-				}
984
-				break;
985
-
986
-			case '\r':
987
-				switch(state){
988
-					case P_REASON:
989
-						*tmp=0;
990
-						fl->u.reply.reason.len=tmp-fl->u.reply.reason.s;
991
-						state=F_CR;
992
-						break;
993
-					case L_LF:
994
-						state=F_CR;
995
-						break;
996
-					case FIN_VER:
997
-						*tmp=0;
998
-						fl->u.request.version.len=tmp-fl->u.request.version.s;
999
-						state=F_CR;
1000
-						break;
1001
-					case L_REASON:
1002
-						state=F_CR;
1003
-						break;
1004
-					default:
1005
-						LOG(L_ERR, "ERROR: parse_first_line: invalid" 
1006
-								"message\n");
1007
-						goto error;
1008
-				}
1009
-				break;
1010
-
1011
-			case '\n':
1012
-				switch(state){
1013
-					case P_REASON:
1014
-						*tmp=0;
1015
-						fl->u.reply.reason.len=tmp-fl->u.reply.reason.s;
1016
-						state=F_LF;
1017
-						goto skip;
1018
-					case FIN_VER:
1019
-						*tmp=0;
1020
-						fl->u.request.version.len=tmp-fl->u.request.version.s;
1021
-						state=F_LF;
1022
-						goto skip;
1023
-					case L_REASON:
1024
-					case L_LF:
1025
-					case F_CR:
1026
-						state=F_LF;
1027
-						goto skip;
1028
-					default:
1029
-						LOG(L_ERR, "ERROR: parse_first_line: invalid"
1030
-								" message\n");
1031
-						goto error;
1032
-				}
1033
-				break;
1034
-
1035
-			case '1':
1036
-			case '3':
1037
-			case '4':
1038
-			case '5':
1039
-			case '6':
1040
-			case '7':
1041
-			case '8':
1042
-			case '9':
1043
-				switch(state){
1044
-					case START:
1045
-						state=P_METHOD;
1046
-						fl->u.request.method.s=tmp;
1047
-						break;
1048
-					case P_URI:
1049
-					case P_REASON:
1050
-					case P_METHOD:
1051
-						break;
1052
-					case L_REASON:
1053
-						fl->u.reply.reason.s=tmp;
1054
-						state=P_REASON;
1055
-						break;
1056
-					case P_STATUS:
1057
-						stat=stat*10+*tmp-'0';
1058
-						break;
1059
-					case L_STATUS:
1060
-						stat=*tmp-'0';
1061
-						state=P_STATUS;
1062
-						fl->u.reply.status.s=tmp;
1063
-						break;
1064
-					case L_LF:
1065
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
1066
-								"character <%c> in request\n", *tmp);
1067
-						goto error;
1068
-					case L_URI:
1069
-						fl->u.request.uri.s=tmp;
1070
-						state=P_URI;
1071
-						break;
1072
-					case L_VER:
1073
-					case VER1:
1074
-					case VER2:
1075
-					case VER3:
1076
-					case VER4:
1077
-					case VER5:
1078
-					case VER6:
1079
-					case FIN_VER:
1080
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
1081
-								" in request\n");
1082
-						goto error;
1083
-					default:
1084
-						state=P_METHOD;
1085
-				}
1086
-						
1087
-			default:
1088
-				switch(state){
1089
-					case START:
1090
-						state=P_METHOD;
1091
-						fl->u.request.method.s=tmp;
1092
-						break;
1093
-					case P_URI:
1094
-					case P_REASON:
1095
-					case P_METHOD:
1096
-						break;
1097
-					case L_REASON:
1098
-						fl->u.reply.reason.s=tmp;
1099
-						state=P_REASON;
1100
-						break;
1101
-					case P_STATUS:
1102
-					case L_STATUS:
1103
-						LOG(L_ERR, "ERROR: parse_first_line: non-number "
1104
-								"character <%c> in request status\n", *tmp);
1105
-						goto error;
1106
-					case L_LF:
1107
-						LOG(L_ERR, "ERROR: parse_first_line: invalid "
1108
-								"character <%c> in request\n", *tmp);
1109
-						goto error;
1110
-					case L_URI:
1111
-						fl->u.request.uri.s=tmp;
1112
-						state=P_URI;
1113
-						break;
1114
-					case L_VER:
1115
-					case VER1:
1116
-					case VER2:
1117
-					case VER3:
1118
-					case VER4:
1119
-					case VER5:
1120
-					case VER6:
1121
-					case FIN_VER:
1122
-						LOG(L_ERR, "ERROR: parse_first_line: invalid version "
1123
-								" in request\n");
1124
-						goto error;
1125
-					default:
1126
-						state=P_METHOD;
1127
-				}
1128
-		}
1129
-	}
1130
-skip:
1131
-	fl->len=tmp-buf;
1132
-	if (fl->type==SIP_REPLY){
1133
-		fl->u.reply.statuscode=stat;
1134
-		/* fl->u.reply.statusclass=stat/100; */
1135
-	}
1136
-	return tmp;
1137
-	
1138
-error:
1139
-	LOG(L_ERR, "ERROR: while parsing first line (state=%d)\n", state);
1140
-	fl->type=SIP_INVALID;
1141
-	return tmp;
1142
-}
1143
-
1144
-#endif /* currently unused */
1145 51
 
1146 52
 /* parses the first line, returns pointer to  next line  & fills fl;
1147 53
    also  modifies buffer (to avoid extra copy ops) */
... ...
@@ -1193,6 +99,9 @@ char* parse_first_line(char* buffer, unsigned int len, struct msg_start * fl)
1193 99
 	else IFISMETHOD( ACK, 'A' )
1194 100
 	else IFISMETHOD( BYE, 'B' ) 
1195 101
 	else IFISMETHOD( INFO, 'I' )
102
+	else IFISMETHOD( REGISTER, 'R')
103
+	else IFISMETHOD( SUBSCRIBE, 'S')
104
+	else IFISMETHOD( NOTIFY, 'N')
1196 105
 	/* if you want to add another method XXX, include METHOD_XXX in
1197 106
            H-file (this is the value which you will take later in
1198 107
            processing and define XXX_LEN as length of method name;
... ...
@@ -55,7 +55,9 @@
55 55
 #define ACK_LEN 3
56 56
 #define BYE_LEN 3
57 57
 #define INFO_LEN 4
58
-
58
+#define REGISTER_LEN 8
59
+#define SUBSCRIBE_LEN 9
60
+#define NOTIFY_LEN 6
59 61
 
60 62
 struct msg_start {
61 63
 	int type;                         /* Type of the Message - Request/Response */