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