core: PAI & PPI header names parser fixes
[sip-router] / parser / case_p_pr.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_pr.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_pr_h
34 #define __case_p_pr_h
35
36
37 #define EFER_CASE                                               \
38         switch(LOWER_DWORD(val)) {                      \
39                 case _efer_:                                    \
40                         p += 4;                                         \
41                         val = READ(p);                          \
42                         RED__CASE;                                      \
43         }                                                                       
44
45
46 #define RED__CASE                                               \
47         switch(LOWER_DWORD(val)) {                      \
48                 case _red__:                                    \
49                         p += 4;                                         \
50                         val = READ(p);                          \
51                         IDEN_CASE;                                      \
52         }                                                                       
53
54
55 #define IDEN_CASE                                               \
56         switch(LOWER_DWORD(val)) {                      \
57                 case _iden_:                                    \
58                         p += 4;                                         \
59                         val = READ(p);                          \
60                         TITY_p_pr_CASE;                         \
61         }                                                                       
62
63 #define TITY_p_pr_CASE                                  \
64         switch(LOWER_DWORD(val)) {                      \
65                 case _tity_:                                    \
66                         hdr->type = HDR_PPI_T;          \
67                         p+=4;                                           \
68                         goto dc_end;                            \
69         }                                                                       
70
71
72
73 #define p_pr_CASE               \
74         p += 4;                         \
75         val = READ(p);          \
76         EFER_CASE;                      \
77         goto other;
78
79
80
81 #endif /*__case_p_pr_h*/
82
83 /* vi: set ts=4 sw=4 tw=79:ai:cindent: */