parse_supported.h

Go to the documentation of this file.
00001 /*
00002  * $Id: parse_supported.h 4720 2008-08-23 10:56:15Z henningw $
00003  *
00004  * Copyright (C) 2006 Andreas Granig <agranig@linguin.org>
00005  *
00006  * This file is part of Kamailio, a free SIP server.
00007  *
00008  * Kamailio 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  * Kamailio is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  *
00023  * History:
00024  * -------
00025  * 2006-03-02  parse_supported() parses and cumulates all SUPPORTED 
00026  *             headers (bogdan)
00027  */
00028 
00029 /*!
00030  * \file
00031  * \brief Supported parser
00032  * \ingroup parser
00033  */
00034 
00035 #ifndef PARSE_SUPPORTED_H
00036 #define PARSE_SUPPORTED_H
00037 
00038 #include "msg_parser.h"
00039 #include "../mem/mem.h"
00040 
00041 
00042 #define F_SUPPORTED_PATH   (1 << 0)
00043 #define F_SUPPORTED_100REL (1 << 1)
00044 #define F_SUPPORTED_TIMER  (1 << 2)
00045 
00046 #define SUPPORTED_PATH_STR    "path"
00047 #define SUPPORTED_PATH_LEN    (sizeof(SUPPORTED_PATH_STR)-1)
00048 
00049 /* RFC 3262 */
00050 #define SUPPORTED_100REL_STR  "100rel"
00051 #define SUPPORTED_100REL_LEN  (sizeof(SUPPORTED_100REL_STR)-1)
00052 
00053 /* RFC 4028 */
00054 #define SUPPORTED_TIMER_STR      "timer"
00055 #define SUPPORTED_TIMER_LEN      (sizeof(SUPPORTED_TIMER_STR)-1)
00056 
00057 
00058 #define get_supported(p_msg) \
00059    ((p_msg)->supported ? ((struct supported_body*)(p_msg)->supported->parsed)->supported_all : 0)
00060 
00061 
00062 struct supported_body {
00063    unsigned int supported;        /* supported mask for the current hdr */
00064    unsigned int supported_all;    /* suppoted mask for the all "supported" hdr
00065                                    *  - it's set only for the first hdr in 
00066                                    *  sibling list*/
00067 };
00068 
00069 
00070 /*!
00071  * Parse all Supported headers.
00072  */
00073 int parse_supported( struct sip_msg *msg);
00074 
00075 
00076 static inline void free_supported(struct supported_body **sb)
00077 {
00078    if (sb && *sb) {
00079       pkg_free(*sb);
00080       *sb = 0;
00081    }
00082 }
00083 
00084 #endif /* PARSE_SUPPORTED_H */

Generated on Thu May 24 00:00:28 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6