core: PAI & PPI header names parser fixes
[sip-router] / parser / case_p_as.h
1 /* 
2  * $Id$
3  * 
4  * Copyright (C) 2010 iptelorg GmbH
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 /*
19  * parser/case_p_as.h
20  */
21 /*
22  * History:
23  * --------
24  *  2010-02-19  initial version (andrei)
25 */
26
27 /** Parser :: Reason Header Name Parsing Macros.
28  * @file 
29  *
30  * @ingroup parser
31  */
32
33 #ifndef __case_p_as_h
34 #define __case_p_as_h
35
36
37 #define SERT_CASE                                               \
38         switch(LOWER_DWORD(val)) {                      \
39                 case _sert_:                                    \
40                         p += 4;                                         \
41                         val = READ(p);                          \
42                         ED_I_CASE;                                      \
43         }                                                                       
44
45
46 #define ED_I_CASE                                               \
47         switch(LOWER_DWORD(val)) {                      \
48                 case _ed_i_:                                    \
49                         p += 4;                                         \
50                         val = READ(p);                          \
51                         DENT_CASE;                                      \
52         }                                                                       
53
54
55 #define DENT_CASE                                               \
56         switch(LOWER_DWORD(val)) {                      \
57                 case _dent_:                                    \
58                         p += 4;                                         \
59                         val = READ(p);                          \
60                         ITY_CASE;                                       \
61         }                                                                       
62
63 #define ITY_CASE                                                \
64         switch(LOWER_DWORD(val)) {                      \
65                 case _ity1_:                                    \
66                         hdr->type = HDR_PAI_T;          \
67                         hdr->name.len = 19;                     \
68                         return (p + 4);                         \
69                 case _ity2_:                                    \
70                         hdr->type = HDR_PAI_T;          \
71                         p+=4;                                           \
72                         goto dc_end;                            \
73         }                                                                       
74
75
76
77 #define p_as_CASE               \
78         p += 4;                         \
79         val = READ(p);          \
80         SERT_CASE;                      \
81         goto other;
82
83
84
85 #endif /*__case_p_as_h*/
86
87 /* vi: set ts=4 sw=4 tw=79:ai:cindent: */