parse_supported.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
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 
00035 #ifndef PARSE_SUPPORTED_H
00036 #define PARSE_SUPPORTED_H
00037 
00038 #include "../../parser/msg_parser.h"
00039 #include "../../parser/hf.h"
00040 #include "../../mem/mem.h"
00041 
00042 
00043 #define F_SUPPORTED_PATH                (1 << 0)
00044 #define F_SUPPORTED_100REL              (1 << 1)
00045 #define F_SUPPORTED_TIMER               (1 << 2)
00046 #define F_SUPPORTED_EVENTLIST   (1 << 3)
00047 #define F_SUPPORTED_GRUU        (1 << 4)
00048 #define F_SUPPORTED_OUTBOUND    (1 << 5)
00049 
00050 #define SUPPORTED_PATH_STR              "path"
00051 #define SUPPORTED_PATH_LEN              (sizeof(SUPPORTED_PATH_STR)-1)
00052 
00053 /* RFC 3262 (PRACK) */
00054 #define SUPPORTED_100REL_STR    "100rel"
00055 #define SUPPORTED_100REL_LEN    (sizeof(SUPPORTED_100REL_STR)-1)
00056 
00057 /* RFC 4028 */
00058 #define SUPPORTED_TIMER_STR             "timer"
00059 #define SUPPORTED_TIMER_LEN             (sizeof(SUPPORTED_TIMER_STR)-1)
00060 
00061 /* RFC 4662 (RLS) */
00062 #define SUPPORTED_EVENTLIST_STR  "eventlist"
00063 #define SUPPORTED_EVENTLIST_LEN  (sizeof(SUPPORTED_EVENTLIST_STR)-1)
00064 
00065 /* RFC 5627 */
00066 #define SUPPORTED_GRUU_STR              "gruu"
00067 #define SUPPORTED_GRUU_LEN              (sizeof(SUPPORTED_GRUU_STR)-1)
00068 
00069 /* RFC 5626 */
00070 #define SUPPORTED_OUTBOUND_STR  "outbound"
00071 #define SUPPORTED_OUTBOUND_LEN  (sizeof(SUPPORTED_OUTBOUND_STR)-1)
00072 
00073 #define get_supported(p_msg) \
00074         ((p_msg)->supported ? ((struct supported_body*)(p_msg)->supported->parsed)->supported_all : 0)
00075 
00076 
00077 struct supported_body {
00078         hf_parsed_free_f hfree;        /* function to free the content */
00079         unsigned int supported;        /* supported mask for the current hdr */
00080         unsigned int supported_all;    /* suppoted mask for the all "supported" hdr
00081                                         *  - it's set only for the first hdr in 
00082                                         *  sibling list*/
00083 };
00084 
00085 
00089 int parse_supported( struct sip_msg *msg);
00090 
00091 
00092 void free_supported(struct supported_body **sb);
00093 
00094 #endif /* PARSE_SUPPORTED_H */