sofia-sip/msg_mime.h File Reference


Detailed Description

MIME headers and multipart messages (RFC 2045).

Author:
Pekka Pessi <Pekka.Pessi@nokia-email.address.hidden>
Date:
Created: Fri Aug 16 19:18:26 EEST 2002 ppessi

#include <sofia-sip/url.h>
#include <sofia-sip/su_types.h>
#include <sofia-sip/msg_types.h>

Include dependency graph for msg_mime.h:

Go to the source code of this file.

Data Structures

struct  msg_accept_s
 Structure for Accept header. More...
struct  msg_accept_any_s
 Structure for Accept-Charset, Accept-Encoding and Accept-Language headers. More...
struct  msg_content_disposition_s
 Structure for Content-Disposition header. More...
struct  msg_content_length_s
 Structure for Content-Length header. More...
struct  msg_content_type_s
 Structure for Content-Type header. More...
struct  msg_warning_s
 Structure for Warning header. More...
struct  msg_multipart_s
 Structure for a part in MIME multipart message. More...

Defines

#define MSG_MULTIPART_VERSION_CURRENT
 MIME multipart protocol name.
#define MSG_MULTIPART_PROTOCOL_TAG
 MIME multipart parser table identifier.

Typedefs

typedef msg_accept_s msg_accept_t
 The structure msg_accept_t contains representation of an Accept header.
typedef msg_accept_any_t msg_accept_charset_t
 The structure msg_accept_encoding_t contains representation of Accept-Charset header.
typedef msg_accept_any_t msg_accept_encoding_t
 The structure msg_accept_encoding_t contains representation of Accept-Encoding header.
typedef msg_accept_any_t msg_accept_language_t
 The structure msg_accept_language_t contains representation of Accept-Language header.
typedef msg_content_disposition_s msg_content_disposition_t
 The structure msg_content_disposition_t contains representation of an Content-Disposition header.
typedef msg_list_t msg_content_encoding_t
 The structure msg_content_encoding_t contains representation of an Content-Encoding header.
typedef msg_generic_t msg_content_id_t
 Content-ID Header Structure.
typedef msg_content_length_s msg_content_length_t
 The structure msg_content_length_t contains representation of a Content-Length header.
typedef msg_generic_t msg_content_location_t
 The structure msg_content_location_t contains representation of an Content-Location header.
typedef msg_list_t msg_content_language_t
 The structure msg_content_language_t contains representation of Content-Language header.
typedef msg_generic_t msg_content_md5_t
 The structure msg_content_md5_t contains representation of an Content-MD5 header.
typedef msg_generic_t msg_content_transfer_encoding_t
 The structure msg_content_transfer_encoding_t contains representation of an Content-Transfer-Encoding header.
typedef msg_content_type_s msg_content_type_t
 The structure msg_content_type_t contains representation of Content-Type header.
typedef msg_generic_t msg_mime_version_t
 The structure msg_mime_version_t contains representation of an MIME-Version header.
typedef msg_warning_s msg_warning_t
 The structure msg_warning_t contains representation of an Warning header.
typedef msg_multipart_s msg_multipart_t
 Multipart body object.

Functions

SOFIAPUBFUN msg_multipart_tmsg_multipart_create (su_home_t *home, char const *content_type, void const *data, int dlen)
 Create a part for MIME multipart entity.
SOFIAPUBFUN msg_multipart_tmsg_multipart_parse (su_home_t *home, msg_content_type_t const *c, msg_payload_t *pl)
 Parse a MIME multipart.
SOFIAPUBFUN int msg_multipart_complete (su_home_t *home, msg_content_type_t *c, msg_multipart_t *mp)
 Add all missing parts to the multipart.
SOFIAPUBFUN msg_header_tmsg_multipart_serialize (msg_header_t **head0, msg_multipart_t *mp)
 Serialize a multipart message.
SOFIAPUBFUN int msg_multipart_prepare (msg_t *msg, msg_multipart_t *mp, int flags)
 Encode a multipart.
SOFIAPUBFUN msg_content_length_tmsg_content_length_create (su_home_t *home, uint32_t n)
  Create a Content-Length header object.


Function Documentation

SOFIAPUBFUN int msg_multipart_complete ( su_home_t home,
msg_content_type_t c,
msg_multipart_t mp 
)

Add all missing parts to the multipart.

The function msg_multipart_complete() adds missing components to the multipart message. The missing components may include boundaries between body parts, separators between body-part headers and data, and close-delimiter after last body-part.

Parameters:
home home for allocating structures [IN/OUT]
c content-type header for multipart [IN/OUT]
mp pointer to first multipart structure [IN/OUT]
Returns:
The function msg_multipart_complete() returns 0 when successful, -1 upon an error.
Errors:
EBADMSG The Content-Type header c is malformed, or multipart message contains a malformed Content-Type header.
ENOMEM A memory allocation failed.
EINVAL The function msg_multipart_complete() was given invalid arguments.

SOFIAPUBFUN msg_multipart_t* msg_multipart_create ( su_home_t home,
char const *  content_type,
void const *  data,
int  dlen 
)

Create a part for MIME multipart entity.

The function msg_multipart_create() allocates a new msg_multipart_t object from memory home home. If content_type is non-NULL, it makes a msg_content_type_t header object and adds the header to the msg_multipart_t object. If dlen is nonzero, it allocates a msg_payload_t structure of dlen bytes for the payload of the newly created msg_multipart_t object. If data is non-NULL, it copies the dlen bytes of of data to the payload of the newly created msg_multipart_t object.

Returns:
A pointer to the newly created msg_multipart_t object, or NULL upon an error.

SOFIAPUBFUN msg_multipart_t* msg_multipart_parse ( su_home_t home,
msg_content_type_t const *  c,
msg_payload_t pl 
)

Parse a MIME multipart.

The function msg_multipart_parse() parses a MIME multipart message. The common syntax of multiparts is described in RFC 2046 (section 7).

Parameters:
home home for allocating structures [IN/OUT]
c content-type header for multipart [IN]
pl payload structure for multipart [IN]
After parsing, the pl will contain the plain-text preamble (if any).

Note:
If no Content-Type header is given, the msg_multipart_parse() tries to look for a suitable boundary. Currently, it takes first boundary-looking string and uses that, so it can be fooled with, for instance, signature "--Pekka".

SOFIAPUBFUN int msg_multipart_prepare ( msg_t msg,
msg_multipart_t mp,
int  flags 
)

Encode a multipart.

Returns:
The size of multipart in bytes, or -1 upon an error.


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