parse_content.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  *
00005  * Copyright (C) 2001-2003 FhG Fokus
00006  *
00007  * This file is part of ser, a free SIP server.
00008  *
00009  * ser is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version
00013  *
00014  * ser is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License 
00020  * along with this program; if not, write to the Free Software 
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  */
00023 
00031 #ifndef _PARSE_CONTENT_H
00032 #define _PARSE_CONTENT_H
00033 
00034 #include "msg_parser.h"
00035 
00036 
00037 struct mime_type {
00038         unsigned short type;
00039         unsigned short subtype;
00040 };
00041 
00042 
00043 
00047 
00049 #define TYPE_TEXT            1
00050 #define TYPE_MESSAGE         2
00051 #define TYPE_APPLICATION     3
00052 #define TYPE_MULTIPART       4
00053 #define TYPE_ALL             0xfe
00054 #define TYPE_UNKNOWN         0xff
00055 
00056 #define SUBTYPE_PLAIN        1
00057 #define SUBTYPE_CPIM         2
00058 #define SUBTYPE_SDP          3
00059 #define SUBTYPE_CPLXML       4
00060 #define SUBTYPE_PIDFXML      5
00061 #define SUBTYPE_RLMIXML      6
00062 #define SUBTYPE_RELATED      7
00063 #define SUBTYPE_LPIDFXML     8
00064 #define SUBTYPE_XPIDFXML     9
00065 #define SUBTYPE_WATCHERINFOXML     10
00066 #define SUBTYPE_EXTERNAL_BODY      11
00067 #define SUBTYPE_XML_MSRTC_PIDF     12
00068 #define SUBTYPE_CPIM_PIDFXML       13
00069 #define SUBTYPE_MIXED              14
00070 #define SUBTYPE_ALL          0xfe
00071 #define SUBTYPE_UNKNOWN      0xff
00072 
00076 #define MIMETYPE(x_,y_) ((TYPE_##x_ << 16) | (SUBTYPE_##y_))
00077 
00081 #define MAX_MIMES_NR         128
00082 
00086 #define get_content_length(_msg_)   ((long)((_msg_)->content_length->parsed))
00087 
00088 
00092 #define get_content_type(_msg_)   ((int)(long)((_msg_)->content_type->parsed))
00093 
00094 
00099 #define get_accept(_msg_) ((int*)((_msg_)->accept->parsed))
00100 
00108 int parse_content_type_hdr( struct sip_msg *msg);
00109 
00110 int parse_accept_body(struct hdr_field *hdr);
00111 
00119 int parse_accept_hdr( struct sip_msg *msg );
00120 
00121 
00127 char* parse_content_length( char* buffer, char* end, int* len);
00128 
00132 char* decode_mime_type(char *start, char *end, unsigned int *mime_type);
00133 
00134 #endif