SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
oSIP message API

Data Structures

struct  osip_message
 Structure for SIP Message (REQUEST and RESPONSE). More...
 

Macros

#define SIP_MESSAGE_MAX_LENGTH   8000
 You can re-define your own maximum length for SIP message. More...
 
#define BODY_MESSAGE_MAX_SIZE   4000
 You can define the maximum length for a body inside a SIP message. More...
 
#define MSG_IS_RESPONSE(msg)   ((msg)->status_code!=0)
 Test if the message is a SIP RESPONSE. More...
 
#define MSG_IS_REQUEST(msg)   ((msg)->status_code==0)
 Test if the message is a SIP REQUEST. More...
 
#define MSG_IS_INVITE(msg)
 Test if the message is an INVITE REQUEST. More...
 
#define MSG_IS_ACK(msg)
 Test if the message is an ACK REQUEST. More...
 
#define MSG_IS_REGISTER(msg)
 Test if the message is a REGISTER REQUEST. More...
 
#define MSG_IS_BYE(msg)
 Test if the message is a BYE REQUEST. More...
 
#define MSG_IS_OPTIONS(msg)
 Test if the message is an OPTIONS REQUEST. More...
 
#define MSG_IS_INFO(msg)
 Test if the message is an INFO REQUEST. More...
 
#define MSG_IS_CANCEL(msg)
 Test if the message is a CANCEL REQUEST. More...
 
#define MSG_IS_REFER(msg)
 Test if the message is a REFER REQUEST. More...
 
#define MSG_IS_NOTIFY(msg)
 Test if the message is a NOTIFY REQUEST. More...
 
#define MSG_IS_SUBSCRIBE(msg)
 Test if the message is a SUBSCRIBE REQUEST. More...
 
#define MSG_IS_MESSAGE(msg)
 Test if the message is a MESSAGE REQUEST. More...
 
#define MSG_IS_PRACK(msg)
 Test if the message is a PRACK REQUEST (!! PRACK IS NOT SUPPORTED by the fsm!!) More...
 
#define MSG_IS_UPDATE(msg)
 Test if the message is an UPDATE REQUEST. More...
 
#define MSG_IS_PUBLISH(msg)
 Test if the message is an UPDATE REQUEST. More...
 
#define MSG_IS_STATUS_1XX(msg)
 Test if the message is a response with status between 100 and 199. More...
 
#define MSG_IS_STATUS_2XX(msg)
 Test if the message is a response with status between 200 and 299. More...
 
#define MSG_IS_STATUS_3XX(msg)
 Test if the message is a response with status between 300 and 399. More...
 
#define MSG_IS_STATUS_4XX(msg)
 Test if the message is a response with status between 400 and 499. More...
 
#define MSG_IS_STATUS_5XX(msg)
 Test if the message is a response with status between 500 and 599. More...
 
#define MSG_IS_STATUS_6XX(msg)
 Test if the message is a response with status between 600 and 699. More...
 
#define MSG_TEST_CODE(msg, code)
 Test if the message is a response with a status set to the code value. More...
 
#define MSG_IS_RESPONSE_FOR(msg, requestname)
 Test if the message is a response for a REQUEST of certain type. More...
 
#define osip_generic_param_init(GP)   osip_uri_param_init(GP)
 Allocate a generic parameter element. More...
 
#define osip_generic_param_free(GP)   osip_uri_param_free(GP)
 Free a generic parameter element. More...
 
#define osip_generic_param_set(GP, NAME, VALUE)   osip_uri_param_set(GP, NAME, VALUE)
 Set values of a generic parameter element. More...
 
#define osip_generic_param_clone   osip_uri_param_clone
 Clone a generic parameter element. More...
 
#define osip_generic_param_freelist(LIST)   osip_uri_param_freelist(LIST)
 
#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. More...
 
#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. More...
 

Typedefs

typedef struct osip_message osip_message_t
 Structure for SIP Message (REQUEST and RESPONSE). More...
 

Functions

int osip_message_init (osip_message_t **sip)
 Allocate a osip_message_t element. More...
 
void osip_message_free (osip_message_t *sip)
 Free all resource in a osip_message_t element. More...
 
int osip_message_parse (osip_message_t *sip, const char *buf, size_t length)
 Parse a osip_message_t element. More...
 
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. More...
 
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. More...
 
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. More...
 
int osip_message_clone (const osip_message_t *sip, osip_message_t **dest)
 Clone a osip_message_t element. More...
 
void osip_message_set_reason_phrase (osip_message_t *sip, char *reason)
 Set the reason phrase. More...
 
char * osip_message_get_reason_phrase (const osip_message_t *sip)
 Get the reason phrase. More...
 
void osip_message_set_status_code (osip_message_t *sip, int statuscode)
 Set the status code. More...
 
int osip_message_get_status_code (const osip_message_t *sip)
 Get the status code. More...
 
void osip_message_set_method (osip_message_t *sip, char *method)
 Set the method. More...
 
char * osip_message_get_method (const osip_message_t *sip)
 Get the method name. More...
 
void osip_message_set_version (osip_message_t *sip, char *version)
 Set the SIP version used. More...
 
char * osip_message_get_version (const osip_message_t *sip)
 Get the SIP version. More...
 
void osip_message_set_uri (osip_message_t *sip, osip_uri_t *uri)
 Set the Request-URI. More...
 
osip_uri_tosip_message_get_uri (const osip_message_t *sip)
 Get the Request-URI. More...
 
void osip_generic_param_set_name (osip_generic_param_t *generic_param, char *name)
 Set the name of a generic parameter element. More...
 
char * osip_generic_param_get_name (const osip_generic_param_t *generic_param)
 Get the name of a generic parameter element. More...
 
void osip_generic_param_set_value (osip_generic_param_t *generic_param, char *value)
 Set the value of a generic parameter element. More...
 
char * osip_generic_param_get_value (const osip_generic_param_t *generic_param)
 Get the value of a generic parameter element. More...
 
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. More...
 

Detailed Description

Macro Definition Documentation

#define BODY_MESSAGE_MAX_SIZE   4000

#include <osip_message.h>

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

Definition at line 123 of file osip_message.h.

#define MSG_IS_ACK (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"ACK"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is an ACK REQUEST.

Parameters
msgthe SIP message.

Definition at line 257 of file osip_message.h.

#define MSG_IS_BYE (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"BYE"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is a BYE REQUEST.

Parameters
msgthe SIP message.

Definition at line 269 of file osip_message.h.

#define MSG_IS_CANCEL (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"CANCEL"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is a CANCEL REQUEST.

Parameters
msgthe SIP message.

Definition at line 287 of file osip_message.h.

#define MSG_IS_INFO (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"INFO"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is an INFO REQUEST.

Parameters
msgthe SIP message.

Definition at line 281 of file osip_message.h.

#define MSG_IS_INVITE (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"INVITE"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is an INVITE REQUEST.

Parameters
msgthe SIP message.

Definition at line 251 of file osip_message.h.

#define MSG_IS_MESSAGE (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"MESSAGE"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is a MESSAGE REQUEST.

Parameters
msgthe SIP message.

Definition at line 312 of file osip_message.h.

#define MSG_IS_NOTIFY (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"NOTIFY"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is a NOTIFY REQUEST.

Parameters
msgthe SIP message.

Definition at line 299 of file osip_message.h.

#define MSG_IS_OPTIONS (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"OPTIONS"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is an OPTIONS REQUEST.

Parameters
msgthe SIP message.

Definition at line 275 of file osip_message.h.

#define MSG_IS_PRACK (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"PRACK"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is a PRACK REQUEST (!! PRACK IS NOT SUPPORTED by the fsm!!)

Parameters
msgthe SIP message.

Definition at line 318 of file osip_message.h.

#define MSG_IS_PUBLISH (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"PUBLISH"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is an UPDATE REQUEST.

Parameters
msgthe SIP message.

Definition at line 333 of file osip_message.h.

#define MSG_IS_REFER (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"REFER"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is a REFER REQUEST.

Parameters
msgthe SIP message.

Definition at line 293 of file osip_message.h.

#define MSG_IS_REGISTER (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"REGISTER"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is a REGISTER REQUEST.

Parameters
msgthe SIP message.

Definition at line 263 of file osip_message.h.

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

#include <osip_message.h>

Test if the message is a SIP REQUEST.

Parameters
msgthe SIP message.

Definition at line 245 of file osip_message.h.

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

#include <osip_message.h>

Test if the message is a SIP RESPONSE.

Parameters
msgthe SIP message.

Definition at line 240 of file osip_message.h.

#define MSG_IS_RESPONSE_FOR (   msg,
  requestname 
)

#include <osip_message.h>

Value:
(MSG_IS_RESPONSE(msg) && \
0==strcmp((msg)->cseq->method,(requestname)))
#define MSG_IS_RESPONSE(msg)
Test if the message is a SIP RESPONSE.
Definition: osip_message.h:240

Test if the message is a response for a REQUEST of certain type.

Parameters
msgthe SIP message.
requestnamethe method name to match.

Definition at line 385 of file osip_message.h.

#define MSG_IS_STATUS_1XX (   msg)

#include <osip_message.h>

Value:
((msg)->status_code >= 100 && \
(msg)->status_code < 200)

Test if the message is a response with status between 100 and 199.

Parameters
msgthe SIP message.

Definition at line 341 of file osip_message.h.

#define MSG_IS_STATUS_2XX (   msg)

#include <osip_message.h>

Value:
((msg)->status_code >= 200 && \
(msg)->status_code < 300)

Test if the message is a response with status between 200 and 299.

Parameters
msgthe SIP message.

Definition at line 347 of file osip_message.h.

#define MSG_IS_STATUS_3XX (   msg)

#include <osip_message.h>

Value:
((msg)->status_code >= 300 && \
(msg)->status_code < 400)

Test if the message is a response with status between 300 and 399.

Parameters
msgthe SIP message.

Definition at line 353 of file osip_message.h.

#define MSG_IS_STATUS_4XX (   msg)

#include <osip_message.h>

Value:
((msg)->status_code >= 400 && \
(msg)->status_code < 500)

Test if the message is a response with status between 400 and 499.

Parameters
msgthe SIP message.

Definition at line 359 of file osip_message.h.

#define MSG_IS_STATUS_5XX (   msg)

#include <osip_message.h>

Value:
((msg)->status_code >= 500 && \
(msg)->status_code < 600)

Test if the message is a response with status between 500 and 599.

Parameters
msgthe SIP message.

Definition at line 365 of file osip_message.h.

#define MSG_IS_STATUS_6XX (   msg)

#include <osip_message.h>

Value:
((msg)->status_code >= 600 && \
(msg)->status_code < 700)

Test if the message is a response with status between 600 and 699.

Parameters
msgthe SIP message.

Definition at line 371 of file osip_message.h.

#define MSG_IS_SUBSCRIBE (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"SUBSCRIBE"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is a SUBSCRIBE REQUEST.

Parameters
msgthe SIP message.

Definition at line 306 of file osip_message.h.

#define MSG_IS_UPDATE (   msg)

#include <osip_message.h>

Value:
(MSG_IS_REQUEST(msg) && \
0==strcmp((msg)->sip_method,"UPDATE"))
#define MSG_IS_REQUEST(msg)
Test if the message is a SIP REQUEST.
Definition: osip_message.h:245

Test if the message is an UPDATE REQUEST.

Parameters
msgthe SIP message.

Definition at line 326 of file osip_message.h.

#define MSG_TEST_CODE (   msg,
  code 
)

#include <osip_message.h>

Value:
(MSG_IS_RESPONSE(msg) && \
(code)==(msg)->status_code)
#define MSG_IS_RESPONSE(msg)
Test if the message is a SIP RESPONSE.
Definition: osip_message.h:240

Test if the message is a response with a status set to the code value.

Parameters
msgthe SIP message.
codethe status code.

Definition at line 378 of file osip_message.h.

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

#include <osip_message.h>

Allocate and add a generic parameter element in a list.

Parameters
LISTThe list of generic parameter element to work on.
NAMEThe token name.
VALUEThe token value.

Definition at line 425 of file osip_message.h.

#define osip_generic_param_clone   osip_uri_param_clone

#include <osip_message.h>

Clone a generic parameter element.

Parameters
GPThe element to work on.
DESTThe resulting new allocated buffer.

Definition at line 411 of file osip_message.h.

#define osip_generic_param_free (   GP)    osip_uri_param_free(GP)

#include <osip_message.h>

Free a generic parameter element.

Parameters
GPThe element to work on.

Definition at line 398 of file osip_message.h.

#define osip_generic_param_freelist (   LIST)    osip_uri_param_freelist(LIST)

#include <osip_message.h>

Definition at line 417 of file osip_message.h.

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

#include <osip_message.h>

Find in a generic parameter element in a list.

Parameters
LISTThe list of generic parameter element to work on.
NAMEThe name of the parameter element to find.
DESTA pointer on the element found.

Definition at line 432 of file osip_message.h.

#define osip_generic_param_init (   GP)    osip_uri_param_init(GP)

#include <osip_message.h>

Allocate a generic parameter element.

Parameters
GPThe element to work on.

Definition at line 393 of file osip_message.h.

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

#include <osip_message.h>

Set values of a generic parameter element.

Parameters
GPThe element to work on.
NAMEThe token name.
VALUEThe token value.

Definition at line 405 of file osip_message.h.

#define SIP_MESSAGE_MAX_LENGTH   8000

#include <osip_message.h>

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

Definition at line 116 of file osip_message.h.

Typedef Documentation

#include <osip_message.h>

Structure for SIP Message (REQUEST and RESPONSE).

Definition at line 49 of file osip_message.h.

Function Documentation

char* osip_generic_param_get_name ( const osip_generic_param_t generic_param)

#include <osip_message.h>

Get the name of a generic parameter element.

Parameters
generic_paramThe element to work on.
char* osip_generic_param_get_value ( const osip_generic_param_t generic_param)

#include <osip_message.h>

Get the value of a generic parameter element.

Parameters
generic_paramThe element to work on.
void osip_generic_param_set_name ( osip_generic_param_t generic_param,
char *  name 
)

#include <osip_message.h>

Set the name of a generic parameter element.

Parameters
generic_paramThe element to work on.
namethe token name to set.
void osip_generic_param_set_value ( osip_generic_param_t generic_param,
char *  value 
)

#include <osip_message.h>

Set the value of a generic parameter element.

Parameters
generic_paramThe element to work on.
valuethe token name to set.
int osip_message_clone ( const osip_message_t sip,
osip_message_t **  dest 
)

#include <osip_message.h>

Clone a osip_message_t element.

Parameters
sipThe element to clone.
destThe new allocated element cloned.
void osip_message_free ( osip_message_t sip)

#include <osip_message.h>

Free all resource in a osip_message_t element.

Parameters
sipThe element to free.
int osip_message_get_knownheaderlist ( osip_list_t header_list,
int  pos,
void **  dest 
)

#include <osip_message.h>

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

Parameters
header_listThe element to work on.
posThe index of the element to get.
destA pointer on the header found.
char* osip_message_get_method ( const osip_message_t sip)

#include <osip_message.h>

Get the method name.

Parameters
sipThe element to work on.
char* osip_message_get_reason_phrase ( const osip_message_t sip)

#include <osip_message.h>

Get the reason phrase.

This is entirely free in SIP.

Parameters
sipThe element to work on.
int osip_message_get_status_code ( const osip_message_t sip)

#include <osip_message.h>

Get the status code.

Parameters
sipThe element to work on.
osip_uri_t* osip_message_get_uri ( const osip_message_t sip)

#include <osip_message.h>

Get the Request-URI.

Parameters
sipThe element to work on.
char* osip_message_get_version ( const osip_message_t sip)

#include <osip_message.h>

Get the SIP version.

Parameters
sipThe element to work on.
int osip_message_init ( osip_message_t **  sip)

#include <osip_message.h>

Allocate a osip_message_t element.

Parameters
sipThe element to allocate.
int osip_message_parse ( osip_message_t sip,
const char *  buf,
size_t  length 
)

#include <osip_message.h>

Parse a osip_message_t element.

Parameters
sipThe resulting element.
bufThe buffer to parse.
lengthThe length of the buffer to parse.
int osip_message_parse_sipfrag ( osip_message_t sip,
const char *  buf,
size_t  length 
)

#include <osip_message.h>

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

Parameters
sipThe resulting element.
bufThe buffer to parse.
lengthThe length of the buffer to parse.
void osip_message_set_method ( osip_message_t sip,
char *  method 
)

#include <osip_message.h>

Set the method.

You can set any string here.

Parameters
sipThe element to work on.
methodThe method name.
void osip_message_set_reason_phrase ( osip_message_t sip,
char *  reason 
)

#include <osip_message.h>

Set the reason phrase.

This is entirely free in SIP.

Parameters
sipThe element to work on.
reasonThe reason phrase.
void osip_message_set_status_code ( osip_message_t sip,
int  statuscode 
)

#include <osip_message.h>

Set the status code.

This is entirely free in SIP.

Parameters
sipThe element to work on.
statuscodeThe status code.
void osip_message_set_uri ( osip_message_t sip,
osip_uri_t uri 
)

#include <osip_message.h>

Set the Request-URI.

Parameters
sipThe element to work on.
uriThe uri to set.
void osip_message_set_version ( osip_message_t sip,
char *  version 
)

#include <osip_message.h>

Set the SIP version used.

(default is "SIP/2.0")

Parameters
sipThe element to work on.
versionThe version of SIP.
int osip_message_to_str ( osip_message_t sip,
char **  dest,
size_t *  message_length 
)

#include <osip_message.h>

Get a string representation of a osip_message_t element.

NOTE: You need to release the sip buffer returned by this API when you are done with the buffer. ie: osip_free(dest)

Parameters
sipThe element to work on.
destnew allocated buffer returned.
message_lengthThe length of the returned buffer.
int osip_message_to_str_sipfrag ( osip_message_t sip,
char **  dest,
size_t *  message_length 
)

#include <osip_message.h>

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

NOTE: You need to release the sip buffer returned by this API when you are done with the buffer. ie: osip_free(dest)

Parameters
sipThe element to work on.
destnew allocated buffer returned.
message_lengthThe length of the returned buffer.