msg  1.13.16
msg_mime.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef MSG_MIME_H
27 #define MSG_MIME_H
28 
40 #ifndef URL_H
41 #include <sofia-sip/url.h>
42 #endif
43 
44 #ifndef MSG_TYPES_H
45 #include <sofia-sip/msg_types.h>
46 #endif
47 #ifndef SU_TYPES_H
48 #include <sofia-sip/su_types.h>
49 #endif
50 
51 SOFIA_BEGIN_DECLS
52 
53 typedef struct msg_accept_any_s msg_accept_any_t;
54 
55 typedef struct msg_accept_s msg_accept_t;
56 
60 
61 typedef struct msg_content_disposition_s
72 typedef struct msg_warning_s msg_warning_t;
73 
75 typedef struct msg_multipart_s msg_multipart_t;
76 
81 {
84  char const *ac_type;
85  char const *ac_subtype;
86  msg_param_t const *ac_params;
87  char const *ac_q;
88 };
89 
95 {
98  char const *aa_value;
99  msg_param_t const *aa_params;
100  char const *aa_q;
101 };
102 
107 {
110  char const *cd_type;
111  msg_param_t const *cd_params;
112  char const *cd_handling;
113  unsigned cd_required:1;
114  unsigned cd_optional:1;
115  unsigned :0; /* pad */
116 };
117 
122 {
125  unsigned long l_length;
126 };
127 
128 
133 {
136  char const *c_type;
137  char const *c_subtype;
138  msg_param_t const *c_params;
139 };
140 
141 
146 {
149  unsigned w_code;
150  char const *w_host;
151  char const *w_port;
152  char const *w_text;
153 };
154 
155 
161 {
164  /* Preamble for this part */
165  char *mp_data;
166  unsigned mp_len;
167  unsigned mp_flags;
168  msg_error_t *mp_error;
169 
170  /* === Headers start here */
180 #if 0
181  /* === Hash headers end here */
182  /* These MIME headers are here for msg_parser.awk */
183  msg_accept_t *mp_accept;
184  msg_accept_charset_t *mp_accept_charset;
185  msg_accept_encoding_t *mp_accept_encoding;
186  msg_accept_language_t *mp_accept_language;
187  msg_mime_version_t *mp_mime_version;
188  msg_content_md5_t *mp_content_md5;
189  msg_content_length_t *mp_content_length;
191  msg_warning_t *mp_warning;
192 #endif
193  /* === Headers end here */
194 
204 };
205 
208  char const *content_type,
209  void const *data,
210  isize_t dlen);
213  msg_content_type_t const *c,
214  msg_payload_t *pl);
218  msg_multipart_t *mp);
220  msg_multipart_t *mp);
221 
222 SOFIAPUBFUN issize_t msg_multipart_prepare(msg_t *msg, msg_multipart_t *mp, int flags);
223 
224 SOFIAPUBFUN isize_t msg_accept_any_dup_xtra(msg_header_t const *h, isize_t offset);
225 
227  msg_header_t const *src,
228  char *b, isize_t xtra);
229 
232 
234 #define MSG_MULTIPART_VERSION_CURRENT msg_mime_version_1_0
235 SOFIAPUBVAR char const msg_mime_version_1_0[];
236 
238 #ifndef _MSC_VER
239 #define MSG_MULTIPART_PROTOCOL_TAG ((void *)0x4d494d45) /* 'MIME' */
240 #else
241 #define MSG_MULTIPART_PROTOCOL_TAG ((void *)(UINT_PTR)0x4d494d45) /* 'MIME' */
242 #endif
243 
244 SOFIA_END_DECLS
245 
246 #endif
msg_accept_any_t msg_accept_charset_t
The structure msg_accept_encoding_t contains representation of Accept-Charset header.
Definition: msg_mime.h:57
msg_accept_any_t msg_accept_encoding_t
The structure msg_accept_encoding_t contains representation of Accept-Encoding header.
Definition: msg_mime.h:58
msg_accept_any_t msg_accept_language_t
The structure msg_accept_language_t contains representation of Accept-Language header.
Definition: msg_mime.h:59
msg_list_t msg_content_encoding_t
The structure msg_content_encoding_t contains representation of an Content-Encoding header.
Definition: msg_mime.h:63
msg_generic_t msg_content_id_t
Content-ID Header Structure.
Definition: msg_mime.h:64
msg_list_t msg_content_language_t
The structure msg_content_language_t contains representation of Content-Language header.
Definition: msg_mime.h:67
msg_content_length_t * msg_content_length_create(su_home_t *home, uint32_t n)
 Create a Content-Length header object.
Definition: msg_mime.c:1706
msg_generic_t msg_content_location_t
The structure msg_content_location_t contains representation of an Content-Location header.
Definition: msg_mime.h:66
msg_generic_t msg_content_md5_t
The structure msg_content_md5_t contains representation of an Content-MD5 header.
Definition: msg_mime.h:68
msg_generic_t msg_content_transfer_encoding_t
The structure msg_content_transfer_encoding_t contains representation of an Content-Transfer-Encoding...
Definition: msg_mime.h:69
msg_generic_t msg_mime_version_t
The structure msg_mime_version_t contains representation of an MIME-Version header.
Definition: msg_mime.h:71
msg_multipart_t * msg_multipart_parse(su_home_t *home, msg_content_type_t const *c, msg_payload_t *pl)
Parse a MIME multipart.
Definition: msg_mime.c:372
msg_header_t * msg_multipart_serialize(msg_header_t **head0, msg_multipart_t *mp)
Serialize a multipart message.
Definition: msg_mime.c:686
char const msg_mime_version_1_0[]
Protocol version of MIME.
Definition: msg_mime.c:64
issize_t msg_multipart_prepare(msg_t *msg, msg_multipart_t *mp, int flags)
Encode a multipart.
Definition: msg_mime.c:816
int msg_multipart_complete(su_home_t *home, msg_content_type_t *c, msg_multipart_t *mp)
Add all missing parts to the multipart.
Definition: msg_mime.c:574
msg_multipart_t * msg_multipart_create(su_home_t *home, char const *content_type, void const *data, isize_t dlen)
Create a part for MIME multipart entity.
Definition: msg_mime.c:239
Types for messages and common headers.
MSG_HDR_T msg_header_t
Any protocol-specific header object.
Definition: msg_types.h:87
Structure for Accept-Charset, Accept-Encoding and Accept-Language headers.
Definition: msg_mime.h:95
char const * aa_q
Value of q parameter.
Definition: msg_mime.h:100
char const * aa_value
Token.
Definition: msg_mime.h:98
msg_common_t aa_common[1]
Common fragment info.
Definition: msg_mime.h:96
msg_param_t const * aa_params
List of parameters.
Definition: msg_mime.h:99
msg_accept_any_t * aa_next
Pointer to next Accept-* header.
Definition: msg_mime.h:97
char * msg_accept_any_dup_one(msg_header_t *dst, msg_header_t const *src, char *b, isize_t xtra)
Duplicate one msg_accept_any_t object.
Definition: msg_mime.c:1226
isize_t msg_accept_any_dup_xtra(msg_header_t const *h, isize_t offset)
Calculate extra memory used by accept-* headers.
Definition: msg_mime.c:1214
Structure for Accept header.
Definition: msg_mime.h:81
char const * ac_type
Pointer to type/subtype.
Definition: msg_mime.h:84
char const * ac_q
Value of q parameter.
Definition: msg_mime.h:87
msg_param_t const * ac_params
List of parameters.
Definition: msg_mime.h:86
char const * ac_subtype
Points after first slash in type.
Definition: msg_mime.h:85
msg_accept_t * ac_next
Pointer to next Accept header.
Definition: msg_mime.h:83
msg_common_t ac_common[1]
Common fragment info.
Definition: msg_mime.h:82
Common part of the header objects (or message fragments).
Definition: msg_types.h:111
Structure for Content-Disposition header.
Definition: msg_mime.h:107
msg_common_t cd_common[1]
Common fragment info.
Definition: msg_mime.h:108
unsigned cd_optional
True if handling=optional.
Definition: msg_mime.h:114
msg_error_t * cd_next
Link to next (dummy)
Definition: msg_mime.h:109
char const * cd_type
Disposition type.
Definition: msg_mime.h:110
unsigned cd_required
True if handling=required.
Definition: msg_mime.h:113
char const * cd_handling
Value of handling parameter.
Definition: msg_mime.h:112
msg_param_t const * cd_params
List of parameters.
Definition: msg_mime.h:111
Structure for Content-Length header.
Definition: msg_mime.h:122
msg_error_t * l_next
Link to next (dummy)
Definition: msg_mime.h:124
unsigned long l_length
Digits.
Definition: msg_mime.h:125
msg_common_t l_common[1]
Common fragment info.
Definition: msg_mime.h:123
Structure for Content-Type header.
Definition: msg_mime.h:133
msg_param_t const * c_params
List of parameters.
Definition: msg_mime.h:138
msg_error_t * c_next
Dummy link to next.
Definition: msg_mime.h:135
msg_common_t c_common[1]
Common fragment info.
Definition: msg_mime.h:134
char const * c_type
Pointer to type/subtype.
Definition: msg_mime.h:136
char const * c_subtype
Points after first slash in type.
Definition: msg_mime.h:137
Erroneus header.
Definition: msg_types.h:199
Generic header.
Definition: msg_types.h:151
List header.
Definition: msg_types.h:161
Structure for a part in MIME multipart message.
Definition: msg_mime.h:161
msg_payload_t * mp_payload
Body part.
Definition: msg_mime.h:199
unsigned mp_len
Length of boundary (mp_data).
Definition: msg_mime.h:166
msg_multipart_t * mp_multipart
Recursive multipart.
Definition: msg_mime.h:201
msg_payload_t * mp_close_delim
Closing delimiter.
Definition: msg_mime.h:203
char * mp_data
Boundary string.
Definition: msg_mime.h:165
msg_multipart_t * mp_next
Next part in multipart body.
Definition: msg_mime.h:163
msg_content_type_t * mp_content_type
Content-Type (c)
Definition: msg_mime.h:171
msg_separator_t * mp_separator
Separator.
Definition: msg_mime.h:198
msg_content_transfer_encoding_t * mp_content_transfer_encoding
Content-Transfer-Encoding.
Definition: msg_mime.h:178
msg_content_disposition_t * mp_content_disposition
Content-Disposition.
Definition: msg_mime.h:172
msg_content_language_t * mp_content_language
Content-Language.
Definition: msg_mime.h:176
msg_content_location_t * mp_content_location
Content-Location.
Definition: msg_mime.h:174
msg_content_encoding_t * mp_content_encoding
Content-Encoding (e)
Definition: msg_mime.h:177
msg_common_t mp_common[1]
Common fragment information.
Definition: msg_mime.h:162
msg_unknown_t * mp_unknown
Unknown and extra headers.
Definition: msg_mime.h:196
msg_content_id_t * mp_content_id
Content-ID.
Definition: msg_mime.h:175
Message payload.
Definition: msg_types.h:214
Message object.
Definition: msg_internal.h:59
Separator.
Definition: msg_types.h:207
Unknown header.
Definition: msg_types.h:191
Structure for Warning header.
Definition: msg_mime.h:146
msg_common_t w_common[1]
Common fragment info.
Definition: msg_mime.h:147
char const * w_text
Warning text.
Definition: msg_mime.h:152
char const * w_port
Port number.
Definition: msg_mime.h:151
char const * w_host
Hostname or pseudonym.
Definition: msg_mime.h:150
unsigned w_code
Warning code.
Definition: msg_mime.h:149
msg_warning_t * w_next
Link to next Warning header.
Definition: msg_mime.h:148
SU_HOME_T su_home_t
#define SOFIAPUBFUN
#define SOFIAPUBVAR
SU_U32_T uint32_t

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