Loading...
Searching...
No Matches
msg_mime.h
Go to the documentation of this file.
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005-2011 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef MSG_MIME_H
#define MSG_MIME_H
#ifndef URL_H
#include <sofia-sip/url.h>
#endif
#ifndef MSG_TYPES_H
#include <sofia-sip/msg_types.h>
#endif
#ifndef SU_TYPES_H
#include <sofia-sip/su_types.h>
#endif
SOFIA_BEGIN_DECLS
typedef struct msg_accept_any_s msg_accept_any_t;
typedef struct msg_accept_s msg_accept_t;
typedef msg_accept_any_t msg_accept_charset_t;
typedef msg_accept_any_t msg_accept_encoding_t;
typedef msg_accept_any_t msg_accept_language_t;
typedef struct msg_content_disposition_s
msg_content_disposition_t;
typedef msg_list_t msg_content_encoding_t;
typedef msg_generic_t msg_content_id_t;
typedef struct msg_content_length_s msg_content_length_t;
typedef msg_generic_t msg_content_location_t;
typedef msg_list_t msg_content_language_t;
typedef msg_generic_t msg_content_md5_t;
typedef msg_generic_t msg_content_transfer_encoding_t;
typedef struct msg_content_type_s msg_content_type_t;
typedef msg_generic_t msg_mime_version_t;
typedef struct msg_warning_s msg_warning_t;
typedef struct msg_multipart_s msg_multipart_t;
struct msg_accept_s
{
msg_common_t ac_common[1];
msg_accept_t *ac_next;
char const *ac_type;
char const *ac_subtype;
msg_param_t const *ac_params;
char const *ac_q;
};
struct msg_accept_any_s
{
msg_common_t aa_common[1];
msg_accept_any_t *aa_next;
char const *aa_value;
msg_param_t const *aa_params;
char const *aa_q;
};
struct msg_content_disposition_s
{
msg_common_t cd_common[1];
msg_error_t *cd_next;
char const *cd_type;
msg_param_t const *cd_params;
char const *cd_handling;
unsigned cd_required:1;
unsigned cd_optional:1;
unsigned :0; /* pad */
};
struct msg_content_length_s
{
msg_common_t l_common[1];
msg_error_t *l_next;
unsigned long l_length;
};
struct msg_content_type_s
{
msg_common_t c_common[1];
msg_error_t *c_next;
char const *c_type;
char const *c_subtype;
msg_param_t const *c_params;
};
struct msg_warning_s
{
msg_common_t w_common[1];
msg_warning_t *w_next;
unsigned w_code;
char const *w_host;
char const *w_port;
char const *w_text;
};
struct msg_multipart_s
{
msg_common_t mp_common[1];
msg_multipart_t *mp_next;
/* Preamble for this part */
char *mp_data;
unsigned mp_len;
unsigned mp_flags;
msg_error_t *mp_error;
/* === Headers start here */
msg_content_type_t *mp_content_type;
msg_content_disposition_t *mp_content_disposition;
msg_content_location_t *mp_content_location;
msg_content_id_t *mp_content_id;
msg_content_language_t *mp_content_language;
msg_content_encoding_t *mp_content_encoding;
msg_content_transfer_encoding_t *mp_content_transfer_encoding;
#if 0
/* === Hash headers end here */
/* These MIME headers are here for msg_parser.awk */
msg_accept_t *mp_accept;
msg_accept_charset_t *mp_accept_charset;
msg_accept_encoding_t *mp_accept_encoding;
msg_accept_language_t *mp_accept_language;
msg_mime_version_t *mp_mime_version;
msg_content_md5_t *mp_content_md5;
msg_content_length_t *mp_content_length;
msg_multipart_t *mp_multipart;
msg_warning_t *mp_warning;
#endif
/* === Headers end here */
msg_unknown_t *mp_unknown;
msg_separator_t *mp_separator;
msg_payload_t *mp_payload;
msg_multipart_t *mp_multipart;
msg_payload_t *mp_close_delim;
};
SOFIAPUBFUN msg_multipart_t *msg_multipart_create(su_home_t *home,
char const *content_type,
void const *data,
isize_t dlen);
SOFIAPUBFUN msg_multipart_t *msg_multipart_parse(su_home_t *home,
msg_content_type_t const *c,
msg_payload_t *pl);
SOFIAPUBFUN int msg_multipart_complete(su_home_t *home,
msg_content_type_t *c,
msg_multipart_t *mp);
SOFIAPUBFUN msg_header_t *msg_multipart_serialize(msg_header_t **head0,
msg_multipart_t *mp);
SOFIAPUBFUN issize_t msg_multipart_prepare(msg_t *msg,
msg_multipart_t *mp,
int flags);
SOFIAPUBFUN isize_t msg_accept_any_dup_xtra(msg_header_t const *h,
isize_t offset);
SOFIAPUBFUN char *msg_accept_any_dup_one(msg_header_t *dst,
msg_header_t const *src,
char *b, isize_t xtra);
SOFIAPUBFUN msg_content_length_t *msg_content_length_create(su_home_t *,
uint32_t n);
SOFIAPUBFUN unsigned msg_q_value(char const *q);
SOFIAPUBFUN msg_accept_t *msg_accept_match(msg_accept_t const *,
msg_content_type_t const *);
#define MSG_MULTIPART_VERSION_CURRENT msg_mime_version_1_0
SOFIAPUBVAR char const msg_mime_version_1_0[];
#define MSG_MULTIPART_PROTOCOL_TAG ((void *)(uintptr_t)0x4d494d45) /* 'MIME' */
SOFIA_END_DECLS
#endif
msg_accept_charset_t
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
msg_accept_encoding_t
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
msg_accept_language_t
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_accept_t
struct msg_accept_s msg_accept_t
The structure msg_accept_t contains representation of an Accept header.
Definition msg_mime.h:54
msg_content_disposition_t
struct msg_content_disposition_s msg_content_disposition_t
The structure msg_content_disposition_t contains representation of an Content-Disposition header.
Definition msg_mime.h:60
msg_content_encoding_t
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_content_id_t
msg_generic_t msg_content_id_t
Content-ID Header Structure.
Definition msg_mime.h:63
msg_content_language_t
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_length_t
struct msg_content_length_s msg_content_length_t
The structure msg_content_length_t contains representation of a Content-Length header.
Definition msg_mime.h:64
msg_content_length_create
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
msg_content_location_t
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
msg_content_md5_t
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
msg_content_transfer_encoding_t
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
struct msg_content_type_s msg_content_type_t
The structure msg_content_type_t contains representation of Content-Type header.
Definition msg_mime.h:69
msg_error_t
struct msg_error_s msg_error_t
Type for erroneous headers.
Definition msg_types.h:94
msg_mime_version_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
msg_payload_t
struct msg_payload_s msg_payload_t
The structure msg_payload_t contains representation of MIME message payload.
Definition msg_types.h:92
msg_separator_t
struct msg_separator_s msg_separator_t
The structure msg_separator_t contains representation of separator line between message headers and b...
Definition msg_types.h:91
msg_unknown_t
struct msg_unknown_s msg_unknown_t
Type for unknown headers.
Definition msg_types.h:93
msg_warning_t
struct msg_warning_s msg_warning_t
The structure msg_warning_t contains representation of an Warning header.
Definition msg_mime.h:71
msg_mime_version_1_0
char const msg_mime_version_1_0[]
Protocol version of MIME.
Definition msg_mime.c:60
msg_multipart_parse
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
msg_multipart_prepare
issize_t msg_multipart_prepare(msg_t *msg, msg_multipart_t *mp, int flags)
Encode a multipart.
Definition msg_mime.c:817
msg_multipart_complete
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_q_value
unsigned msg_q_value(char const *q)
Calculate Q value.
Definition msg_mime.c:943
msg_accept_any_dup_one
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
msg_accept_any_dup_xtra
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
msg_multipart_serialize
msg_header_t * msg_multipart_serialize(msg_header_t **head0, msg_multipart_t *mp)
Serialize a multipart message.
Definition msg_mime.c:687
msg_accept_match
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_multipart_t
struct msg_multipart_s msg_multipart_t
Multipart body object.
Definition msg_mime.h:74
msg_multipart_create
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_types.h
Types for messages and common headers.
msg_header_t
MSG_HDR_T msg_header_t
Any protocol-specific header object.
Definition msg_types.h:87
msg_list_t
struct msg_list_s msg_list_t
Type for token list headers.
Definition msg_types.h:101
msg_t
struct msg_s msg_t
Message object.
Definition msg_types.h:54
msg_common_t
struct msg_common_s msg_common_t
Common part of header.
Definition msg_types.h:89
msg_accept_any_s
Structure for Accept-Charset, Accept-Encoding and Accept-Language headers.
Definition msg_mime.h:94
msg_accept_any_s::aa_q
char const * aa_q
Value of q parameter.
Definition msg_mime.h:99
msg_accept_any_s::aa_value
char const * aa_value
Token.
Definition msg_mime.h:97
msg_accept_any_s::aa_common
msg_common_t aa_common[1]
Common fragment info.
Definition msg_mime.h:95
msg_accept_any_s::aa_params
msg_param_t const * aa_params
List of parameters.
Definition msg_mime.h:98
msg_accept_any_s::aa_next
msg_accept_any_t * aa_next
Pointer to next Accept-* header.
Definition msg_mime.h:96
msg_accept_s
Structure for Accept header.
Definition msg_mime.h:80
msg_accept_s::ac_type
char const * ac_type
Pointer to type/subtype.
Definition msg_mime.h:83
msg_accept_s::ac_q
char const * ac_q
Value of q parameter.
Definition msg_mime.h:86
msg_accept_s::ac_params
msg_param_t const * ac_params
List of parameters.
Definition msg_mime.h:85
msg_accept_s::ac_subtype
char const * ac_subtype
Points after first slash in type.
Definition msg_mime.h:84
msg_accept_s::ac_next
msg_accept_t * ac_next
Pointer to next Accept header.
Definition msg_mime.h:82
msg_accept_s::ac_common
msg_common_t ac_common[1]
Common fragment info.
Definition msg_mime.h:81
msg_content_disposition_s
Structure for Content-Disposition header.
Definition msg_mime.h:106
msg_content_disposition_s::cd_common
msg_common_t cd_common[1]
Common fragment info.
Definition msg_mime.h:107
msg_content_disposition_s::cd_optional
unsigned cd_optional
True if handling=optional.
Definition msg_mime.h:113
msg_content_disposition_s::cd_next
msg_error_t * cd_next
Link to next (dummy).
Definition msg_mime.h:108
msg_content_disposition_s::cd_type
char const * cd_type
Disposition type.
Definition msg_mime.h:109
msg_content_disposition_s::cd_required
unsigned cd_required
True if handling=required.
Definition msg_mime.h:112
msg_content_disposition_s::cd_handling
char const * cd_handling
Value of handling parameter.
Definition msg_mime.h:111
msg_content_disposition_s::cd_params
msg_param_t const * cd_params
List of parameters.
Definition msg_mime.h:110
msg_content_length_s
Structure for Content-Length header.
Definition msg_mime.h:121
msg_content_length_s::l_next
msg_error_t * l_next
Link to next (dummy).
Definition msg_mime.h:123
msg_content_length_s::l_length
unsigned long l_length
Digits.
Definition msg_mime.h:124
msg_content_length_s::l_common
msg_common_t l_common[1]
Common fragment info.
Definition msg_mime.h:122
msg_content_type_s
Structure for Content-Type header.
Definition msg_mime.h:132
msg_content_type_s::c_params
msg_param_t const * c_params
List of parameters.
Definition msg_mime.h:137
msg_content_type_s::c_next
msg_error_t * c_next
Dummy link to next.
Definition msg_mime.h:134
msg_content_type_s::c_common
msg_common_t c_common[1]
Common fragment info.
Definition msg_mime.h:133
msg_content_type_s::c_type
char const * c_type
Pointer to type/subtype.
Definition msg_mime.h:135
msg_content_type_s::c_subtype
char const * c_subtype
Points after first slash in type.
Definition msg_mime.h:136
msg_multipart_s
Structure for a part in MIME multipart message.
Definition msg_mime.h:160
msg_multipart_s::mp_payload
msg_payload_t * mp_payload
Body part.
Definition msg_mime.h:198
msg_multipart_s::mp_len
unsigned mp_len
Length of boundary (mp_data).
Definition msg_mime.h:165
msg_multipart_s::mp_multipart
msg_multipart_t * mp_multipart
Recursive multipart.
Definition msg_mime.h:200
msg_multipart_s::mp_close_delim
msg_payload_t * mp_close_delim
Closing delimiter.
Definition msg_mime.h:202
msg_multipart_s::mp_data
char * mp_data
Boundary string.
Definition msg_mime.h:164
msg_multipart_s::mp_next
msg_multipart_t * mp_next
Next part in multipart body.
Definition msg_mime.h:162
msg_multipart_s::mp_content_type
msg_content_type_t * mp_content_type
Content-Type (c).
Definition msg_mime.h:170
msg_multipart_s::mp_separator
msg_separator_t * mp_separator
Separator.
Definition msg_mime.h:197
msg_multipart_s::mp_content_transfer_encoding
msg_content_transfer_encoding_t * mp_content_transfer_encoding
Content-Transfer-Encoding.
Definition msg_mime.h:177
msg_multipart_s::mp_content_disposition
msg_content_disposition_t * mp_content_disposition
Content-Disposition.
Definition msg_mime.h:171
msg_multipart_s::mp_content_language
msg_content_language_t * mp_content_language
Content-Language.
Definition msg_mime.h:175
msg_multipart_s::mp_content_location
msg_content_location_t * mp_content_location
Content-Location.
Definition msg_mime.h:173
msg_multipart_s::mp_content_encoding
msg_content_encoding_t * mp_content_encoding
Content-Encoding (e).
Definition msg_mime.h:176
msg_multipart_s::mp_common
msg_common_t mp_common[1]
Common fragment information.
Definition msg_mime.h:161
msg_multipart_s::mp_unknown
msg_unknown_t * mp_unknown
Unknown and extra headers.
Definition msg_mime.h:195
msg_multipart_s::mp_content_id
msg_content_id_t * mp_content_id
Content-ID.
Definition msg_mime.h:174
msg_warning_s
Structure for Warning header.
Definition msg_mime.h:145
msg_warning_s::w_common
msg_common_t w_common[1]
Common fragment info.
Definition msg_mime.h:146
msg_warning_s::w_text
char const * w_text
Warning text.
Definition msg_mime.h:151
msg_warning_s::w_port
char const * w_port
Port number.
Definition msg_mime.h:150
msg_warning_s::w_host
char const * w_host
Hostname or pseudonym.
Definition msg_mime.h:149
msg_warning_s::w_code
unsigned w_code
Warning code.
Definition msg_mime.h:148
msg_warning_s::w_next
msg_warning_t * w_next
Link to next Warning header.
Definition msg_mime.h:147
su_home_t
SU_HOME_T su_home_t
SOFIAPUBFUN
#define SOFIAPUBFUN
SOFIAPUBVAR
#define SOFIAPUBVAR
su_types.h
uint32_t
SU_U32_T uint32_t

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