msg 1.12.11devel
/tmp/buildd/sofia-sip-1.12.11+20110422/libsofia-sip-ua/msg/sofia-sip/msg_mime.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of the Sofia-SIP package
00003  *
00004  * Copyright (C) 2005-2011 Nokia Corporation.
00005  *
00006  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation; either version 2.1 of
00011  * the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  *
00023  */
00024 
00025 #ifndef MSG_MIME_H
00026 
00027 #define MSG_MIME_H
00028 
00040 #ifndef URL_H
00041 #include <sofia-sip/url.h>
00042 #endif
00043 #ifndef MSG_TYPES_H
00044 #include <sofia-sip/msg_types.h>
00045 #endif
00046 #ifndef SU_TYPES_H
00047 #include <sofia-sip/su_types.h>
00048 #endif
00049 
00050 SOFIA_BEGIN_DECLS
00051 
00052 typedef struct msg_accept_any_s     msg_accept_any_t;
00053 
00054 typedef struct msg_accept_s         msg_accept_t;
00055 
00056 typedef msg_accept_any_t            msg_accept_charset_t;
00057 typedef msg_accept_any_t            msg_accept_encoding_t;
00058 typedef msg_accept_any_t            msg_accept_language_t;
00059 
00060 typedef struct msg_content_disposition_s
00061                                     msg_content_disposition_t;
00062 typedef msg_list_t                  msg_content_encoding_t;
00063 typedef msg_generic_t               msg_content_id_t;
00064 typedef struct msg_content_length_s msg_content_length_t;
00065 typedef msg_generic_t               msg_content_location_t;
00066 typedef msg_list_t                  msg_content_language_t;
00067 typedef msg_generic_t               msg_content_md5_t;
00068 typedef msg_generic_t               msg_content_transfer_encoding_t;
00069 typedef struct msg_content_type_s   msg_content_type_t;
00070 typedef msg_generic_t               msg_mime_version_t;
00071 typedef struct msg_warning_s        msg_warning_t;
00072 
00074 typedef struct msg_multipart_s      msg_multipart_t;
00075 
00079 struct msg_accept_s
00080 {
00081   msg_common_t        ac_common[1]; 
00082   msg_accept_t       *ac_next;      
00083   char const         *ac_type;      
00084   char const         *ac_subtype;   
00085   msg_param_t const  *ac_params;    
00086   char const         *ac_q;         
00087 };
00088 
00093 struct msg_accept_any_s
00094 {
00095   msg_common_t        aa_common[1]; 
00096   msg_accept_any_t   *aa_next;      
00097   char const         *aa_value;     
00098   msg_param_t const  *aa_params;    
00099   char const         *aa_q;         
00100 };
00101 
00105 struct msg_content_disposition_s
00106 {
00107   msg_common_t       cd_common[1];  
00108   msg_error_t       *cd_next;       
00109   char const        *cd_type;       
00110   msg_param_t const *cd_params;     
00111   char const        *cd_handling;   
00112   unsigned           cd_required:1; 
00113   unsigned           cd_optional:1; 
00114   unsigned           :0;            /* pad */
00115 };
00116 
00120 struct msg_content_length_s
00121 {
00122   msg_common_t   l_common[1];       
00123   msg_error_t   *l_next;            
00124   unsigned long  l_length;          
00125 };
00126 
00127 
00131 struct msg_content_type_s
00132 {
00133   msg_common_t        c_common[1];  
00134   msg_error_t        *c_next;       
00135   char const         *c_type;       
00136   char const         *c_subtype;    
00137   msg_param_t const  *c_params;     
00138 };
00139 
00140 
00144 struct msg_warning_s
00145 {
00146   msg_common_t        w_common[1];  
00147   msg_warning_t      *w_next;       
00148   unsigned            w_code;       
00149   char const         *w_host;       
00150   char const         *w_port;       
00151   char const         *w_text;       
00152 };
00153 
00154 
00159 struct msg_multipart_s
00160 {
00161   msg_common_t            mp_common[1]; 
00162   msg_multipart_t        *mp_next;      
00163   /* Preamble for this part */
00164   char                   *mp_data;      
00165   unsigned                mp_len;       
00166   unsigned                mp_flags;
00167   msg_error_t            *mp_error;
00168 
00169   /* === Headers start here */
00170   msg_content_type_t     *mp_content_type;      
00171   msg_content_disposition_t *mp_content_disposition;
00173   msg_content_location_t *mp_content_location;  
00174   msg_content_id_t       *mp_content_id;        
00175   msg_content_language_t *mp_content_language;  
00176   msg_content_encoding_t *mp_content_encoding;  
00177   msg_content_transfer_encoding_t *mp_content_transfer_encoding;
00179 #if 0
00180   /* === Hash headers end here */
00181   /* These MIME headers are here for msg_parser.awk */
00182   msg_accept_t           *mp_accept;            
00183   msg_accept_charset_t   *mp_accept_charset;    
00184   msg_accept_encoding_t  *mp_accept_encoding;   
00185   msg_accept_language_t  *mp_accept_language;   
00186   msg_mime_version_t     *mp_mime_version;      
00187   msg_content_md5_t      *mp_content_md5;       
00188   msg_content_length_t   *mp_content_length;    
00189   msg_multipart_t        *mp_multipart;         
00190   msg_warning_t          *mp_warning;           
00191 #endif
00192   /* === Headers end here */
00193 
00195   msg_unknown_t          *mp_unknown;           
00197   msg_separator_t        *mp_separator;         
00198   msg_payload_t          *mp_payload;           
00200   msg_multipart_t        *mp_multipart;         
00202   msg_payload_t          *mp_close_delim;       
00203 };
00204 
00205 SOFIAPUBFUN msg_multipart_t *msg_multipart_create(su_home_t *home,
00206                                                   char const *content_type,
00207                                                   void const *data,
00208                                                   isize_t dlen);
00209 SOFIAPUBFUN msg_multipart_t *msg_multipart_parse(su_home_t *home,
00210                                                  msg_content_type_t const *c,
00211                                                  msg_payload_t *pl);
00212 SOFIAPUBFUN int msg_multipart_complete(su_home_t *home,
00213                                        msg_content_type_t *c,
00214                                        msg_multipart_t *mp);
00215 SOFIAPUBFUN msg_header_t *msg_multipart_serialize(msg_header_t **head0,
00216                                                   msg_multipart_t *mp);
00217 
00218 SOFIAPUBFUN issize_t msg_multipart_prepare(msg_t *msg,
00219                                            msg_multipart_t *mp,
00220                                            int flags);
00221 
00222 SOFIAPUBFUN isize_t msg_accept_any_dup_xtra(msg_header_t const *h,
00223                                             isize_t offset);
00224 
00225 SOFIAPUBFUN char *msg_accept_any_dup_one(msg_header_t *dst,
00226                                          msg_header_t const *src,
00227                                          char *b, isize_t xtra);
00228 
00229 SOFIAPUBFUN msg_content_length_t *msg_content_length_create(su_home_t *,
00230                                                             uint32_t n);
00231 
00232 SOFIAPUBFUN unsigned msg_q_value(char const *q);
00233 
00234 SOFIAPUBFUN msg_accept_t *msg_accept_match(msg_accept_t const *,
00235                                            msg_content_type_t const *);
00236 
00238 #define MSG_MULTIPART_VERSION_CURRENT msg_mime_version_1_0
00239 SOFIAPUBVAR char const msg_mime_version_1_0[];
00240 
00242 #define MSG_MULTIPART_PROTOCOL_TAG ((void *)(uintptr_t)0x4d494d45) /* 'MIME' */
00243 
00244 SOFIA_END_DECLS
00245 
00246 #endif 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.