BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJSIP Reference

Multipart message bodies.
[Messaging Elements]

Support for multipart message bodies.

Data Structures

struct  pjsip_multipart_part

Functions

pjsip_msg_bodypjsip_multipart_create (pj_pool_t *pool, const pjsip_media_type *ctype, const pj_str_t *boundary)
pjsip_multipart_partpjsip_multipart_create_part (pj_pool_t *pool)
pjsip_multipart_partpjsip_multipart_clone_part (pj_pool_t *pool, const pjsip_multipart_part *part)
pj_status_t pjsip_multipart_add_part (pj_pool_t *pool, pjsip_msg_body *mp, pjsip_multipart_part *part)
pjsip_multipart_partpjsip_multipart_get_first_part (const pjsip_msg_body *mp)
pjsip_multipart_partpjsip_multipart_get_next_part (const pjsip_msg_body *mp, pjsip_multipart_part *part)
pjsip_multipart_partpjsip_multipart_find_part (const pjsip_msg_body *mp, const pjsip_media_type *content_type, const pjsip_multipart_part *start)
pjsip_msg_bodypjsip_multipart_parse (pj_pool_t *pool, char *buf, pj_size_t len, const pjsip_media_type *ctype, unsigned options)

Function Documentation

pjsip_msg_body* pjsip_multipart_create ( pj_pool_t pool,
const pjsip_media_type ctype,
const pj_str_t boundary 
)

Create an empty multipart body.

Parameters:
pool Memory pool to allocate memory from.
ctype Optional MIME media type of the multipart bodies. If not specified, "multipart/mixed" will be used.
boundary Optional string to be set as part boundary. The boundary string excludes the leading hyphens. If this parameter is NULL or empty, a random boundary will be generated.
Returns:
Multipart body instance with no part.
pjsip_multipart_part* pjsip_multipart_create_part ( pj_pool_t pool  ) 

Create an empty multipart part.

Parameters:
pool The memory pool.
Returns:
The multipart part.
pjsip_multipart_part* pjsip_multipart_clone_part ( pj_pool_t pool,
const pjsip_multipart_part part 
)

Perform a deep clone to a multipart part.

Parameters:
pool The memory pool.
part The part to be duplicated.
Returns:
Copy of the multipart part.
pj_status_t pjsip_multipart_add_part ( pj_pool_t pool,
pjsip_msg_body mp,
pjsip_multipart_part part 
)

Add a part into multipart bodies.

Parameters:
pool The memory pool.
mp The multipart bodies.
part The part to be added into the bodies.
Returns:
PJ_SUCCESS on success.
pjsip_multipart_part* pjsip_multipart_get_first_part ( const pjsip_msg_body mp  ) 

Get the first part of multipart bodies.

Parameters:
mp The multipart bodies.
Returns:
The first part, or NULL if the multipart bodies currently doesn't hold any elements.
pjsip_multipart_part* pjsip_multipart_get_next_part ( const pjsip_msg_body mp,
pjsip_multipart_part part 
)

Get the next part after the specified part.

Parameters:
mp The multipart bodies.
part The part.
Returns:
The next part, or NULL if there is no other part after the part.
pjsip_multipart_part* pjsip_multipart_find_part ( const pjsip_msg_body mp,
const pjsip_media_type content_type,
const pjsip_multipart_part start 
)

Find a body inside multipart bodies which has the specified content type.

Parameters:
mp The multipart body.
content_type Content type to find.
start If specified, the search will begin at start->next. Otherwise it will begin at the first part in the multipart bodies.
Returns:
The first part with the specified content type if found, or NULL.
pjsip_msg_body* pjsip_multipart_parse ( pj_pool_t pool,
char *  buf,
pj_size_t  len,
const pjsip_media_type ctype,
unsigned  options 
)

Parse multipart message.

Parameters:
pool Memory pool.
buf Input buffer.
len The buffer length.
ctype Content type of the multipart body.
options Parsing options, must be zero for now.
Returns:
Multipart message body.

 


PJSIP Open Source, high performance, small footprint, and very very portable SIP stack
Copyright (C) 2006-2008 Teluu Inc.