libosip  5.3.0
Classes | Typedefs | Functions
oSIP body API

Classes

struct  osip_body
 

Typedefs

typedef struct osip_body osip_body_t
 

Functions

int osip_body_init (osip_body_t **body)
 
void osip_body_free (osip_body_t *body)
 
int osip_body_parse (osip_body_t *body, const char *buf, size_t length)
 
int osip_body_clone (const osip_body_t *body, osip_body_t **dest)
 
int osip_body_parse_mime (osip_body_t *body, const char *buf, size_t length)
 
int osip_body_to_str (const osip_body_t *body, char **dest, size_t *length)
 
int osip_body_set_contenttype (osip_body_t *body, const char *hvalue)
 
int osip_body_set_header (osip_body_t *body, const char *hname, const char *hvalue)
 

Detailed Description

Typedef Documentation

◆ osip_body_t

Structure for holding Body

Function Documentation

◆ osip_body_clone()

int osip_body_clone ( const osip_body_t body,
osip_body_t **  dest 
)

Clone a osip_body_t element.

Parameters
bodyThe element to clone.
destThe cloned element.

References osip_body::body, osip_body::content_type, osip_body::headers, osip_body::length, osip_body_free(), osip_body_init(), osip_content_type_clone(), osip_header_clone(), and osip_list_clone().

Referenced by osip_message_clone().

◆ osip_body_free()

void osip_body_free ( osip_body_t body)

◆ osip_body_init()

int osip_body_init ( osip_body_t **  body)

Allocate a osip_body_t element.

Parameters
bodyThe element to work on.

References osip_list_init().

Referenced by osip_body_clone(), osip_message_set_body(), and osip_message_set_body_mime().

◆ osip_body_parse()

int osip_body_parse ( osip_body_t body,
const char *  buf,
size_t  length 
)

Parse a osip_body_t element.

Parameters
bodyThe element to work on.
bufThe buffer to parse.
lengthThe length of the buffer to parse.

References osip_body::body, osip_body::headers, and osip_body::length.

Referenced by osip_message_set_body().

◆ osip_body_parse_mime()

int osip_body_parse_mime ( osip_body_t body,
const char *  buf,
size_t  length 
)

Parse a osip_body_t element. (for mime message format) (NOT TESTED, use with care)

Parameters
bodyThe element to work on.
bufThe buffer to parse.
lengthThe length of the buffer to parse.

References osip_body::body, osip_body::headers, and osip_body::length.

Referenced by osip_message_set_body_mime().

◆ osip_body_set_contenttype()

int osip_body_set_contenttype ( osip_body_t body,
const char *  hvalue 
)

Set the Content-Type header in the osip_body_t element.

Parameters
bodyThe element to work on.
hvalueThe content type string value.

References osip_body::content_type, osip_content_type_free(), osip_content_type_init(), and osip_content_type_parse().

◆ osip_body_set_header()

int osip_body_set_header ( osip_body_t body,
const char *  hname,
const char *  hvalue 
)

Add a header in the osip_body_t element.

Parameters
bodyThe element to work on.
hnameThe header string name.
hvalueThe header string value.

References osip_body::headers, osip_header::hname, osip_header::hvalue, osip_header_free(), osip_header_init(), and osip_list_add().

◆ osip_body_to_str()

int osip_body_to_str ( const osip_body_t body,
char **  dest,
size_t *  length 
)

Get a string representation of a osip_body_t element.

Parameters
bodyThe element to work on.
destThe resulting buffer.
lengthThe length of the returned buffer.

References osip_body::body, osip_body::content_type, osip_body::headers, osip_body::length, osip_content_type_to_str(), osip_header_to_str(), osip_list_get_first(), osip_list_get_next(), and osip_list_size().