ae7e7d7ffcb56691ab41d210a6fab19545acac3c
[sip-router] / parser / case_cont.h
1 /*
2  * $Id$
3  *
4  * Contact, Content-Type, Content-Length header field parser macros
5  */
6
7 #ifndef CASE_CONT_H
8 #define CASE_CONT_H
9
10
11 #define TH_CASE                                        \
12         switch(val) {                                  \
13         case _th12_:                                   \
14                 hdr->type = HDR_CONTENTLENGTH;         \
15                 hdr->name.len = 14;                    \
16                 *(p + 3) = '\0';                       \
17                 return (p + 4);                        \
18         }                                              \
19                                                        \
20         if ((*p == 't') || (*p == 'T')) {              \
21                 p++;                                   \
22                 if ((*p == 'h') || (*p == 'H')) {      \
23                         hdr->type = HDR_CONTENTLENGTH; \
24                         p++;                           \
25                         goto dc_end;                   \
26                 }                                      \
27         }
28
29
30 #define LENG_TYPE_CASE                       \
31         switch(val) {                        \
32         case _Leng_:                         \
33                 p += 4;                      \
34                 val = READ(p);               \
35                 TH_CASE;                     \
36                 goto other;                  \
37                                              \
38         case _Type_:                         \
39                 hdr->type = HDR_CONTENTTYPE; \
40                 p += 4;                      \
41                 goto dc_end;                 \
42         }
43
44
45 #define ACT_ENT_CASE                     \
46         switch(val) {                    \
47         case _act1_:                     \
48                 hdr->type = HDR_CONTACT; \
49                 hdr->name.len = 7;       \
50                 *(p + 3) = '\0';         \
51                 return (p + 4);          \
52                                          \
53         case _act2_:                     \
54                 hdr->type = HDR_CONTACT; \
55                 p += 4;                  \
56                 goto dc_end;             \
57                                          \
58         case _ent__:                     \
59                 p += 4;                  \
60                 val = READ(p);           \
61                 LENG_TYPE_CASE;          \
62                                          \
63                 val = unify(val);        \
64                 LENG_TYPE_CASE;          \
65                 goto other;              \
66         }                         
67
68
69 #define Cont_CASE      \
70      p += 4;           \
71      val = READ(p);    \
72      ACT_ENT_CASE;     \
73                        \
74      val = unify(val); \
75      ACT_ENT_CASE;     \
76      goto other;
77
78
79 #endif /* CASE_CONT_H */