BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJSIP Reference

Support for multipart message bodies. More...

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)
 
pj_status_t pjsip_multipart_get_raw (pjsip_msg_body *mp, pj_str_t *boundary, pj_str_t *raw_data)
 

Detailed Description

Function Documentation

◆ pjsip_multipart_create()

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
poolMemory pool to allocate memory from.
ctypeOptional MIME media type of the multipart bodies. If not specified, "multipart/mixed" will be used.
boundaryOptional 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_create_part()

pjsip_multipart_part* pjsip_multipart_create_part ( pj_pool_t pool)

Create an empty multipart part.

Parameters
poolThe memory pool.
Returns
The multipart part.

◆ pjsip_multipart_clone_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
poolThe memory pool.
partThe part to be duplicated.
Returns
Copy of the multipart part.

◆ pjsip_multipart_add_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
poolThe memory pool.
mpThe multipart bodies.
partThe part to be added into the bodies.
Returns
PJ_SUCCESS on success.

◆ pjsip_multipart_get_first_part()

pjsip_multipart_part* pjsip_multipart_get_first_part ( const pjsip_msg_body mp)

Get the first part of multipart bodies.

Parameters
mpThe multipart bodies.
Returns
The first part, or NULL if the multipart bodies currently doesn't hold any elements.

◆ pjsip_multipart_get_next_part()

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
mpThe multipart bodies.
partThe part.
Returns
The next part, or NULL if there is no other part after the part.

◆ pjsip_multipart_find_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
mpThe multipart body.
content_typeContent type to find.
startIf 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_multipart_parse()

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
poolMemory pool.
bufInput buffer.
lenThe buffer length.
ctypeContent type of the multipart body.
optionsParsing options, must be zero for now.
Returns
Multipart message body.

◆ pjsip_multipart_get_raw()

pj_status_t pjsip_multipart_get_raw ( pjsip_msg_body mp,
pj_str_t boundary,
pj_str_t raw_data 
)

Get the boundary string and the raw message body of the specified multipart message body. Note that raw message body will only be available if the multipart message body is generated by pjsip_multipart_parse().

Parameters
mpThe multipart message body.
boundaryOptional parameter to receive the boundary string.
raw_dataOptional parameter to receive the raw message body.
Returns
PJ_SUCCESS on success.

 


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