1 /* 2 * Contact, Content-Type, Content-Length, Content-Disposition, Content-Encoding 3 * Header Field Name Parsing Macros 4 * 5 * Copyright (C) 2001-2003 FhG Fokus 6 * 7 * This file is part of Kamailio, a free SIP server. 8 * 9 * Kamailio is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version 13 * 14 * Kamailio is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 * 23 */ 24 25 /*! \file 26 * \brief Parser :: Contact, Content-Type, Content-Length, Content-Disposition, Content-Encoding 27 * Header Field Name Parsing Macros 28 * 29 * \ingroup parser 30 */ 31 32 33 34 #ifndef CASE_CONT_H 35 #define CASE_CONT_H 36 37 #include "../comp_defs.h" 38 39 #define TH_CASE \ 40 switch(LOWER_DWORD(val)) { \ 41 case _th12_: \ 42 hdr->type = HDR_CONTENTLENGTH_T; \ 43 hdr->name.len = 14; \ 44 return (p + 4); \ 45 } \ 46 \ 47 if (LOWER_BYTE(*p) == 't') { \ 48 p++; \ 49 if (LOWER_BYTE(*p) == 'h') { \ 50 hdr->type = HDR_CONTENTLENGTH_T;\ 51 p++; \ 52 goto dc_end; \ 53 } \ 54 } 55 56 57 #define ion_CASE \ 58 switch(LOWER_DWORD(val)) { \ 59 case _ion1_: \ 60 hdr->type = HDR_CONTENTDISPOSITION_T; \ 61 hdr->name.len = 19; \ 62 return (p + 4); \ 63 \ 64 case _ion2_: \ 65 hdr->type = HDR_CONTENTDISPOSITION_T; \ 66 p += 4; \ 67 goto dc_end; \ 68 } 69 70 71 #define DISPOSITION_CASE \ 72 switch(LOWER_DWORD(val)) { \ 73 case _osit_: \ 74 p += 4; \ 75 val = READ(p); \ 76 ion_CASE; \ 77 goto other; \ 78 } 79 80 81 #define ENCODING_CASE \ 82 switch(LOWER_DWORD(val)) { \ 83 case _ding_: \ 84 p += 4; \ 85 hdr->type = HDR_CONTENTENCODING_T; \ 86 goto dc_end; \ 87 } 88 89 #define CONTENT_CASE \ 90 switch(LOWER_DWORD(val)) { \ 91 case _leng_: \ 92 p += 4; \ 93 val = READ(p); \ 94 TH_CASE; \ 95 goto other; \ 96 \ 97 case _type_: \ 98 hdr->type = HDR_CONTENTTYPE_T; \ 99 p += 4; \ 100 goto dc_end; \ 101 \ 102 case _disp_: \ 103 p += 4; \ 104 val = READ(p); \ 105 DISPOSITION_CASE; \ 106 goto other; \ 107 case _enco_: \ 108 p += 4; \ 109 val = READ(p); \ 110 ENCODING_CASE; \ 111 goto other; \ 112 } 113 114 115 #define ACT_ENT_CASE \ 116 switch(LOWER_DWORD(val)) { \ 117 case _act1_: \ 118 hdr->type = HDR_CONTACT_T; \ 119 hdr->name.len = 7; \ 120 return (p + 4); \ 121 \ 122 case _act2_: \ 123 hdr->type = HDR_CONTACT_T; \ 124 p += 4; \ 125 goto dc_end; \ 126 \ 127 case _ent__: \ 128 p += 4; \ 129 val = READ(p); \ 130 CONTENT_CASE; \ 131 goto other; \ 132 } 133 134 #define cont_CASE \ 135 p += 4; \ 136 val = READ(p); \ 137 ACT_ENT_CASE; \ 138 goto other; 139 140 141 #endif /* CASE_CONT_H */ 142