case_cont.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Contact, Content-Type, Content-Length, Content-Disposition, Content-Encoding
00005  * Header Field Name Parsing Macros
00006  *
00007  * Copyright (C) 2001-2003 FhG Fokus
00008  *
00009  * This file is part of SIP-router, a free SIP server.
00010  *
00011  * SIP-router is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version
00015  *
00016  * SIP-router is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  *
00025  * History:
00026  * ----------
00027  * 2003-02-28 scratchpad compatibility abandoned (jiri)
00028  * 2003-01-27 next baby-step to removing ZT - PRESERVE_ZT (jiri)
00029  */
00030 
00040 #ifndef CASE_CONT_H
00041 #define CASE_CONT_H
00042 
00043 #include "../comp_defs.h"
00044 
00045 #define TH_CASE                                        \
00046         switch(LOWER_DWORD(val)) {                     \
00047         case _th12_:                                   \
00048                 hdr->type = HDR_CONTENTLENGTH_T;       \
00049                 hdr->name.len = 14;                    \
00050                 return (p + 4);                        \
00051         }                                              \
00052                                                        \
00053         if (LOWER_BYTE(*p) == 't') {                   \
00054                 p++;                                   \
00055                 if (LOWER_BYTE(*p) == 'h') {           \
00056                         hdr->type = HDR_CONTENTLENGTH_T;\
00057                         p++;                           \
00058                         goto dc_end;                   \
00059                 }                                      \
00060         }
00061 
00062 
00063 #define ion_CASE                                    \
00064         switch(LOWER_DWORD(val)) {                  \
00065         case _ion1_:                                \
00066                 hdr->type = HDR_CONTENTDISPOSITION_T; \
00067                 hdr->name.len = 19;                 \
00068                 return (p + 4);                     \
00069                                                     \
00070         case _ion2_:                                \
00071                 hdr->type = HDR_CONTENTDISPOSITION_T; \
00072                 p += 4;                             \
00073                 goto dc_end;                        \
00074         }
00075 
00076 
00077 #define DISPOSITION_CASE           \
00078         switch(LOWER_DWORD(val)) { \
00079         case _osit_:               \
00080                 p += 4;            \
00081                 val = READ(p);     \
00082                 ion_CASE;          \
00083                 goto other;        \
00084         }
00085 
00086 
00087 #define ENCODING_CASE              \
00088         switch(LOWER_DWORD(val)) { \
00089         case _ding_:               \
00090                 p += 4;            \
00091                 hdr->type = HDR_CONTENTENCODING_T; \
00092                 goto dc_end;       \
00093         }
00094 
00095 #define CONTENT_CASE                         \
00096         switch(LOWER_DWORD(val)) {           \
00097         case _leng_:                         \
00098                 p += 4;                      \
00099                 val = READ(p);               \
00100                 TH_CASE;                     \
00101                 goto other;                  \
00102                                              \
00103         case _type_:                         \
00104                 hdr->type = HDR_CONTENTTYPE_T; \
00105                 p += 4;                      \
00106                 goto dc_end;                 \
00107                                              \
00108         case _disp_:                         \
00109                 p += 4;                      \
00110                 val = READ(p);               \
00111                 DISPOSITION_CASE;            \
00112                 goto other;                  \
00113         case _enco_:                         \
00114                 p += 4;                      \
00115                 val = READ(p);               \
00116                 ENCODING_CASE;               \
00117                 goto other;                  \
00118         }
00119 
00120 
00121 #define ACT_ENT_CASE                     \
00122         switch(LOWER_DWORD(val)) {       \
00123         case _act1_:                     \
00124                 hdr->type = HDR_CONTACT_T; \
00125                 hdr->name.len = 7;       \
00126                 return (p + 4);          \
00127                                          \
00128         case _act2_:                     \
00129                 hdr->type = HDR_CONTACT_T; \
00130                 p += 4;                  \
00131                 goto dc_end;             \
00132                                          \
00133         case _ent__:                     \
00134                 p += 4;                  \
00135                 val = READ(p);           \
00136                 CONTENT_CASE;            \
00137                 goto other;              \
00138         }
00139 
00140 #define cont_CASE      \
00141      p += 4;           \
00142      val = READ(p);    \
00143      ACT_ENT_CASE;     \
00144      goto other;
00145 
00146 
00147 #endif /* CASE_CONT_H */