msg 1.12.10
|
00001 /* 00002 * This file is part of the Sofia-SIP package 00003 * 00004 * Copyright (C) 2005 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 00044 #ifndef MSG_TYPES_H 00045 #include <sofia-sip/msg_types.h> 00046 #endif 00047 #ifndef SU_TYPES_H 00048 #include <sofia-sip/su_types.h> 00049 #endif 00050 00051 SOFIA_BEGIN_DECLS 00052 00053 typedef struct msg_accept_any_s msg_accept_any_t; 00054 00055 typedef struct msg_accept_s msg_accept_t; 00056 00057 typedef msg_accept_any_t msg_accept_charset_t; 00058 typedef msg_accept_any_t msg_accept_encoding_t; 00059 typedef msg_accept_any_t msg_accept_language_t; 00060 00061 typedef struct msg_content_disposition_s 00062 msg_content_disposition_t; 00063 typedef msg_list_t msg_content_encoding_t; 00064 typedef msg_generic_t msg_content_id_t; 00065 typedef struct msg_content_length_s msg_content_length_t; 00066 typedef msg_generic_t msg_content_location_t; 00067 typedef msg_list_t msg_content_language_t; 00068 typedef msg_generic_t msg_content_md5_t; 00069 typedef msg_generic_t msg_content_transfer_encoding_t; 00070 typedef struct msg_content_type_s msg_content_type_t; 00071 typedef msg_generic_t msg_mime_version_t; 00072 typedef struct msg_warning_s msg_warning_t; 00073 00075 typedef struct msg_multipart_s msg_multipart_t; 00076 00080 struct msg_accept_s 00081 { 00082 msg_common_t ac_common[1]; 00083 msg_accept_t *ac_next; 00084 char const *ac_type; 00085 char const *ac_subtype; 00086 msg_param_t const *ac_params; 00087 char const *ac_q; 00088 }; 00089 00094 struct msg_accept_any_s 00095 { 00096 msg_common_t aa_common[1]; 00097 msg_accept_any_t *aa_next; 00098 char const *aa_value; 00099 msg_param_t const *aa_params; 00100 char const *aa_q; 00101 }; 00102 00106 struct msg_content_disposition_s 00107 { 00108 msg_common_t cd_common[1]; 00109 msg_error_t *cd_next; 00110 char const *cd_type; 00111 msg_param_t const *cd_params; 00112 char const *cd_handling; 00113 unsigned cd_required:1; 00114 unsigned cd_optional:1; 00115 unsigned :0; /* pad */ 00116 }; 00117 00121 struct msg_content_length_s 00122 { 00123 msg_common_t l_common[1]; 00124 msg_error_t *l_next; 00125 unsigned long l_length; 00126 }; 00127 00128 00132 struct msg_content_type_s 00133 { 00134 msg_common_t c_common[1]; 00135 msg_error_t *c_next; 00136 char const *c_type; 00137 char const *c_subtype; 00138 msg_param_t const *c_params; 00139 }; 00140 00141 00145 struct msg_warning_s 00146 { 00147 msg_common_t w_common[1]; 00148 msg_warning_t *w_next; 00149 unsigned w_code; 00150 char const *w_host; 00151 char const *w_port; 00152 char const *w_text; 00153 }; 00154 00155 00160 struct msg_multipart_s 00161 { 00162 msg_common_t mp_common[1]; 00163 msg_multipart_t *mp_next; 00164 /* Preamble for this part */ 00165 char *mp_data; 00166 usize_t mp_len; 00167 unsigned mp_flags; 00168 msg_error_t *mp_error; 00169 00170 /* === Headers start here */ 00171 msg_content_type_t *mp_content_type; 00172 msg_content_disposition_t *mp_content_disposition; 00174 msg_content_location_t *mp_content_location; 00175 msg_content_id_t *mp_content_id; 00176 msg_content_language_t *mp_content_language; 00177 msg_content_encoding_t *mp_content_encoding; 00178 msg_content_transfer_encoding_t *mp_content_transfer_encoding; 00180 #if 0 00181 /* === Hash headers end here */ 00182 /* These MIME headers are here for msg_parser.awk */ 00183 msg_accept_t *mp_accept; 00184 msg_accept_charset_t *mp_accept_charset; 00185 msg_accept_encoding_t *mp_accept_encoding; 00186 msg_accept_language_t *mp_accept_language; 00187 msg_mime_version_t *mp_mime_version; 00188 msg_content_md5_t *mp_content_md5; 00189 msg_content_length_t *mp_content_length; 00190 msg_multipart_t *mp_multipart; 00191 msg_warning_t *mp_warning; 00192 #endif 00193 /* === Headers end here */ 00194 00196 msg_unknown_t *mp_unknown; 00198 msg_separator_t *mp_separator; 00199 msg_payload_t *mp_payload; 00201 msg_multipart_t *mp_multipart; 00203 msg_payload_t *mp_close_delim; 00204 }; 00205 00206 SOFIAPUBFUN 00207 msg_multipart_t *msg_multipart_create(su_home_t *home, 00208 char const *content_type, 00209 void const *data, 00210 isize_t dlen); 00211 SOFIAPUBFUN 00212 msg_multipart_t *msg_multipart_parse(su_home_t *home, 00213 msg_content_type_t const *c, 00214 msg_payload_t *pl); 00215 SOFIAPUBFUN 00216 int msg_multipart_complete(su_home_t *home, 00217 msg_content_type_t *c, 00218 msg_multipart_t *mp); 00219 SOFIAPUBFUN msg_header_t *msg_multipart_serialize(msg_header_t **head0, 00220 msg_multipart_t *mp); 00221 00222 SOFIAPUBFUN issize_t msg_multipart_prepare(msg_t *msg, msg_multipart_t *mp, int flags); 00223 00224 SOFIAPUBFUN isize_t msg_accept_any_dup_xtra(msg_header_t const *h, isize_t offset); 00225 00226 SOFIAPUBFUN char *msg_accept_any_dup_one(msg_header_t *dst, 00227 msg_header_t const *src, 00228 char *b, isize_t xtra); 00229 00230 SOFIAPUBFUN 00231 msg_content_length_t *msg_content_length_create(su_home_t *home, uint32_t n); 00232 00234 #define MSG_MULTIPART_VERSION_CURRENT msg_mime_version_1_0 00235 SOFIAPUBVAR char const msg_mime_version_1_0[]; 00236 00238 #define MSG_MULTIPART_PROTOCOL_TAG ((void *)0x4d494d45) /* 'MIME' */ 00239 00240 SOFIA_END_DECLS 00241 00242 #endif