case_refe.h

Go to the documentation of this file.
00001 /*
00002  * Refer-To, Referred-By Header Field Name Parsing Macros
00003  *
00004  * Copyright (C) 2005 Juha Heinanen
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00035 #ifndef CASE_REFE_H
00036 #define CASE_REFE_H
00037 
00038 #define REFERRED_BY_CASE                 \
00039         switch(LOWER_DWORD(val)) {       \
00040         case __by1_:                     \
00041                 hdr->type = HDR_REFERREDBY_T; \
00042                 hdr->name.len = 11;      \
00043                 return (p + 4);          \
00044         case __by2_:                      \
00045                 hdr->type = HDR_REFERREDBY_T; \
00046                 p += 4;                  \
00047                 goto dc_end;             \
00048         }
00049 
00050 #define r_to_CASE                        \
00051         switch(LOWER_DWORD(val)) {       \
00052         case _r_to_:  \
00053                 hdr->type = HDR_REFER_TO_T;  \
00054                 p += 4;                  \
00055                 goto dc_end;             \
00056         \
00057         case _rred_:                     \
00058                 p += 4;                  \
00059                 val = READ(p);           \
00060                 REFERRED_BY_CASE;        \
00061                 goto other;              \
00062         }
00063 
00064 #define refe_CASE      \
00065      p += 4;           \
00066      val = READ(p);    \
00067      r_to_CASE;        \
00068      goto other;
00069 
00070 
00071 #endif /* CASE_REFE_H */