BLOG | DOCUMENTATION | GITHUB

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_multipart_partpjsip_multipart_find_part_by_header (pj_pool_t *pool, const pjsip_msg_body *mp, void *search_hdr, const pjsip_multipart_part *start)
 
pjsip_multipart_partpjsip_multipart_find_part_by_header_str (pj_pool_t *pool, const pjsip_msg_body *mp, const pj_str_t *hdr_name, const pj_str_t *hdr_value, const pjsip_multipart_part *start)
 
pjsip_multipart_partpjsip_multipart_find_part_by_cid_str (pj_pool_t *pool, const pjsip_msg_body *mp, pj_str_t *cid)
 
pjsip_multipart_partpjsip_multipart_find_part_by_cid_uri (pj_pool_t *pool, const pjsip_msg_body *mp, pjsip_other_uri *cid)
 
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_find_part_by_header()

pjsip_multipart_part * pjsip_multipart_find_part_by_header ( pj_pool_t pool,
const pjsip_msg_body mp,
void *  search_hdr,
const pjsip_multipart_part start 
)

Find a body inside multipart bodies which has a header matching the supplied one. Most useful for finding a part with a specific Content-ID.

Parameters
poolMemory pool to use for temp space.
mpThe multipart body.
search_hdrHeader to search for.
startIf specified, the search will begin at start->next part. Otherwise it will begin at the first part in the multipart bodies.
Returns
The first part which has a header matching the specified one, or NULL if not found.

◆ pjsip_multipart_find_part_by_header_str()

pjsip_multipart_part * pjsip_multipart_find_part_by_header_str ( pj_pool_t pool,
const pjsip_msg_body mp,
const pj_str_t hdr_name,
const pj_str_t hdr_value,
const pjsip_multipart_part start 
)

Find a body inside multipart bodies which has a header matching the supplied name and value. Most useful for finding a part with a specific Content-ID.

Parameters
poolMemory pool to use for temp space.
mpThe multipart body.
hdr_nameHeader name to search for.
hdr_valueHeader value search for.
startIf specified, the search will begin at start->next part. Otherwise it will begin at the first part in the multipart bodies.
Returns
The first part which has a header matching the specified one, or NULL if not found.

◆ pjsip_multipart_find_part_by_cid_str()

pjsip_multipart_part * pjsip_multipart_find_part_by_cid_str ( pj_pool_t pool,
const pjsip_msg_body mp,
pj_str_t cid 
)

Find a body inside multipart bodies which has a Content-ID value matching the supplied "cid" URI in pj_str form. The "cid:" scheme will be assumed if the URL doesn't start with it. Enclosing angle brackets will also be handled correctly if they exist.

See also
RFC2392 Content-ID and Message-ID Uniform Resource Locators
Parameters
poolMemory pool to use for temp space.
mpThe multipart body.
cidThe "cid" URI to search for in pj_str form.
Returns
The first part which has a Content-ID header matching the specified "cid" URI. or NULL if not found.

◆ pjsip_multipart_find_part_by_cid_uri()

pjsip_multipart_part * pjsip_multipart_find_part_by_cid_uri ( pj_pool_t pool,
const pjsip_msg_body mp,
pjsip_other_uri cid 
)

Find a body inside multipart bodies which has a Content-ID value matching the supplied "cid" URI.

See also
RFC2392 Content-ID and Message-ID Uniform Resource Locators
Parameters
poolMemory pool to use for temp space.
mpThe multipart body.
cidThe "cid" URI to search for.
Returns
The first part which had a Content-ID header matching the specified "cid" URI. or NULL if not found.

◆ 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.