parse_sst.h

Go to the documentation of this file.
00001 /*
00002  * $Id: parse_sst.h 4720 2008-08-23 10:56:15Z henningw $
00003  *
00004  * Copyright (c) 2006 SOMA Networks, Inc. <http://www.somanetworks.com/>
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  * History:
00023  * --------
00024  * 2006-02-17 Initial revision (dhsueh@somanetworks.com)
00025  */
00026 
00027 /*!
00028  * \file
00029  * \brief SST parser
00030  * \ingroup parser
00031  */
00032 
00033 #ifndef PARSE_SST_H
00034 #define PARSE_SST_H 1
00035 
00036 
00037 #include "msg_parser.h"
00038 #include "hf.h"
00039 
00040 
00041 /*!
00042  * Indicate the "refresher=" value of the Session-Expires header.
00043  */
00044 enum sst_refresher {
00045    sst_refresher_unspecified,
00046    sst_refresher_uac,
00047    sst_refresher_uas,
00048 };
00049 
00050 
00051 /*!
00052  * We will treat the 'void* parsed' field of struct hdr_field as
00053  * a pointer to a struct session_expires.
00054  */
00055 struct session_expires {
00056    unsigned            interval; /* in seconds */
00057    enum sst_refresher  refresher;
00058 };
00059 
00060 
00061 enum parse_sst_result {
00062    parse_sst_success,
00063    parse_sst_header_not_found,   /* no header */
00064    parse_sst_no_value,        /* no interval specified */
00065 #if NOT_IMPLEMENTED_YET
00066    parse_sst_duplicate,    /* multiple s-e / x / min-se headers found */
00067 #endif
00068    parse_sst_out_of_mem,
00069    parse_sst_parse_error,     /* something puked */
00070 };
00071 
00072 
00073 /*!
00074  * Allocate a zeroed-out struct session_expires.
00075  */
00076 struct session_expires *
00077 malloc_session_expires( void );
00078 
00079 
00080 /*!
00081  * Deallocates memory previously allocated via malloc_session_expires().
00082  */
00083 void
00084 free_session_expires( struct session_expires * );
00085 
00086 
00087 /*!
00088  * \brief Parses the (should be only one instance) single instance of the
00089  * "Session-Expires" or "x" header in the msg. 
00090  * \note The header is not automatically parsed in parse_headers()[1]
00091  * so you'll have to call this function to get the information.
00092  *
00093  * Because of time constraints, this function is coded assuming there is
00094  * NO WHITESPACE in any of the body -- note that the augBNF for the
00095  * Session-Expires body allows sep whitespace between tokens:
00096  *   delta-seconds SWS ";" SWS "refresher" SWS "=" SWS ( "uac" / "uas" )
00097  *
00098  * Note[1]: it looks like only the frequently-used headers are
00099  * automatically parsed in parse_headers() (indicated by a parse_<name>
00100  * function of the form "char* parse_<name>(char *buf, char *end, foo*)
00101  * and a struct foo with a member called "error").
00102  *
00103  * \param msg the sip message to examine
00104  * \param se the place to store session-expires information into, if
00105  *         provided; note that result is also available in
00106  *         *((struct session_expires *)msg->session_expires->parsed)
00107  * \return parse_sst_result
00108  */
00109 enum parse_sst_result
00110 parse_session_expires( struct sip_msg *msg, struct session_expires *se );
00111 
00112 
00113 /*!
00114  * \brief Parses the (should be only one instance) single instance of the
00115  * "Min-SE" header in the msg. 
00116  * \note The header is not automatically parsed in parse_headers() so you'll have
00117  * to call this function to get the information.
00118  *
00119  * \param msg the sip message to examine
00120  * \param min_se the place to store the Min-SE value, if provided; note that
00121  *         result is also available in (unsigned)msg->min_se->parsed
00122  * \return parse_sst_result
00123  */
00124 enum parse_sst_result
00125 parse_min_se( struct sip_msg *msg, unsigned *min_se );
00126 
00127 
00128 #endif /* ! PARSE_SST_H */

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