msg  1.12.11devel
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2011 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
26 
27 #define MSG_MIME_H
28 
40 #ifndef URL_H
41 #include <sofia-sip/url.h>
42 #endif
43 #ifndef MSG_TYPES_H
44 #include <sofia-sip/msg_types.h>
45 #endif
46 #ifndef SU_TYPES_H
47 #include <sofia-sip/su_types.h>
48 #endif
49 
50 SOFIA_BEGIN_DECLS
51 
52 typedef struct msg_accept_any_s msg_accept_any_t;
53 
54 typedef struct msg_accept_s msg_accept_t;
55 
59 
72 
75 
80 {
83  char const *ac_type;
84  char const *ac_subtype;
85  msg_param_t const *ac_params;
86  char const *ac_q;
87 };
88 
94 {
97  char const *aa_value;
98  msg_param_t const *aa_params;
99  char const *aa_q;
100 };
101 
106 {
109  char const *cd_type;
110  msg_param_t const *cd_params;
111  char const *cd_handling;
112  unsigned cd_required:1;
113  unsigned cd_optional:1;
114  unsigned :0; /* pad */
115 };
116 
121 {
124  unsigned long l_length;
125 };
126 
127 
132 {
135  char const *c_type;
136  char const *c_subtype;
137  msg_param_t const *c_params;
138 };
139 
140 
145 {
148  unsigned w_code;
149  char const *w_host;
150  char const *w_port;
151  char const *w_text;
152 };
153 
154 
160 {
163  /* Preamble for this part */
164  char *mp_data;
165  unsigned mp_len;
166  unsigned mp_flags;
167  msg_error_t *mp_error;
168 
169  /* === Headers start here */
179 #if 0
180  /* === Hash headers end here */
181  /* These MIME headers are here for msg_parser.awk */
182  msg_accept_t *mp_accept;
183  msg_accept_charset_t *mp_accept_charset;
184  msg_accept_encoding_t *mp_accept_encoding;
185  msg_accept_language_t *mp_accept_language;
186  msg_mime_version_t *mp_mime_version;
187  msg_content_md5_t *mp_content_md5;
188  msg_content_length_t *mp_content_length;
190  msg_warning_t *mp_warning;
191 #endif
192  /* === Headers end here */
193 
203 };
204 
206  char const *content_type,
207  void const *data,
208  isize_t dlen);
210  msg_content_type_t const *c,
211  msg_payload_t *pl);
214  msg_multipart_t *mp);
216  msg_multipart_t *mp);
217 
219  msg_multipart_t *mp,
220  int flags);
221 
223  isize_t offset);
224 
226  msg_header_t const *src,
227  char *b, isize_t xtra);
228 
230  uint32_t n);
231 
232 SOFIAPUBFUN unsigned msg_q_value(char const *q);
233 
235  msg_content_type_t const *);
236 
238 #define MSG_MULTIPART_VERSION_CURRENT msg_mime_version_1_0
239 SOFIAPUBVAR char const msg_mime_version_1_0[];
240 
242 #define MSG_MULTIPART_PROTOCOL_TAG ((void *)(uintptr_t)0x4d494d45) /* 'MIME' */
243 
244 SOFIA_END_DECLS
245 
246 #endif
msg_param_t const * ac_params
List of parameters.
Definition: msg_mime.h:85
Message payload.
Definition: msg_types.h:214
Common part of the header objects (or message fragments).
Definition: msg_types.h:111
char const * w_host
Hostname or pseudonym.
Definition: msg_mime.h:149
msg_accept_any_t * aa_next
Pointer to next Accept-* header.
Definition: msg_mime.h:96
Structure for Accept header.
Definition: msg_mime.h:79
issize_t msg_multipart_prepare(msg_t *msg, msg_multipart_t *mp, int flags)
Encode a multipart.
Definition: msg_mime.c:817
SU_HOME_T su_home_t
msg_generic_t msg_mime_version_t
The structure msg_mime_version_t contains representation of an MIME-Version header.
Definition: msg_mime.h:70
List header.
Definition: msg_types.h:161
char const * aa_value
Token.
Definition: msg_mime.h:97
msg_generic_t msg_content_location_t
The structure msg_content_location_t contains representation of an Content-Location header...
Definition: msg_mime.h:65
char const * aa_q
Value of q parameter.
Definition: msg_mime.h:99
msg_error_t * cd_next
Link to next (dummy)
Definition: msg_mime.h:108
unsigned long l_length
Digits.
Definition: msg_mime.h:124
msg_common_t w_common[1]
Common fragment info.
Definition: msg_mime.h:146
msg_header_t * msg_multipart_serialize(msg_header_t **head0, msg_multipart_t *mp)
Serialize a multipart message.
Definition: msg_mime.c:687
msg_warning_t * w_next
Link to next Warning header.
Definition: msg_mime.h:147
msg_payload_t * mp_payload
Body part.
Definition: msg_mime.h:198
char const msg_mime_version_1_0[]
Protocol version of MIME.
Definition: msg_mime.c:60
msg_generic_t msg_content_md5_t
The structure msg_content_md5_t contains representation of an Content-MD5 header. ...
Definition: msg_mime.h:67
unsigned mp_len
Length of boundary (mp_data).
Definition: msg_mime.h:165
Structure for Content-Length header.
Definition: msg_mime.h:120
char const * cd_handling
Value of handling parameter.
Definition: msg_mime.h:111
char const * w_text
Warning text.
Definition: msg_mime.h:151
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:368
Erroneus header.
Definition: msg_types.h:199
msg_multipart_t * mp_next
Next part in multipart body.
Definition: msg_mime.h:162
msg_separator_t * mp_separator
Separator.
Definition: msg_mime.h:197
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:68
msg_content_type_t * mp_content_type
Content-Type (c)
Definition: msg_mime.h:170
unsigned w_code
Warning code.
Definition: msg_mime.h:148
msg_param_t const * c_params
List of parameters.
Definition: msg_mime.h:137
msg_content_disposition_t * mp_content_disposition
Content-Disposition.
Definition: msg_mime.h:171
unsigned cd_required
True if handling=required.
Definition: msg_mime.h:112
msg_accept_any_t msg_accept_language_t
The structure msg_accept_language_t contains representation of Accept-Language header.
Definition: msg_mime.h:58
msg_content_encoding_t * mp_content_encoding
Content-Encoding (e)
Definition: msg_mime.h:176
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:1254
char const * cd_type
Disposition type.
Definition: msg_mime.h:109
msg_unknown_t * mp_unknown
Unknown and extra headers.
Definition: msg_mime.h:195
msg_error_t * l_next
Link to next (dummy)
Definition: msg_mime.h:123
char * mp_data
Boundary string.
Definition: msg_mime.h:164
msg_multipart_t * mp_multipart
Recursive multipart.
Definition: msg_mime.h:200
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:1266
#define SOFIAPUBFUN
msg_accept_any_t msg_accept_encoding_t
The structure msg_accept_encoding_t contains representation of Accept-Encoding header.
Definition: msg_mime.h:57
char const * ac_q
Value of q parameter.
Definition: msg_mime.h:86
msg_param_t const * aa_params
List of parameters.
Definition: msg_mime.h:98
msg_payload_t * mp_close_delim
Closing delimiter.
Definition: msg_mime.h:202
char const * c_type
Pointer to type/subtype.
Definition: msg_mime.h:135
#define SOFIAPUBVAR
msg_common_t ac_common[1]
Common fragment info.
Definition: msg_mime.h:81
msg_accept_t * ac_next
Pointer to next Accept header.
Definition: msg_mime.h:82
MSG_HDR_T msg_header_t
Any protocol-specific header object.
Definition: msg_types.h:87
unsigned msg_q_value(char const *q)
Calculate Q value.
Definition: msg_mime.c:943
msg_content_id_t * mp_content_id
Content-ID.
Definition: msg_mime.h:174
char const * ac_type
Pointer to type/subtype.
Definition: msg_mime.h:83
Structure for a part in MIME multipart message.
Definition: msg_mime.h:159
msg_list_t msg_content_language_t
The structure msg_content_language_t contains representation of Content-Language header.
Definition: msg_mime.h:66
msg_content_transfer_encoding_t * mp_content_transfer_encoding
Content-Transfer-Encoding.
Definition: msg_mime.h:177
msg_error_t * c_next
Dummy link to next.
Definition: msg_mime.h:134
char const * w_port
Port number.
Definition: msg_mime.h:150
Generic header.
Definition: msg_types.h:151
char const * ac_subtype
Points after first slash in type.
Definition: msg_mime.h:84
Unknown header.
Definition: msg_types.h:191
Structure for Content-Type header.
Definition: msg_mime.h:131
SU_U32_T uint32_t
msg_param_t const * cd_params
List of parameters.
Definition: msg_mime.h:110
msg_content_length_t * msg_content_length_create(su_home_t *, uint32_t n)
 Create a Content-Length header object.
Definition: msg_mime.c:1746
char const * c_subtype
Points after first slash in type.
Definition: msg_mime.h:136
msg_content_location_t * mp_content_location
Content-Location.
Definition: msg_mime.h:173
msg_list_t msg_content_encoding_t
The structure msg_content_encoding_t contains representation of an Content-Encoding header...
Definition: msg_mime.h:62
msg_common_t aa_common[1]
Common fragment info.
Definition: msg_mime.h:95
Message object.
Definition: msg_internal.h:59
Structure for Warning header.
Definition: msg_mime.h:144
msg_common_t mp_common[1]
Common fragment information.
Definition: msg_mime.h:161
Separator.
Definition: msg_types.h:207
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:235
msg_common_t c_common[1]
Common fragment info.
Definition: msg_mime.h:133
Types for messages and common headers.
msg_generic_t msg_content_id_t
Content-ID Header Structure.
Definition: msg_mime.h:63
Structure for Accept-Charset, Accept-Encoding and Accept-Language headers.
Definition: msg_mime.h:93
msg_accept_t * msg_accept_match(msg_accept_t const *, msg_content_type_t const *)
Check if the Content-Type is Acceptable.
Definition: msg_mime.c:1174
msg_accept_any_t msg_accept_charset_t
The structure msg_accept_encoding_t contains representation of Accept-Charset header.
Definition: msg_mime.h:56
unsigned cd_optional
True if handling=optional.
Definition: msg_mime.h:113
Structure for Content-Disposition header.
Definition: msg_mime.h:105
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:575
msg_content_language_t * mp_content_language
Content-Language.
Definition: msg_mime.h:175
msg_common_t cd_common[1]
Common fragment info.
Definition: msg_mime.h:107
msg_common_t l_common[1]
Common fragment info.
Definition: msg_mime.h:122

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