OSDN Git Service

Add MS7619SE
[uclinux-h8/uClinux-dist.git] / user / ser / parser / case_cont.h
1 /* 
2  * $Id: case_cont.h,v 1.9 2004/08/24 09:01:24 janakj Exp $ 
3  *
4  * Contact, Content-Type, Content-Length, Content-Disposition
5  * Header Field Name Parsing Macros
6  *
7  * Copyright (C) 2001-2003 FhG Fokus
8  *
9  * This file is part of ser, a free SIP server.
10  *
11  * ser is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version
15  *
16  * For a license to use the ser software under conditions
17  * other than those described here, or to purchase support for this
18  * software, please contact iptel.org by e-mail at the following addresses:
19  *    info@iptel.org
20  *
21  * ser is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License 
27  * along with this program; if not, write to the Free Software 
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29  *
30  * History:
31  * ----------
32  * 2003-02-28 scratchpad compatibility abandoned (jiri)
33  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
34  */
35
36
37 #ifndef CASE_CONT_H
38 #define CASE_CONT_H
39
40 #include "../comp_defs.h"
41
42 #define TH_CASE                                        \
43         switch(LOWER_DWORD(val)) {                     \
44         case _th12_:                                   \
45                 hdr->type = HDR_CONTENTLENGTH;         \
46                 hdr->name.len = 14;                    \
47                 return (p + 4);                        \
48         }                                              \
49                                                        \
50         if (LOWER_BYTE(*p) == 't') {                   \
51                 p++;                                   \
52                 if (LOWER_BYTE(*p) == 'h') {           \
53                         hdr->type = HDR_CONTENTLENGTH; \
54                         p++;                           \
55                         goto dc_end;                   \
56                 }                                      \
57         }
58
59
60 #define ion_CASE                                    \
61         switch(LOWER_DWORD(val)) {                  \
62         case _ion1_:                                \
63                 hdr->type = HDR_CONTENTDISPOSITION; \
64                 hdr->name.len = 19;                 \
65                 return (p + 4);                     \
66                                                     \
67         case _ion2_:                                \
68                 hdr->type = HDR_CONTENTDISPOSITION; \
69                 p += 4;                             \
70                 goto dc_end;                        \
71         }
72
73
74 #define DISPOSITION_CASE           \
75         switch(LOWER_DWORD(val)) { \
76         case _osit_:               \
77                 p += 4;            \
78                 val = READ(p);     \
79                 ion_CASE;          \
80                 goto other;        \
81         }
82
83
84 #define CONTENT_CASE                         \
85         switch(LOWER_DWORD(val)) {           \
86         case _leng_:                         \
87                 p += 4;                      \
88                 val = READ(p);               \
89                 TH_CASE;                     \
90                 goto other;                  \
91                                              \
92         case _type_:                         \
93                 hdr->type = HDR_CONTENTTYPE; \
94                 p += 4;                      \
95                 goto dc_end;                 \
96                                              \
97         case _disp_:                         \
98                 p += 4;                      \
99                 val = READ(p);               \
100                 DISPOSITION_CASE;            \
101                 goto other;                  \
102         }
103
104
105 #define ACT_ENT_CASE                     \
106         switch(LOWER_DWORD(val)) {       \
107         case _act1_:                     \
108                 hdr->type = HDR_CONTACT; \
109                 hdr->name.len = 7;       \
110                 return (p + 4);          \
111                                          \
112         case _act2_:                     \
113                 hdr->type = HDR_CONTACT; \
114                 p += 4;                  \
115                 goto dc_end;             \
116                                          \
117         case _ent__:                     \
118                 p += 4;                  \
119                 val = READ(p);           \
120                 CONTENT_CASE;            \
121                 goto other;              \
122         }                         
123
124 #define cont_CASE      \
125      p += 4;           \
126      val = READ(p);    \
127      ACT_ENT_CASE;     \
128      goto other;
129
130
131 #endif /* CASE_CONT_H */