oSIP message API
[The parser modules]


Classes

struct  osip_message
struct  osip_message

Defines

#define SIP_MESSAGE_MAX_LENGTH   4000
#define BODY_MESSAGE_MAX_SIZE   4000
#define MSG_IS_RESPONSE(msg)   ((msg)->status_code!=0)
#define MSG_IS_REQUEST(msg)   ((msg)->status_code==0)
#define MSG_IS_INVITE(msg)
#define MSG_IS_ACK(msg)
#define MSG_IS_REGISTER(msg)
#define MSG_IS_BYE(msg)
#define MSG_IS_OPTIONS(msg)
#define MSG_IS_INFO(msg)
#define MSG_IS_CANCEL(msg)
#define MSG_IS_REFER(msg)
#define MSG_IS_NOTIFY(msg)
#define MSG_IS_SUBSCRIBE(msg)
#define MSG_IS_MESSAGE(msg)
#define MSG_IS_PRACK(msg)
#define MSG_IS_UPDATE(msg)
#define MSG_IS_PUBLISH(msg)
#define MSG_IS_STATUS_1XX(msg)
#define MSG_IS_STATUS_2XX(msg)
#define MSG_IS_STATUS_3XX(msg)
#define MSG_IS_STATUS_4XX(msg)
#define MSG_IS_STATUS_5XX(msg)
#define MSG_IS_STATUS_6XX(msg)
#define MSG_TEST_CODE(msg, code)
#define MSG_IS_RESPONSE_FOR(msg, requestname)
#define osip_generic_param_init(GP)   osip_uri_param_init(GP)
#define osip_generic_param_free(GP)   osip_uri_param_free(GP)
#define osip_generic_param_set(GP, NAME, VALUE)   osip_uri_param_set(GP, NAME, VALUE)
#define osip_generic_param_clone   osip_uri_param_clone
#define osip_generic_param_add(LIST, NAME, VALUE)   osip_uri_param_add(LIST,NAME,VALUE)
#define osip_generic_param_get_byname(LIST, NAME, DEST)   osip_uri_param_get_byname(LIST,NAME,DEST)

Typedefs

typedef struct osip_message osip_message_t

Functions

int osip_message_init (osip_message_t **sip)
void osip_message_free (osip_message_t *sip)
int osip_message_parse (osip_message_t *sip, const char *buf, size_t length)
int osip_message_parse_sipfrag (osip_message_t *sip, const char *buf, size_t length)
int osip_message_to_str (osip_message_t *sip, char **dest, size_t *message_length)
int osip_message_to_str_sipfrag (osip_message_t *sip, char **dest, size_t *message_length)
int osip_message_clone (const osip_message_t *sip, osip_message_t **dest)
void osip_message_set_reason_phrase (osip_message_t *sip, char *reason)
char * osip_message_get_reason_phrase (const osip_message_t *sip)
void osip_message_set_status_code (osip_message_t *sip, int statuscode)
int osip_message_get_status_code (const osip_message_t *sip)
void osip_message_set_method (osip_message_t *sip, char *method)
char * osip_message_get_method (const osip_message_t *sip)
void osip_message_set_version (osip_message_t *sip, char *version)
char * osip_message_get_version (const osip_message_t *sip)
void osip_message_set_uri (osip_message_t *sip, osip_uri_t *uri)
osip_uri_tosip_message_get_uri (const osip_message_t *sip)
void osip_generic_param_set_name (osip_generic_param_t *generic_param, char *name)
char * osip_generic_param_get_name (const osip_generic_param_t *generic_param)
void osip_generic_param_set_value (osip_generic_param_t *generic_param, char *value)
char * osip_generic_param_get_value (const osip_generic_param_t *generic_param)
int osip_message_get_knownheaderlist (osip_list_t *header_list, int pos, void **dest)

Define Documentation

#define BODY_MESSAGE_MAX_SIZE   4000

You can define the maximum length for a body inside a SIP message.

#define MSG_IS_ACK ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"ACK"))
Test if the message is an ACK REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_BYE ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"BYE"))
Test if the message is a BYE REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_CANCEL ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"CANCEL"))
Test if the message is a CANCEL REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_INFO ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"INFO"))
Test if the message is an INFO REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_INVITE ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"INVITE"))
Test if the message is an INVITE REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_MESSAGE ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"MESSAGE"))
Test if the message is a MESSAGE REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_NOTIFY ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"NOTIFY"))
Test if the message is a NOTIFY REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_OPTIONS ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"OPTIONS"))
Test if the message is an OPTIONS REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_PRACK ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"PRACK"))
Test if the message is a PRACK REQUEST (!! PRACK IS NOT SUPPORTED by the fsm!!)
Parameters:
msg the SIP message.

#define MSG_IS_PUBLISH ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"PUBLISH"))
Test if the message is an UPDATE REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_REFER ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"REFER"))
Test if the message is a REFER REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_REGISTER ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"REGISTER"))
Test if the message is a REGISTER REQUEST
Parameters:
msg the SIP message.

#define MSG_IS_REQUEST ( msg   )     ((msg)->status_code==0)

Test if the message is a SIP REQUEST

Parameters:
msg the SIP message.

#define MSG_IS_RESPONSE ( msg   )     ((msg)->status_code!=0)

Test if the message is a SIP RESPONSE

Parameters:
msg the SIP message.

#define MSG_IS_RESPONSE_FOR ( msg,
requestname   ) 

Value:

(MSG_IS_RESPONSE(msg) && \
                                 0==strcmp((msg)->cseq->method,(requestname)))
Test if the message is a response for a REQUEST of certain type
Parameters:
msg the SIP message.
requestname the method name to match.

#define MSG_IS_STATUS_1XX ( msg   ) 

Value:

((msg)->status_code >= 100 && \
                                (msg)->status_code < 200)
Test if the message is a response with status between 100 and 199
Parameters:
msg the SIP message.

#define MSG_IS_STATUS_2XX ( msg   ) 

Value:

((msg)->status_code >= 200 && \
                                (msg)->status_code < 300)
Test if the message is a response with status between 200 and 299
Parameters:
msg the SIP message.

#define MSG_IS_STATUS_3XX ( msg   ) 

Value:

((msg)->status_code >= 300 && \
                                (msg)->status_code < 400)
Test if the message is a response with status between 300 and 399
Parameters:
msg the SIP message.

#define MSG_IS_STATUS_4XX ( msg   ) 

Value:

((msg)->status_code >= 400 && \
                                (msg)->status_code < 500)
Test if the message is a response with status between 400 and 499
Parameters:
msg the SIP message.

#define MSG_IS_STATUS_5XX ( msg   ) 

Value:

((msg)->status_code >= 500 && \
                                (msg)->status_code < 600)
Test if the message is a response with status between 500 and 599
Parameters:
msg the SIP message.

#define MSG_IS_STATUS_6XX ( msg   ) 

Value:

((msg)->status_code >= 600 && \
                                (msg)->status_code < 700)
Test if the message is a response with status between 600 and 699
Parameters:
msg the SIP message.

#define MSG_IS_SUBSCRIBE ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"SUBSCRIBE"))
Test if the message is a SUBSCRIBE REQUEST

Parameters:
msg the SIP message.

#define MSG_IS_UPDATE ( msg   ) 

Value:

(MSG_IS_REQUEST(msg) && \
                              0==strcmp((msg)->sip_method,"UPDATE"))
Test if the message is an UPDATE REQUEST
Parameters:
msg the SIP message.

#define MSG_TEST_CODE ( msg,
code   ) 

Value:

(MSG_IS_RESPONSE(msg) && \
                                 (code)==(msg)->status_code)
Test if the message is a response with a status set to the code value.
Parameters:
msg the SIP message.
code the status code.

#define osip_generic_param_add ( LIST,
NAME,
VALUE   )     osip_uri_param_add(LIST,NAME,VALUE)

Allocate and add a generic parameter element in a list.

Parameters:
LIST The list of generic parameter element to work on.
NAME The token name.
VALUE The token value.

#define osip_generic_param_clone   osip_uri_param_clone

Clone a generic parameter element.

Parameters:
GP The element to work on.
DEST The resulting new allocated buffer.

#define osip_generic_param_free ( GP   )     osip_uri_param_free(GP)

Free a generic parameter element.

Parameters:
GP The element to work on.

#define osip_generic_param_get_byname ( LIST,
NAME,
DEST   )     osip_uri_param_get_byname(LIST,NAME,DEST)

Find in a generic parameter element in a list.

Parameters:
LIST The list of generic parameter element to work on.
NAME The name of the parameter element to find.
DEST A pointer on the element found.

#define osip_generic_param_init ( GP   )     osip_uri_param_init(GP)

Allocate a generic parameter element.

Parameters:
GP The element to work on.

#define osip_generic_param_set ( GP,
NAME,
VALUE   )     osip_uri_param_set(GP, NAME, VALUE)

Set values of a generic parameter element.

Parameters:
GP The element to work on.
NAME The token name.
VALUE The token value.

#define SIP_MESSAGE_MAX_LENGTH   4000

You can re-define your own maximum length for SIP message.


Typedef Documentation

osip_message_t

Structure for SIP Message (REQUEST and RESPONSE).


Function Documentation

char* osip_generic_param_get_name ( const osip_generic_param_t generic_param  ) 

Get the name of a generic parameter element.

Parameters:
generic_param The element to work on.

char* osip_generic_param_get_value ( const osip_generic_param_t generic_param  ) 

Get the value of a generic parameter element.

Parameters:
generic_param The element to work on.

void osip_generic_param_set_name ( osip_generic_param_t generic_param,
char *  name 
)

Set the name of a generic parameter element.

Parameters:
generic_param The element to work on.
name the token name to set.

void osip_generic_param_set_value ( osip_generic_param_t generic_param,
char *  value 
)

Set the value of a generic parameter element.

Parameters:
generic_param The element to work on.
value the token name to set.

int osip_message_clone ( const osip_message_t sip,
osip_message_t **  dest 
)

Clone a osip_message_t element.

Parameters:
sip The element to clone.
dest The new allocated element cloned.

void osip_message_free ( osip_message_t sip  ) 

Free all resource in a osip_message_t element.

Parameters:
sip The element to free.

int osip_message_get_knownheaderlist ( osip_list_t header_list,
int  pos,
void **  dest 
)

Get the a known header from a list of known header.

Parameters:
header_list The element to work on.
pos The index of the element to get.
dest A pointer on the header found.

char* osip_message_get_method ( const osip_message_t sip  ) 

Get the method name.

Parameters:
sip The element to work on.

char* osip_message_get_reason_phrase ( const osip_message_t sip  ) 

Get the reason phrase. This is entirely free in SIP.

Parameters:
sip The element to work on.

int osip_message_get_status_code ( const osip_message_t sip  ) 

Get the status code.

Parameters:
sip The element to work on.

osip_uri_t* osip_message_get_uri ( const osip_message_t sip  ) 

Get the Request-URI.

Parameters:
sip The element to work on.

char* osip_message_get_version ( const osip_message_t sip  ) 

Get the SIP version.

Parameters:
sip The element to work on.

int osip_message_init ( osip_message_t **  sip  ) 

Allocate a osip_message_t element.

Parameters:
sip The element to allocate.

int osip_message_parse ( osip_message_t sip,
const char *  buf,
size_t  length 
)

Parse a osip_message_t element.

Parameters:
sip The resulting element.
buf The buffer to parse.
length The length of the buffer to parse.

int osip_message_parse_sipfrag ( osip_message_t sip,
const char *  buf,
size_t  length 
)

Parse a message/sipfrag part and store it in an osip_message_t element.

Parameters:
sip The resulting element.
buf The buffer to parse.
length The length of the buffer to parse.

void osip_message_set_method ( osip_message_t sip,
char *  method 
)

Set the method. You can set any string here.

Parameters:
sip The element to work on.
method The method name.

void osip_message_set_reason_phrase ( osip_message_t sip,
char *  reason 
)

Set the reason phrase. This is entirely free in SIP.

Parameters:
sip The element to work on.
reason The reason phrase.

void osip_message_set_status_code ( osip_message_t sip,
int  statuscode 
)

Set the status code. This is entirely free in SIP.

Parameters:
sip The element to work on.
statuscode The status code.

void osip_message_set_uri ( osip_message_t sip,
osip_uri_t uri 
)

Set the Request-URI.

Parameters:
sip The element to work on.
uri The uri to set.

void osip_message_set_version ( osip_message_t sip,
char *  version 
)

Set the SIP version used. (default is "SIP/2.0")

Parameters:
sip The element to work on.
version The version of SIP.

int osip_message_to_str ( osip_message_t sip,
char **  dest,
size_t *  message_length 
)

Get a string representation of a osip_message_t element.

Parameters:
sip The element to work on.
dest new allocated buffer returned.
message_length The length of the returned buffer.

int osip_message_to_str_sipfrag ( osip_message_t sip,
char **  dest,
size_t *  message_length 
)

Get a string representation of a message/sipfrag part stored in an osip_message_t element.

Parameters:
sip The element to work on.
dest new allocated buffer returned.
message_length The length of the returned buffer.


Generated on Wed Feb 13 01:03:29 2008 for libosip by  doxygen 1.5.4