BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJSIP Reference

SIP message body structures and manipulation. More...

Data Structures

struct  pjsip_msg_body
 

Functions

int pjsip_print_text_body (pjsip_msg_body *msg_body, char *buf, pj_size_t size)
 
void * pjsip_clone_text_data (pj_pool_t *pool, const void *data, unsigned len)
 
pj_status_t pjsip_msg_body_copy (pj_pool_t *pool, pjsip_msg_body *dst_body, const pjsip_msg_body *src_body)
 
pjsip_msg_bodypjsip_msg_body_clone (pj_pool_t *pool, const pjsip_msg_body *body)
 
pjsip_msg_bodypjsip_msg_body_create (pj_pool_t *pool, const pj_str_t *type, const pj_str_t *subtype, const pj_str_t *text)
 

Detailed Description

Function Documentation

int pjsip_print_text_body ( pjsip_msg_body msg_body,
char *  buf,
pj_size_t  size 
)

General purpose function to textual data in a SIP body. Attach this function in a SIP message body only if the data in pjsip_msg_body is a textual message ready to be embedded in a SIP message. If the data in the message body is not a textual body, then application must supply a custom function to print that body.

Parameters
msg_bodyThe message body.
bufBuffer to copy the message body to.
sizeThe size of the buffer.
Returns
The length copied to the buffer, or -1.
void* pjsip_clone_text_data ( pj_pool_t pool,
const void *  data,
unsigned  len 
)

General purpose function to clone textual data in a SIP body. Attach this function as "clone_data" member of the SIP body only if the data type is a text (i.e. C string, not pj_str_t), and the length indicates the length of the text.

Parameters
poolPool used to clone the data.
dataTextual data.
lenThe length of the string.
Returns
New text duplicated from the original text.
pj_status_t pjsip_msg_body_copy ( pj_pool_t pool,
pjsip_msg_body dst_body,
const pjsip_msg_body src_body 
)

Clone the message body in src_body to the dst_body. This will duplicate the contents of the message body using the clone_data member of the source message body.

Parameters
poolPool to use to duplicate the message body.
dst_bodyDestination message body.
src_bodySource message body to duplicate.
Returns
PJ_SUCCESS on success.
pjsip_msg_body* pjsip_msg_body_clone ( pj_pool_t pool,
const pjsip_msg_body body 
)

Create cloned message body. This will duplicate the contents of the message body using the clone_data member of the source message body.

Parameters
poolPool to use to duplicate the message body.
bodySource message body to duplicate.
Returns
The cloned message body on successfull.
pjsip_msg_body* pjsip_msg_body_create ( pj_pool_t pool,
const pj_str_t type,
const pj_str_t subtype,
const pj_str_t text 
)

Create a text message body. Use this function to create message body when the content is a simple text. For non-text message body (e.g. pjmedia_sdp_session or pj_xml_node), application must construct the message manually.

Parameters
poolPool to allocate message body and its contents.
typeMIME type (e.g. "text").
subtypeMIME subtype (e.g. "plain").
textThe text content to be put in the message body.
Returns
A new message body with the specified Content-Type and text.

 


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