pjsip logo pjsip.org
Open source SIP stack and media stack for presence, im/instant messaging, and multimedia communication
Loading

HOME

SIP/media Features
High Performance SIP
Small Footprint SIP
Symbian Port

FAQ

Documentation

Licensing

Download

Development (Trac)

Projects using pjsip

Mailing List

Open Source Links


About: PJLIB, PJLIB-UTIL, PJSIP, and PJMEDIA are created by: Benny Prijono
<bennylp@pjsip.org>


 

Home --> Documentations --> PJSIP Reference

Message Body
[Messaging Elements]

SIP message body structures and manipulation.

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)

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_body The message body.
buf Buffer to copy the message body to.
size The 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:
pool Pool used to clone the data.
data Textual data.
len The 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:
pool Pool to use to duplicate the message body.
dst_body Destination message body.
src_body Source 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:
pool Pool to use to duplicate the message body.
body Source 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:
pool Pool to allocate message body and its contents.
type MIME type (e.g. "text").
subtype MIME subtype (e.g. "plain").
text The 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.