parse_content.h

Go to the documentation of this file.
00001 /*
00002  * $Id: parse_content.h 4720 2008-08-23 10:56:15Z henningw $
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
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 /*!
00024  * \file
00025  * \brief Content header parser
00026  * \ingroup parser
00027  */
00028 
00029 #ifndef _PARSE_CONTENT_H
00030 #define _PARSE_CONTENT_H
00031 
00032 #include "msg_parser.h"
00033 
00034 
00035 struct mime_type {
00036    unsigned short type;
00037    unsigned short subtype;
00038 };
00039 
00040 
00041 
00042 /*
00043  * Mimes types/subtypes that are recognized
00044  */
00045 #define TYPE_TEXT            1
00046 #define TYPE_MESSAGE         2
00047 #define TYPE_APPLICATION     3
00048 #define TYPE_MULTIPART       4
00049 #define TYPE_ALL             0xfe
00050 #define TYPE_UNKNOWN         0xff
00051 
00052 #define SUBTYPE_PLAIN        1
00053 #define SUBTYPE_CPIM         2
00054 #define SUBTYPE_SDP          3
00055 #define SUBTYPE_CPLXML       4
00056 #define SUBTYPE_PIDFXML      5
00057 #define SUBTYPE_RLMIXML      6
00058 #define SUBTYPE_RELATED      7
00059 #define SUBTYPE_LPIDFXML     8
00060 #define SUBTYPE_XPIDFXML     9
00061 #define SUBTYPE_WATCHERINFOXML     10
00062 #define SUBTYPE_EXTERNAL_BODY      11
00063 #define SUBTYPE_XML_MSRTC_PIDF     12
00064 #define SUBTYPE_SMS          13       /* simple-message-summary */
00065 #define SUBTYPE_MIXED        14
00066 #define SUBTYPE_ALL          0xfe
00067 #define SUBTYPE_UNKNOWN      0xff
00068 
00069 
00070 /*!
00071  * Maximum number of mimes allowed in Accept header 
00072  */
00073 #define MAX_MIMES_NR         128
00074 
00075 /*!
00076  * returns the content-length value of a sip_msg as an integer
00077  */
00078 #define get_content_length(_msg_)   ((long)((_msg_)->content_length->parsed))
00079 
00080 
00081 /*!
00082  * returns the content-type value of a sip_msg as an integer
00083  */
00084 #define get_content_type(_msg_)   ((int)(long)((_msg_)->content_type->parsed))
00085 
00086 
00087 /*!
00088  * returns the accept values of a sip_msg as an null-terminated array
00089  * of integers
00090  */
00091 #define get_accept(_msg_) ((int*)((_msg_)->accept->parsed))
00092 
00093 /*!
00094  * parse the body of the Content-Type header. It's value is also converted
00095  * as int.
00096  * Returns:   n (n>0)  : the found type
00097  *            0        : hdr not found
00098  *           -1        : error (parse error )
00099  */
00100 int parse_content_type_hdr( struct sip_msg *msg);
00101 
00102 /*!
00103  * parse the body of the Accept header. It's values are also converted
00104  * as an null-terminated array of ints.
00105  * \return 1 for OK, 0 for hdr not found, -1 on errors (parse errors)
00106  */
00107 int parse_accept_hdr( struct sip_msg *msg );
00108 
00109 
00110 /*!
00111  *  parse the body of a Content_-Length header. Also tries to recognize the
00112  *  type specified by this header (see th above defines).
00113  *  \return first chr after the end of the header.
00114  */
00115 char* parse_content_length( char* buffer, char* end, int* len);
00116 
00117 
00118 /*!
00119  * parse a string containing a mime description
00120  */
00121 char* decode_mime_type(char *start, char *end, unsigned int *mime_type);
00122 
00123 #endif

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