Update support for PUBLISH (RFC 3903).
This commit is contained in:
parent
3e305cd29c
commit
3bc4d62ba3
|
@ -39,6 +39,11 @@ int tsk_fsm_exec_nothing(va_list *app){ return 1; }
|
|||
int tsk_fsm_cond_always(const void* data1, const void* data2) { return 1; }
|
||||
|
||||
/**@ingroup tsk_fsm_group
|
||||
* Add entries (states) to the FSM.
|
||||
* @param self The FSM.
|
||||
* @param ... One of these helper macros: @b TSK_FSM_ADD_*. MUST end with
|
||||
* @b TSK_FSM_ADD_NULL.
|
||||
* @retval Zero if succeed and non-zero error code otherwise.
|
||||
*/
|
||||
int tsk_fsm_set(tsk_fsm_t* self, ...)
|
||||
{
|
||||
|
@ -70,6 +75,13 @@ int tsk_fsm_set(tsk_fsm_t* self, ...)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**@ingroup tsk_fsm_group
|
||||
* Sets the @a callback function to call when the FSM enter in the final state.
|
||||
* @param self The FSM.
|
||||
* @param callback The callback function to call.
|
||||
* @param callbackdata Opaque data (user-data) to pass to the callback function.
|
||||
* @retval Zero if succeed and non-zero error code otherwise.
|
||||
*/
|
||||
int tsk_fsm_set_callback_terminated(tsk_fsm_t* self, tsk_fsm_onterminated callback, const void* callbackdata)
|
||||
{
|
||||
if(self){
|
||||
|
@ -81,6 +93,13 @@ int tsk_fsm_set_callback_terminated(tsk_fsm_t* self, tsk_fsm_onterminated callba
|
|||
}
|
||||
|
||||
/**@ingroup tsk_fsm_group
|
||||
* Execute an @a action. This action will probably change the current state of the FSM.
|
||||
* @param self The FSM.
|
||||
* @param action The id of the action to execute.
|
||||
* @param cond_data1 The first opaque data to pass to the @a condition function.
|
||||
* @param cond_data2 The first opaque data to pass to the @a condition function.
|
||||
* @param ... Variable parameters to pass to the @a exec function.
|
||||
* @retval Zero if succeed and non-zero error code otherwise.
|
||||
*/
|
||||
int tsk_fsm_act(tsk_fsm_t* self, tsk_fsm_action_id action, const void* cond_data1, const void* cond_data2, ...)
|
||||
{
|
||||
|
|
|
@ -386,8 +386,7 @@ const tsk_list_item_t* tsk_list_find_item_by_pred(const tsk_list_t* list, tsk_li
|
|||
tsk_list_item_t *item;
|
||||
tsk_list_foreach(item, list)
|
||||
{
|
||||
if(!predicate(item, data))
|
||||
{
|
||||
if(!predicate(item, data)){
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ int tsk_params_have_param(const tsk_params_L_t *self, const char* name)
|
|||
}
|
||||
|
||||
/**@ingroup tsk_params_group
|
||||
* Adds a parameter to the list of parameters.
|
||||
* Adds a parameter to the list of parameters. If the parameter already exist, then it's value will be updated.
|
||||
* @param self The destination list.
|
||||
* @param name The name of the parameter to add.
|
||||
* @param value The value of the parameter to add.
|
||||
|
@ -118,8 +118,13 @@ int tsk_params_add_param(tsk_params_L_t **self, const char* name, const char* va
|
|||
*self = TSK_LIST_CREATE();
|
||||
}
|
||||
|
||||
param = TSK_PARAM_CREATE(name, value);
|
||||
tsk_list_push_back_data(*self, (void**)¶m);
|
||||
if((param = (tsk_param_t*)tsk_params_get_param_by_name(*self, name))){
|
||||
tsk_strupdate(¶m->value, value); /* Already exist ==> update the value. */
|
||||
}
|
||||
else{
|
||||
param = TSK_PARAM_CREATE(name, value);
|
||||
tsk_list_push_back_data(*self, (void**)¶m);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -657,8 +657,8 @@
|
|||
<member kind="function">
|
||||
<type>int</type>
|
||||
<name>tsk_fsm_set_callback_terminated</name>
|
||||
<anchorfile>tsk__fsm_8c.html</anchorfile>
|
||||
<anchor>af522979f49aaac6acbf7d5ef5712776f</anchor>
|
||||
<anchorfile>group__tsk__fsm__group.html</anchorfile>
|
||||
<anchor>gaf522979f49aaac6acbf7d5ef5712776f</anchor>
|
||||
<arglist>(tsk_fsm_t *self, tsk_fsm_onterminated callback, const void *callbackdata)</arglist>
|
||||
</member>
|
||||
<member kind="function">
|
||||
|
@ -870,8 +870,8 @@
|
|||
<member kind="function">
|
||||
<type>TINYSAK_API int</type>
|
||||
<name>tsk_fsm_set_callback_terminated</name>
|
||||
<anchorfile>tsk__fsm_8h.html</anchorfile>
|
||||
<anchor>a5ae65679e4a53f3f672560b3c30097b4</anchor>
|
||||
<anchorfile>group__tsk__fsm__group.html</anchorfile>
|
||||
<anchor>gaf522979f49aaac6acbf7d5ef5712776f</anchor>
|
||||
<arglist>(tsk_fsm_t *self, tsk_fsm_onterminated callback, const void *callbackdata)</arglist>
|
||||
</member>
|
||||
<member kind="function">
|
||||
|
@ -4025,6 +4025,13 @@
|
|||
<anchor>ga9059c5c9cdccf14f4c963bfee38b5ba4</anchor>
|
||||
<arglist>(tsk_fsm_t *self,...)</arglist>
|
||||
</member>
|
||||
<member kind="function">
|
||||
<type>int</type>
|
||||
<name>tsk_fsm_set_callback_terminated</name>
|
||||
<anchorfile>group__tsk__fsm__group.html</anchorfile>
|
||||
<anchor>gaf522979f49aaac6acbf7d5ef5712776f</anchor>
|
||||
<arglist>(tsk_fsm_t *self, tsk_fsm_onterminated callback, const void *callbackdata)</arglist>
|
||||
</member>
|
||||
<member kind="function">
|
||||
<type>int</type>
|
||||
<name>tsk_fsm_act</name>
|
||||
|
|
|
@ -57,8 +57,6 @@ tsip_message_event_t;
|
|||
|
||||
int tsip_message_event_signal(tsip_message_event_type_t type, struct tsip_stack_s *stack, tsip_operation_id_t opid, short status_code, const char *phrase, const struct tsip_message_s* sipmessage);
|
||||
|
||||
typedef int (*tsip_message_callback)(const tsip_message_event_t *sipevent);
|
||||
|
||||
TINYSIP_GEXTERN const void *tsip_message_event_def_t;
|
||||
|
||||
TSIP_END_DECLS
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tsip_api_publish.h
|
||||
* @brief Public piblication (PUBLISH) functions.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#ifndef TINYSIP_TSIP_PUBLISH_H
|
||||
#define TINYSIP_TSIP_PUBLISH_H
|
||||
|
||||
#include "tinysip_config.h"
|
||||
|
||||
#include "tinysip/tsip_event.h"
|
||||
|
||||
TSIP_BEGIN_DECLS
|
||||
|
||||
#define TSIP_PUBLISH_EVENT(self) ((tsip_publish_event_t*)(self))
|
||||
|
||||
typedef enum tsip_publish_event_type_e
|
||||
{
|
||||
tsip_i_publish,
|
||||
tsip_ai_publish,
|
||||
tsip_o_publish,
|
||||
tsip_ao_publish,
|
||||
|
||||
tsip_i_unpublish,
|
||||
tsip_ai_unpublish,
|
||||
tsip_o_unpublish,
|
||||
tsip_ao_unpublish
|
||||
}
|
||||
tsip_publish_event_type_t;
|
||||
|
||||
typedef struct tsip_publish_event_e
|
||||
{
|
||||
TSIP_DECLARE_EVENT;
|
||||
|
||||
tsip_publish_event_type_t type;
|
||||
}
|
||||
tsip_publish_event_t;
|
||||
|
||||
int tsip_publish_event_signal(tsip_publish_event_type_t type, struct tsip_stack_s *stack, tsip_operation_id_t opid, short status_code, const char *phrase, const struct tsip_message_s* sipmessage);
|
||||
|
||||
TINYSIP_GEXTERN const void *tsip_publish_event_def_t;
|
||||
|
||||
TSIP_END_DECLS
|
||||
|
||||
#endif /* TINYSIP_TSIP_PUBLISH_H */
|
|
@ -62,8 +62,6 @@ tsip_register_event_t;
|
|||
|
||||
int tsip_register_event_signal(tsip_register_event_type_t type, struct tsip_stack_s *stack, tsip_operation_id_t opid, short status_code, const char *phrase, const struct tsip_message_s* sipmessage);
|
||||
|
||||
typedef int (*tsip_register_callback)(const tsip_register_event_t *sipevent);
|
||||
|
||||
TINYSIP_GEXTERN const void *tsip_register_event_def_t;
|
||||
|
||||
TSIP_END_DECLS
|
||||
|
|
|
@ -67,8 +67,6 @@ tsip_subscribe_event_t;
|
|||
|
||||
int tsip_subscribe_event_signal(tsip_subscribe_event_type_t type, struct tsip_stack_s *stack, tsip_operation_id_t opid, short status_code, const char *phrase, const struct tsip_message_s* sipmessage);
|
||||
|
||||
typedef int (*tsip_subscribe_callback)(const tsip_subscribe_event_t *sipevent);
|
||||
|
||||
TINYSIP_GEXTERN const void *tsip_subscribe_event_def_t;
|
||||
|
||||
TSIP_END_DECLS
|
||||
|
|
|
@ -41,6 +41,17 @@ TSIP_BEGIN_DECLS
|
|||
|
||||
#define TSIP_DIALOG_PUBLISH(self) ((tsip_dialog_publish_t*)(self))
|
||||
|
||||
/** Type of refresh to perform.
|
||||
*/
|
||||
typedef enum refresh_type_e
|
||||
{
|
||||
rt_initial,
|
||||
rt_timedout,
|
||||
rt_modify,
|
||||
rt_remove
|
||||
}
|
||||
refresh_type_t;
|
||||
|
||||
typedef struct tsip_dialog_publish
|
||||
{
|
||||
TSIP_DECLARE_DIALOG;
|
||||
|
@ -50,12 +61,14 @@ typedef struct tsip_dialog_publish
|
|||
tsip_timer_t timerrefresh;
|
||||
|
||||
unsigned unpublishing:1;
|
||||
|
||||
char* package;
|
||||
char* etag;
|
||||
refresh_type_t last_rtype;
|
||||
}
|
||||
tsip_dialog_publish_t;
|
||||
|
||||
int tsip_dialog_publish_start(tsip_dialog_publish_t *self);
|
||||
int tsip_dialog_publish_modify(tsip_dialog_publish_t *self);
|
||||
int tsip_dialog_publish_remove(tsip_dialog_publish_t *self);
|
||||
|
||||
TINYSIP_GEXTERN const void *tsip_dialog_publish_def_t;
|
||||
|
||||
|
|
|
@ -35,22 +35,34 @@
|
|||
|
||||
TSIP_BEGIN_DECLS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @struct
|
||||
///
|
||||
/// @brief SIP header 'SIP-ETag'.
|
||||
/// @author Mamadou
|
||||
/// @date 12/3/2009
|
||||
///
|
||||
/// @par ABNF
|
||||
///
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/**@def TSIP_HEADER_SIP_ETAG_CREATE
|
||||
* Creates new sip 'SIP-ETag' header as per RFC 3903. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
|
||||
* @sa TSK_OBJECT_SAFE_FREE.
|
||||
*/
|
||||
#define TSIP_HEADER_SIP_ETAG_VA_ARGS(etag) tsip_header_SIP_ETag_def_t, (const char*)etag
|
||||
#define TSIP_HEADER_SIP_ETAG_CREATE(etag) tsk_object_new(TSIP_HEADER_SIP_ETAG_VA_ARGS(etag))
|
||||
#define TSIP_HEADER_SIP_ETAG_CREATE_NULL() TSIP_HEADER_SIP_ETAG_CREATE(TSIP_NULL)
|
||||
|
||||
|
||||
/**
|
||||
* @struct tsip_header_SIP_ETag_s
|
||||
*
|
||||
* SIP header 'SIP-ETag' as per RFC 3903.
|
||||
* @par ABNF
|
||||
* SIP-ETag = "SIP-ETag" HCOLON entity-tag
|
||||
* entity-tag = token
|
||||
**/
|
||||
typedef struct tsip_header_SIP_ETag_s
|
||||
{
|
||||
TSIP_DECLARE_HEADER;
|
||||
char *value;
|
||||
}
|
||||
tsip_header_SIP_ETag_t;
|
||||
|
||||
tsip_header_SIP_ETag_t *tsip_header_SIP_ETag_parse(const char *data, size_t size);
|
||||
|
||||
TINYSIP_GEXTERN const void *tsip_header_SIP_ETag_def_t;
|
||||
|
||||
TSIP_END_DECLS
|
||||
|
||||
#endif /* _TSIP_HEADER_SIP_ETAG_H_ */
|
||||
|
|
|
@ -35,22 +35,34 @@
|
|||
|
||||
TSIP_BEGIN_DECLS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @struct
|
||||
///
|
||||
/// @brief SIP header 'SIP-If-Match'.
|
||||
/// @author Mamadou
|
||||
/// @date 12/3/2009
|
||||
///
|
||||
/// @par ABNF
|
||||
///
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/**@def TSIP_HEADER_SIP_IF_MATCH_CREATE
|
||||
* Creates new sip 'SIP-If-Match' header as per RFC 3903. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
|
||||
* @sa TSK_OBJECT_SAFE_FREE.
|
||||
*/
|
||||
#define TSIP_HEADER_SIP_IF_MATCH_VA_ARGS(etag) tsip_header_SIP_If_Match_def_t, (const char*)etag
|
||||
#define TSIP_HEADER_SIP_IF_MATCH_CREATE(etag) tsk_object_new(TSIP_HEADER_SIP_IF_MATCH_VA_ARGS(etag))
|
||||
#define TSIP_HEADER_SIP_IF_MATCH_CREATE_NULL() TSIP_HEADER_SIP_IF_MATCH_CREATE(TSIP_NULL)
|
||||
|
||||
|
||||
/**
|
||||
* @struct tsip_header_SIP_If_Match_s
|
||||
*
|
||||
* SIP header 'SIP-If-Match' as per RFC 3903.
|
||||
* @par ABNF
|
||||
* SIP-If-Match = "SIP-If-Match" HCOLON entity-tag
|
||||
* entity-tag = token
|
||||
**/
|
||||
typedef struct tsip_header_SIP_If_Match_s
|
||||
{
|
||||
TSIP_DECLARE_HEADER;
|
||||
char *value;
|
||||
}
|
||||
tsip_header_SIP_If_Match_t;
|
||||
|
||||
tsip_header_SIP_If_Match_t *tsip_header_SIP_If_Match_parse(const char *data, size_t size);
|
||||
|
||||
TINYSIP_GEXTERN const void *tsip_header_SIP_If_Match_def_t;
|
||||
|
||||
TSIP_END_DECLS
|
||||
|
||||
#endif /* _TSIP_HEADER_SIP_IF_MATCH_H_ */
|
||||
|
|
|
@ -67,6 +67,7 @@ tsip_operation_handle_t *tsip_operation_createex(const struct tsip_message_s* me
|
|||
TINYSIP_API int tsip_operation_set(tsip_operation_handle_t *self, ...);
|
||||
TINYSIP_API tsip_operation_id_t tsip_operation_get_id(const tsip_operation_handle_t *self);
|
||||
const tsk_param_t* tsip_operation_get_param(const tsip_operation_handle_t *self, const char* pname);
|
||||
const tsk_param_t* tsip_operation_get_header(const tsip_operation_handle_t *self, const char* pname);
|
||||
const tsk_params_L_t* tsip_operation_get_headers(const tsip_operation_handle_t *self);
|
||||
const tsk_params_L_t* tsip_operation_get_params(const tsip_operation_handle_t *self);
|
||||
const tsk_params_L_t* tsip_operation_get_caps(const tsip_operation_handle_t *self);
|
||||
|
|
|
@ -220,10 +220,15 @@ const struct tsip_transac_layer_s* tsip_stack_get_transac_layer(const tsip_stack
|
|||
const struct tsip_transport_layer_s* tsip_stack_get_transport_layer(const tsip_stack_handle_t *self);
|
||||
|
||||
TINYSIP_API int tsip_register(tsip_stack_handle_t *stack, const tsip_operation_handle_t *operation);
|
||||
int tsip_unregister(tsip_stack_handle_t *stack, const tsip_operation_handle_t *operation);
|
||||
TINYSIP_API int tsip_unregister(tsip_stack_handle_t *stack, const tsip_operation_handle_t *operation);
|
||||
|
||||
TINYSIP_API int tsip_subscribe(tsip_stack_handle_t *stack, const tsip_operation_handle_t *operation);
|
||||
int tsip_unsubscribe(tsip_stack_handle_t *stack, const tsip_operation_handle_t *operation);
|
||||
TINYSIP_API int tsip_unsubscribe(tsip_stack_handle_t *stack, const tsip_operation_handle_t *operation);
|
||||
|
||||
TINYSIP_API int tsip_publish(tsip_stack_handle_t *_stack, const tsip_operation_handle_t *operation);
|
||||
TINYSIP_API int tsip_publish_modify(tsip_stack_handle_t *_stack, const tsip_operation_handle_t *operation);
|
||||
TINYSIP_API int tsip_publish_remove(tsip_stack_handle_t *_stack, const tsip_operation_handle_t *operation);
|
||||
|
||||
|
||||
TINYSIP_API int tsip_message(tsip_stack_handle_t *stack, const tsip_operation_handle_t *operation);
|
||||
|
||||
|
|
|
@ -95,6 +95,12 @@ ragel.exe $OPTIONS -o ../src/headers/tsip_header_Require.c tsip_parser_header_Re
|
|||
# == Server
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Server.c tsip_parser_header_Server.rl
|
||||
|
||||
# == SIP-ETag
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_SIP_ETag.c tsip_parser_header_SIP_ETag.rl
|
||||
|
||||
# == SIP-If-Match
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_SIP_If_Match.c tsip_parser_header_SIP_If_Match.rl
|
||||
|
||||
# == Route
|
||||
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Route.c tsip_parser_header_Route.rl
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#include "tinysip/headers/tsip_header_Security_Verify.h"
|
||||
#include "tinysip/headers/tsip_header_Server.h"
|
||||
#include "tinysip/headers/tsip_header_Service_Route.h"
|
||||
#include "tinysip/headers/tsip_header_SIP_ETag.h"
|
||||
#include "tinysip/headers/tsip_header_SIP_If_Match.h"
|
||||
#include "tinysip/headers/tsip_header_Subscription_State.h"
|
||||
#include "tinysip/headers/tsip_header_Supported.h"
|
||||
#include "tinysip/headers/tsip_header_To.h"
|
||||
|
@ -635,13 +637,15 @@
|
|||
# /*== SIP-ETag: ==*/
|
||||
action parse_header_SIP_ETag
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_SIP_ETag NOT IMPLEMENTED");
|
||||
tsip_header_SIP_ETag_t *header = tsip_header_SIP_ETag_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
|
||||
# /*== SIP-If-Match: ==*/
|
||||
action parse_header_SIP_If_Match
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_SIP_If_Match NOT IMPLEMENTED");
|
||||
tsip_header_SIP_If_Match_t *header = tsip_header_SIP_If_Match_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
|
||||
# /*== Subject: ==*/
|
||||
|
|
|
@ -128,8 +128,6 @@ tsip_header_Allow_t *tsip_header_Allow_parse(const char *data, size_t size)
|
|||
// Allow header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Allow_group
|
||||
*/
|
||||
static void* tsip_header_Allow_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Allow_t *Allow = self;
|
||||
|
@ -150,8 +148,6 @@ static void* tsip_header_Allow_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Allow_group
|
||||
*/
|
||||
static void* tsip_header_Allow_destroy(void *self)
|
||||
{
|
||||
tsip_header_Allow_t *Allow = self;
|
||||
|
|
|
@ -134,8 +134,6 @@ tsip_header_Allow_Events_t *tsip_header_Allow_Events_parse(const char *data, siz
|
|||
// Allow_events header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Allow_events_group
|
||||
*/
|
||||
static void* tsip_header_Allow_Events_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Allow_Events_t *Allow_events = self;
|
||||
|
@ -151,8 +149,6 @@ static void* tsip_header_Allow_Events_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Allow_events_group
|
||||
*/
|
||||
static void* tsip_header_Allow_Events_destroy(void *self)
|
||||
{
|
||||
tsip_header_Allow_Events_t *Allow_events = self;
|
||||
|
|
|
@ -237,8 +237,6 @@
|
|||
//// Authorization header object definition
|
||||
////
|
||||
//
|
||||
///**@ingroup tsip_header_Authorization_group
|
||||
//*/
|
||||
//static void* tsip_header_Authorization_create(void *self, va_list * app)
|
||||
//{
|
||||
// tsip_header_Authorization_t *Authorization = self;
|
||||
|
@ -254,8 +252,6 @@
|
|||
// return self;
|
||||
//}
|
||||
//
|
||||
///**@ingroup tsip_header_Authorization_group
|
||||
//*/
|
||||
//static void* tsip_header_Authorization_destroy(void *self)
|
||||
//{
|
||||
// tsip_header_Authorization_t *Authorization = self;
|
||||
|
|
|
@ -114,8 +114,6 @@ tsip_header_CSeq_t *tsip_header_CSeq_parse(const char *data, size_t size)
|
|||
// CSeq header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_CSeq_group
|
||||
*/
|
||||
static void* tsip_header_CSeq_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_CSeq_t *CSeq = self;
|
||||
|
@ -133,8 +131,6 @@ static void* tsip_header_CSeq_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_CSeq_group
|
||||
*/
|
||||
static void* tsip_header_CSeq_destroy(void *self)
|
||||
{
|
||||
tsip_header_CSeq_t *CSeq = self;
|
||||
|
|
|
@ -121,8 +121,6 @@ tsip_header_Call_ID_t *tsip_header_Call_ID_parse(const char *data, size_t size)
|
|||
// Call_ID header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Call_ID_group
|
||||
*/
|
||||
static void* tsip_header_Call_ID_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Call_ID_t *Call_ID = self;
|
||||
|
@ -139,8 +137,6 @@ static void* tsip_header_Call_ID_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Call_ID_group
|
||||
*/
|
||||
static void* tsip_header_Call_ID_destroy(void *self)
|
||||
{
|
||||
tsip_header_Call_ID_t *Call_ID = self;
|
||||
|
|
|
@ -185,8 +185,6 @@ tsip_header_Contacts_L_t *tsip_header_Contact_parse(const char *data, size_t siz
|
|||
// Contact header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Contact_group
|
||||
*/
|
||||
static void* tsip_header_Contact_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Contact_t *Contact = self;
|
||||
|
@ -203,8 +201,6 @@ static void* tsip_header_Contact_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Contact_group
|
||||
*/
|
||||
static void* tsip_header_Contact_destroy(void *self)
|
||||
{
|
||||
tsip_header_Contact_t *Contact = self;
|
||||
|
@ -250,8 +246,6 @@ const void *tsip_header_Contact_def_t = &tsip_header_Contact_def_s;
|
|||
// return self;
|
||||
//}
|
||||
//
|
||||
///**@ingroup tsip_header_Contact_group
|
||||
//*/
|
||||
//static void* tsip_contact_destroy(void *self)
|
||||
//{
|
||||
// tsip_contact_t *contact = self;
|
||||
|
|
|
@ -108,8 +108,6 @@ tsip_header_Content_Length_t *tsip_header_Content_Length_parse(const char *data,
|
|||
// Content_Length header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Content_Length_group
|
||||
*/
|
||||
static void* tsip_header_Content_Length_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Content_Length_t *Content_Length = self;
|
||||
|
@ -127,8 +125,6 @@ static void* tsip_header_Content_Length_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Content_Length_group
|
||||
*/
|
||||
static void* tsip_header_Content_Length_destroy(void *self)
|
||||
{
|
||||
tsip_header_Content_Length_t *Content_Length = self;
|
||||
|
|
|
@ -133,8 +133,6 @@ tsip_header_Content_Type_t *tsip_header_Content_Type_parse(const char *data, siz
|
|||
// Content_Type header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Content_Type_group
|
||||
*/
|
||||
static void* tsip_header_Content_Type_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Content_Type_t *Content_Type = self;
|
||||
|
@ -152,8 +150,6 @@ static void* tsip_header_Content_Type_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Content_Type_group
|
||||
*/
|
||||
static void* tsip_header_Content_Type_destroy(void *self)
|
||||
{
|
||||
tsip_header_Content_Type_t *Content_Type = self;
|
||||
|
|
|
@ -121,8 +121,6 @@ tsip_header_Dummy_t *tsip_header_Dummy_parse(const char *data, size_t size)
|
|||
// Dummy header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Dummy_group
|
||||
*/
|
||||
static void* tsip_header_Dummy_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Dummy_t *Dummy = self;
|
||||
|
@ -141,8 +139,6 @@ static void* tsip_header_Dummy_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Dummy_group
|
||||
*/
|
||||
static void* tsip_header_Dummy_destroy(void *self)
|
||||
{
|
||||
tsip_header_Dummy_t *Dummy = self;
|
||||
|
|
|
@ -126,8 +126,6 @@ tsip_header_Event_t *tsip_header_Event_parse(const char *data, size_t size)
|
|||
// Event header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Event_group
|
||||
*/
|
||||
static void* tsip_header_Event_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Event_t *Event = self;
|
||||
|
@ -144,8 +142,6 @@ static void* tsip_header_Event_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Event_group
|
||||
*/
|
||||
static void* tsip_header_Event_destroy(void *self)
|
||||
{
|
||||
tsip_header_Event_t *Event = self;
|
||||
|
|
|
@ -113,8 +113,6 @@ tsip_header_Expires_t *tsip_header_Expires_parse(const char *data, size_t size)
|
|||
// Expires header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Expires_group
|
||||
*/
|
||||
static void* tsip_header_Expires_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Expires_t *Expires = self;
|
||||
|
@ -131,8 +129,6 @@ static void* tsip_header_Expires_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Expires_group
|
||||
*/
|
||||
static void* tsip_header_Expires_destroy(void *self)
|
||||
{
|
||||
tsip_header_Expires_t *Expires = self;
|
||||
|
|
|
@ -140,8 +140,6 @@ tsip_header_From_t *tsip_header_From_parse(const char *data, size_t size)
|
|||
// From header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_From_group
|
||||
*/
|
||||
static void* tsip_header_From_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_From_t *From = self;
|
||||
|
@ -165,8 +163,6 @@ static void* tsip_header_From_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_From_group
|
||||
*/
|
||||
static void* tsip_header_From_destroy(void *self)
|
||||
{
|
||||
tsip_header_From_t *From = self;
|
||||
|
|
|
@ -113,8 +113,6 @@ tsip_header_Max_Forwards_t *tsip_header_Max_Forwards_parse(const char *data, siz
|
|||
// Max_Forwards header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Max_Forwards_group
|
||||
*/
|
||||
static void* tsip_header_Max_Forwards_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Max_Forwards_t *Max_Forwards = self;
|
||||
|
@ -131,8 +129,6 @@ static void* tsip_header_Max_Forwards_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Max_Forwards_group
|
||||
*/
|
||||
static void* tsip_header_Max_Forwards_destroy(void *self)
|
||||
{
|
||||
tsip_header_Max_Forwards_t *Max_Forwards = self;
|
||||
|
|
|
@ -113,8 +113,6 @@ tsip_header_Min_Expires_t *tsip_header_Min_Expires_parse(const char *data, size_
|
|||
// Min-Expires header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Min_Expires_group
|
||||
*/
|
||||
static void* tsip_header_Min_Expires_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Min_Expires_t *Min_Expires = self;
|
||||
|
@ -131,8 +129,6 @@ static void* tsip_header_Min_Expires_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Min_Expires_group
|
||||
*/
|
||||
static void* tsip_header_Min_Expires_destroy(void *self)
|
||||
{
|
||||
tsip_header_Min_Expires_t *Min_Expires = self;
|
||||
|
|
|
@ -124,8 +124,6 @@ tsip_header_P_Access_Network_Info_t *tsip_header_P_Access_Network_Info_parse(con
|
|||
// P_Access_Network_Info header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_P_Access_Network_Info_group
|
||||
*/
|
||||
static void* tsip_header_P_Access_Network_Info_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_P_Access_Network_Info_t *P_Access_Network_Info = self;
|
||||
|
@ -142,8 +140,6 @@ static void* tsip_header_P_Access_Network_Info_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_P_Access_Network_Info_group
|
||||
*/
|
||||
static void* tsip_header_P_Access_Network_Info_destroy(void *self)
|
||||
{
|
||||
tsip_header_P_Access_Network_Info_t *P_Access_Network_Info = self;
|
||||
|
|
|
@ -166,8 +166,6 @@ tsip_header_P_Associated_URIs_L_t *tsip_header_P_Associated_URI_parse(const char
|
|||
// P_Associated_URI header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_P_Associated_URI_group
|
||||
*/
|
||||
static void* tsip_header_P_Associated_URI_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_P_Associated_URI_t *P_Associated_URI = self;
|
||||
|
@ -188,8 +186,6 @@ static void* tsip_header_P_Associated_URI_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_P_Associated_URI_group
|
||||
*/
|
||||
static void* tsip_header_P_Associated_URI_destroy(void *self)
|
||||
{
|
||||
tsip_header_P_Associated_URI_t *P_Associated_URI = self;
|
||||
|
|
|
@ -160,8 +160,6 @@ tsip_header_P_Charging_Function_Addressess_L_t *tsip_header_P_Charging_Function_
|
|||
// P_Charging_Function_Addresses header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_P_Charging_Function_Addresses_group
|
||||
*/
|
||||
static void* tsip_header_P_Charging_Function_Addresses_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_P_Charging_Function_Addresses_t *P_Charging_Function_Addresses = self;
|
||||
|
@ -177,8 +175,6 @@ static void* tsip_header_P_Charging_Function_Addresses_create(void *self, va_lis
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_P_Charging_Function_Addresses_group
|
||||
*/
|
||||
static void* tsip_header_P_Charging_Function_Addresses_destroy(void *self)
|
||||
{
|
||||
tsip_header_P_Charging_Function_Addresses_t *P_Charging_Function_Addresses = self;
|
||||
|
|
|
@ -142,8 +142,6 @@ tsip_header_P_Preferred_Identity_t *tsip_header_P_Preferred_Identity_parse(const
|
|||
// P_Preferred_Identity header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_P_Preferred_Identity_group
|
||||
*/
|
||||
static void* tsip_header_P_Preferred_Identity_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_P_Preferred_Identity_t *P_Preferred_Identity = self;
|
||||
|
@ -165,8 +163,6 @@ static void* tsip_header_P_Preferred_Identity_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_P_Preferred_Identity_group
|
||||
*/
|
||||
static void* tsip_header_P_Preferred_Identity_destroy(void *self)
|
||||
{
|
||||
tsip_header_P_Preferred_Identity_t *P_Preferred_Identity = self;
|
||||
|
|
|
@ -167,8 +167,6 @@ tsip_header_Paths_L_t *tsip_header_Path_parse(const char *data, size_t size)
|
|||
// Path header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Path_group
|
||||
*/
|
||||
static void* tsip_header_Path_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Path_t *Path = self;
|
||||
|
@ -189,8 +187,6 @@ static void* tsip_header_Path_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Path_group
|
||||
*/
|
||||
static void* tsip_header_Path_destroy(void *self)
|
||||
{
|
||||
tsip_header_Path_t *Path = self;
|
||||
|
|
|
@ -140,8 +140,6 @@ tsip_header_Privacy_t *tsip_header_Privacy_parse(const char *data, size_t size)
|
|||
// Privacy header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Privacy_group
|
||||
*/
|
||||
static void* tsip_header_Privacy_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Privacy_t *Privacy = self;
|
||||
|
@ -157,8 +155,6 @@ static void* tsip_header_Privacy_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Privacy_group
|
||||
*/
|
||||
static void* tsip_header_Privacy_destroy(void *self)
|
||||
{
|
||||
tsip_header_Privacy_t *Privacy = self;
|
||||
|
|
|
@ -201,8 +201,6 @@
|
|||
//// Proxy_Authenticate header object definition
|
||||
////
|
||||
//
|
||||
///**@ingroup tsip_header_Proxy_Authenticate_group
|
||||
//*/
|
||||
//static void* tsip_header_Proxy_Authenticate_create(void *self, va_list * app)
|
||||
//{
|
||||
// tsip_header_Proxy_Authenticate_t *Proxy_Authenticate = self;
|
||||
|
@ -218,8 +216,6 @@
|
|||
// return self;
|
||||
//}
|
||||
//
|
||||
///**@ingroup tsip_header_Proxy_Authenticate_group
|
||||
//*/
|
||||
//static void* tsip_header_Proxy_Authenticate_destroy(void *self)
|
||||
//{
|
||||
// tsip_header_Proxy_Authenticate_t *Proxy_Authenticate = self;
|
||||
|
|
|
@ -238,8 +238,6 @@
|
|||
//// Proxy_Authorization header object definition
|
||||
////
|
||||
//
|
||||
///**@ingroup tsip_header_Proxy_Authorization_group
|
||||
//*/
|
||||
//static void* tsip_header_Proxy_Authorization_create(void *self, va_list * app)
|
||||
//{
|
||||
// tsip_header_Proxy_Authorization_t *Proxy_Authorization = self;
|
||||
|
@ -255,8 +253,6 @@
|
|||
// return self;
|
||||
//}
|
||||
//
|
||||
///**@ingroup tsip_header_Proxy_Authorization_group
|
||||
//*/
|
||||
//static void* tsip_header_Proxy_Authorization_destroy(void *self)
|
||||
//{
|
||||
// tsip_header_Proxy_Authorization_t *Proxy_Authorization = self;
|
||||
|
|
|
@ -130,8 +130,6 @@ tsip_header_Proxy_Require_t *tsip_header_Proxy_Require_parse(const char *data, s
|
|||
// Proxy_Require header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Proxy_Require_group
|
||||
*/
|
||||
static void* tsip_header_Proxy_Require_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Proxy_Require_t *Proxy_Require = self;
|
||||
|
@ -156,8 +154,6 @@ static void* tsip_header_Proxy_Require_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Proxy_Require_group
|
||||
*/
|
||||
static void* tsip_header_Proxy_Require_destroy(void *self)
|
||||
{
|
||||
tsip_header_Proxy_Require_t *Proxy_Require = self;
|
||||
|
|
|
@ -115,8 +115,6 @@ tsip_header_Record_Route_t *tsip_header_Record_Route_parse(const char *data, siz
|
|||
// Record_Route header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Record_Route_group
|
||||
*/
|
||||
static void* tsip_header_Record_Route_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Record_Route_t *Record_Route = self;
|
||||
|
@ -133,8 +131,6 @@ static void* tsip_header_Record_Route_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Record_Route_group
|
||||
*/
|
||||
static void* tsip_header_Record_Route_destroy(void *self)
|
||||
{
|
||||
tsip_header_Record_Route_t *Record_Route = self;
|
||||
|
|
|
@ -129,8 +129,6 @@ tsip_header_Require_t *tsip_header_Require_parse(const char *data, size_t size)
|
|||
// Require header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Require_group
|
||||
*/
|
||||
static void* tsip_header_Require_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Require_t *Require = self;
|
||||
|
@ -155,8 +153,6 @@ static void* tsip_header_Require_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Require_group
|
||||
*/
|
||||
static void* tsip_header_Require_destroy(void *self)
|
||||
{
|
||||
tsip_header_Require_t *Require = self;
|
||||
|
|
|
@ -170,8 +170,6 @@ tsip_header_Routes_L_t *tsip_header_Route_parse(const char *data, size_t size)
|
|||
// Route header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Route_group
|
||||
*/
|
||||
static void* tsip_header_Route_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Route_t *Route = self;
|
||||
|
@ -193,8 +191,6 @@ static void* tsip_header_Route_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Route_group
|
||||
*/
|
||||
static void* tsip_header_Route_destroy(void *self)
|
||||
{
|
||||
tsip_header_Route_t *Route = self;
|
||||
|
|
|
@ -1 +1,155 @@
|
|||
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tsip_header_SIP_ETag.c
|
||||
* @brief SIP SIP-ETag header.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinysip/headers/tsip_header_SIP_ETag.h"
|
||||
|
||||
#include "tinysip/parsers/tsip_parser_uri.h"
|
||||
|
||||
#include "tsk_debug.h"
|
||||
#include "tsk_memory.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**@defgroup tsip_header_SIP_ETag_group SIP SIP_ETag header.
|
||||
*/
|
||||
|
||||
/***********************************
|
||||
* Ragel state machine.
|
||||
*/
|
||||
%%{
|
||||
machine tsip_machine_parser_header_SIP_ETag;
|
||||
|
||||
# Includes
|
||||
include tsip_machine_utils "./tsip_machine_utils.rl";
|
||||
|
||||
action tag
|
||||
{
|
||||
tag_start = p;
|
||||
}
|
||||
|
||||
action parse_etag
|
||||
{
|
||||
TSK_PARSER_SET_STRING(hdr_etag->value);
|
||||
}
|
||||
|
||||
action eob
|
||||
{
|
||||
}
|
||||
|
||||
SIP_ETag = "SIP-ETag"i HCOLON token>tag %parse_etag;
|
||||
|
||||
# Entry point
|
||||
main := SIP_ETag :>CRLF @eob;
|
||||
|
||||
}%%
|
||||
|
||||
int tsip_header_SIP_ETag_tostring(const void* header, tsk_buffer_t* output)
|
||||
{
|
||||
if(header)
|
||||
{
|
||||
const tsip_header_SIP_ETag_t *SIP_ETag = header;
|
||||
if(SIP_ETag->value){
|
||||
tsk_buffer_append(output, SIP_ETag->value, strlen(SIP_ETag->value));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsip_header_SIP_ETag_t *tsip_header_SIP_ETag_parse(const char *data, size_t size)
|
||||
{
|
||||
int cs = 0;
|
||||
const char *p = data;
|
||||
const char *pe = p + size;
|
||||
const char *eof = pe;
|
||||
tsip_header_SIP_ETag_t *hdr_etag = TSIP_HEADER_SIP_ETAG_CREATE_NULL();
|
||||
|
||||
const char *tag_start;
|
||||
|
||||
%%write data;
|
||||
%%write init;
|
||||
%%write exec;
|
||||
|
||||
if( cs < %%{ write first_final; }%% )
|
||||
{
|
||||
TSK_OBJECT_SAFE_FREE(hdr_etag);
|
||||
}
|
||||
|
||||
return hdr_etag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//========================================================
|
||||
// SIP_ETag header object definition
|
||||
//
|
||||
|
||||
static void* tsip_header_SIP_ETag_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_SIP_ETag_t *SIP_ETag = self;
|
||||
if(SIP_ETag)
|
||||
{
|
||||
TSIP_HEADER(SIP_ETag)->type = tsip_htype_SIP_ETag;
|
||||
TSIP_HEADER(SIP_ETag)->tostring = tsip_header_SIP_ETag_tostring;
|
||||
SIP_ETag->value = tsk_strdup(va_arg(*app, const char*));
|
||||
}
|
||||
else
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create new SIP_ETag header.");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tsip_header_SIP_ETag_destroy(void *self)
|
||||
{
|
||||
tsip_header_SIP_ETag_t *SIP_ETag = self;
|
||||
if(SIP_ETag)
|
||||
{
|
||||
TSK_FREE(SIP_ETag->value);
|
||||
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(SIP_ETag));
|
||||
}
|
||||
else TSK_DEBUG_ERROR("Null SIP_ETag header.");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tsip_header_SIP_ETag_def_s =
|
||||
{
|
||||
sizeof(tsip_header_SIP_ETag_t),
|
||||
tsip_header_SIP_ETag_create,
|
||||
tsip_header_SIP_ETag_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_SIP_ETag_def_t = &tsip_header_SIP_ETag_def_s;
|
||||
|
|
|
@ -1 +1,156 @@
|
|||
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tsip_header_SIP_If_Match.c
|
||||
* @brief SIP SIP-If-Match header.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinysip/headers/tsip_header_SIP_If_Match.h"
|
||||
|
||||
#include "tinysip/parsers/tsip_parser_uri.h"
|
||||
|
||||
#include "tsk_debug.h"
|
||||
#include "tsk_memory.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**@defgroup tsip_header_SIP_If_Match_group SIP SIP_If_Match header.
|
||||
*/
|
||||
|
||||
/***********************************
|
||||
* Ragel state machine.
|
||||
*/
|
||||
%%{
|
||||
machine tsip_machine_parser_header_SIP_If_Match;
|
||||
|
||||
# Includes
|
||||
include tsip_machine_utils "./tsip_machine_utils.rl";
|
||||
|
||||
action tag
|
||||
{
|
||||
tag_start = p;
|
||||
}
|
||||
|
||||
action parse_ifmatch
|
||||
{
|
||||
TSK_PARSER_SET_STRING(hdr_ifmatch->value);
|
||||
}
|
||||
|
||||
action eob
|
||||
{
|
||||
}
|
||||
|
||||
SIP_If_Match = "SIP-If-Match"i HCOLON token>tag %parse_ifmatch;
|
||||
|
||||
# Entry point
|
||||
main := SIP_If_Match :>CRLF @eob;
|
||||
|
||||
}%%
|
||||
|
||||
int tsip_header_SIP_If_Match_tostring(const void* header, tsk_buffer_t* output)
|
||||
{
|
||||
if(header)
|
||||
{
|
||||
const tsip_header_SIP_If_Match_t *SIP_If_Match = header;
|
||||
if(SIP_If_Match->value){
|
||||
tsk_buffer_append(output, SIP_If_Match->value, strlen(SIP_If_Match->value));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsip_header_SIP_If_Match_t *tsip_header_SIP_If_Match_parse(const char *data, size_t size)
|
||||
{
|
||||
int cs = 0;
|
||||
const char *p = data;
|
||||
const char *pe = p + size;
|
||||
const char *eof = pe;
|
||||
tsip_header_SIP_If_Match_t *hdr_ifmatch = TSIP_HEADER_SIP_IF_MATCH_CREATE_NULL();
|
||||
|
||||
const char *tag_start;
|
||||
|
||||
%%write data;
|
||||
%%write init;
|
||||
%%write exec;
|
||||
|
||||
if( cs < %%{ write first_final; }%% )
|
||||
{
|
||||
TSK_OBJECT_SAFE_FREE(hdr_ifmatch);
|
||||
}
|
||||
|
||||
return hdr_ifmatch;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//========================================================
|
||||
// SIP_If_Match header object definition
|
||||
//
|
||||
|
||||
static void* tsip_header_SIP_If_Match_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_SIP_If_Match_t *SIP_If_Match = self;
|
||||
if(SIP_If_Match)
|
||||
{
|
||||
TSIP_HEADER(SIP_If_Match)->type = tsip_htype_SIP_If_Match;
|
||||
TSIP_HEADER(SIP_If_Match)->tostring = tsip_header_SIP_If_Match_tostring;
|
||||
SIP_If_Match->value = tsk_strdup(va_arg(*app, const char*));
|
||||
}
|
||||
else
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create new SIP_If_Match header.");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tsip_header_SIP_If_Match_destroy(void *self)
|
||||
{
|
||||
tsip_header_SIP_If_Match_t *SIP_If_Match = self;
|
||||
if(SIP_If_Match)
|
||||
{
|
||||
TSK_FREE(SIP_If_Match->value);
|
||||
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(SIP_If_Match));
|
||||
}
|
||||
else TSK_DEBUG_ERROR("Null SIP_If_Match header.");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tsip_header_SIP_If_Match_def_s =
|
||||
{
|
||||
sizeof(tsip_header_SIP_If_Match_t),
|
||||
tsip_header_SIP_If_Match_create,
|
||||
tsip_header_SIP_If_Match_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_SIP_If_Match_def_t = &tsip_header_SIP_If_Match_def_s;
|
||||
|
||||
|
|
|
@ -250,8 +250,6 @@ tsip_header_Security_Clients_L_t *tsip_header_Security_Client_parse(const char *
|
|||
// Security_Client header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Security_Client_group
|
||||
*/
|
||||
static void* tsip_header_Security_Client_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Security_Client_t *Security_Client = self;
|
||||
|
@ -288,8 +286,6 @@ static void* tsip_header_Security_Client_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Security_Client_group
|
||||
*/
|
||||
static void* tsip_header_Security_Client_destroy(void *self)
|
||||
{
|
||||
tsip_header_Security_Client_t *Security_Client = self;
|
||||
|
|
|
@ -251,8 +251,6 @@ tsip_header_Security_Servers_L_t *tsip_header_Security_Server_parse(const char *
|
|||
// Security_Server header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Security_Server_group
|
||||
*/
|
||||
static void* tsip_header_Security_Server_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Security_Server_t *Security_Server = self;
|
||||
|
@ -271,8 +269,6 @@ static void* tsip_header_Security_Server_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Security_Server_group
|
||||
*/
|
||||
static void* tsip_header_Security_Server_destroy(void *self)
|
||||
{
|
||||
tsip_header_Security_Server_t *Security_Server = self;
|
||||
|
|
|
@ -250,8 +250,6 @@ tsip_header_Security_Verifies_L_t *tsip_header_Security_Verify_parse(const char
|
|||
// Security_Verify header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Security_Verify_group
|
||||
*/
|
||||
static void* tsip_header_Security_Verify_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Security_Verify_t *Security_Verify = self;
|
||||
|
@ -270,8 +268,6 @@ static void* tsip_header_Security_Verify_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Security_Verify_group
|
||||
*/
|
||||
static void* tsip_header_Security_Verify_destroy(void *self)
|
||||
{
|
||||
tsip_header_Security_Verify_t *Security_Verify = self;
|
||||
|
|
|
@ -121,8 +121,6 @@ tsip_header_Server_t *tsip_header_Server_parse(const char *data, size_t size)
|
|||
// Server header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Server_group
|
||||
*/
|
||||
static void* tsip_header_Server_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Server_t *Server = self;
|
||||
|
@ -139,8 +137,6 @@ static void* tsip_header_Server_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Server_group
|
||||
*/
|
||||
static void* tsip_header_Server_destroy(void *self)
|
||||
{
|
||||
tsip_header_Server_t *Server = self;
|
||||
|
|
|
@ -167,8 +167,6 @@ tsip_header_Service_Routes_L_t *tsip_header_Service_Route_parse(const char *data
|
|||
// Service_Route header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Service_Route_group
|
||||
*/
|
||||
static void* tsip_header_Service_Route_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Service_Route_t *Service_Route = self;
|
||||
|
@ -189,8 +187,6 @@ static void* tsip_header_Service_Route_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Service_Route_group
|
||||
*/
|
||||
static void* tsip_header_Service_Route_destroy(void *self)
|
||||
{
|
||||
tsip_header_Service_Route_t *Service_Route = self;
|
||||
|
|
|
@ -146,8 +146,6 @@ tsip_header_Subscription_State_t *tsip_header_Subscription_State_parse(const cha
|
|||
// Subscription_State header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Subscription_State_group
|
||||
*/
|
||||
static void* tsip_header_Subscription_State_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Subscription_State_t *Subscription_State = self;
|
||||
|
@ -166,8 +164,6 @@ static void* tsip_header_Subscription_State_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Subscription_State_group
|
||||
*/
|
||||
static void* tsip_header_Subscription_State_destroy(void *self)
|
||||
{
|
||||
tsip_header_Subscription_State_t *Subscription_State = self;
|
||||
|
|
|
@ -129,8 +129,6 @@ tsip_header_Supported_t *tsip_header_Supported_parse(const char *data, size_t si
|
|||
// Supported header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Supported_group
|
||||
*/
|
||||
static void* tsip_header_Supported_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Supported_t *Supported = self;
|
||||
|
@ -155,8 +153,6 @@ static void* tsip_header_Supported_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Supported_group
|
||||
*/
|
||||
static void* tsip_header_Supported_destroy(void *self)
|
||||
{
|
||||
tsip_header_Supported_t *Supported = self;
|
||||
|
|
|
@ -140,8 +140,6 @@ tsip_header_To_t *tsip_header_To_parse(const char *data, size_t size)
|
|||
// To header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_To_group
|
||||
*/
|
||||
static void* tsip_header_To_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_To_t *To = self;
|
||||
|
@ -165,8 +163,6 @@ static void* tsip_header_To_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_To_group
|
||||
*/
|
||||
static void* tsip_header_To_destroy(void *self)
|
||||
{
|
||||
tsip_header_To_t *To = self;
|
||||
|
|
|
@ -116,8 +116,6 @@ tsip_header_User_Agent_t *tsip_header_User_Agent_parse(const char *data, size_t
|
|||
// User_Agent header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_User_Agent_group
|
||||
*/
|
||||
static void* tsip_header_User_Agent_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_User_Agent_t *User_Agent = self;
|
||||
|
@ -134,8 +132,6 @@ static void* tsip_header_User_Agent_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_User_Agent_group
|
||||
*/
|
||||
static void* tsip_header_User_Agent_destroy(void *self)
|
||||
{
|
||||
tsip_header_User_Agent_t *User_Agent = self;
|
||||
|
|
|
@ -235,8 +235,6 @@ tsip_header_Via_t *tsip_header_Via_parse(const char *data, size_t size)
|
|||
// Via header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Via_group
|
||||
*/
|
||||
static void* tsip_header_Via_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Via_t *via = self;
|
||||
|
@ -271,8 +269,6 @@ static void* tsip_header_Via_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Via_group
|
||||
*/
|
||||
static void* tsip_header_Via_destroy(void *self)
|
||||
{
|
||||
tsip_header_Via_t *via = self;
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
//
|
||||
//#include <string.h>
|
||||
//
|
||||
///**@defgroup tsip_header_WWW_Authenticate_group SIP WWW-Authenticate header.
|
||||
//*/
|
||||
//
|
||||
///***********************************
|
||||
//* Ragel state machine.
|
||||
|
@ -201,8 +199,6 @@
|
|||
//// WWW_Authenticate header object definition
|
||||
////
|
||||
//
|
||||
///**@ingroup tsip_header_WWW_Authenticate_group
|
||||
//*/
|
||||
//static void* tsip_header_WWW_Authenticate_create(void *self, va_list * app)
|
||||
//{
|
||||
// tsip_header_WWW_Authenticate_t *WWW_Authenticate = self;
|
||||
|
@ -218,8 +214,6 @@
|
|||
// return self;
|
||||
//}
|
||||
//
|
||||
///**@ingroup tsip_header_WWW_Authenticate_group
|
||||
//*/
|
||||
//static void* tsip_header_WWW_Authenticate_destroy(void *self)
|
||||
//{
|
||||
// tsip_header_WWW_Authenticate_t *WWW_Authenticate = self;
|
||||
|
|
|
@ -154,8 +154,6 @@ tsip_header_Warnings_L_t *tsip_header_Warning_parse(const char *data, size_t siz
|
|||
// Warning header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Warning_group
|
||||
*/
|
||||
static void* tsip_header_Warning_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Warning_t *Warning = self;
|
||||
|
@ -173,8 +171,6 @@ static void* tsip_header_Warning_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Warning_group
|
||||
*/
|
||||
static void* tsip_header_Warning_destroy(void *self)
|
||||
{
|
||||
tsip_header_Warning_t *Warning = self;
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tsip_api_publish.c
|
||||
* @brief Public subscription (PUBLISH) functions.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinysip/api/tsip_api_publish.h"
|
||||
|
||||
#include "tinysip/dialogs/tsip_dialog_layer.h"
|
||||
#include "tinysip/dialogs/tsip_dialog_publish.h"
|
||||
|
||||
#include "tsip.h"
|
||||
|
||||
#include "tsk_runnable.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
#define TSIP_PUBLISH_EVENT_CREATE( type) tsk_object_new(tsip_publish_event_def_t, type)
|
||||
|
||||
int tsip_publish_event_signal(tsip_publish_event_type_t type, struct tsip_stack_s *stack, tsip_operation_id_t opid, short status_code, const char *phrase, const tsip_message_t* sipmessage)
|
||||
{
|
||||
tsip_publish_event_t* sipevent = TSIP_PUBLISH_EVENT_CREATE(type);
|
||||
tsip_event_init(TSIP_EVENT(sipevent), stack, opid, status_code, phrase, sipmessage, tsip_event_publish);
|
||||
|
||||
TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(stack), sipevent);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tsip_publish(tsip_stack_handle_t *_stack, const tsip_operation_handle_t *operation)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if(_stack && operation)
|
||||
{
|
||||
tsip_stack_t *stack = _stack;
|
||||
tsip_dialog_publish_t *dialog;
|
||||
|
||||
if((dialog = (tsip_dialog_publish_t*)tsip_dialog_layer_find_by_op(stack->layer_dialog, tsip_dialog_publish, operation))){
|
||||
TSK_DEBUG_WARN("Already published.");// FIXME: update
|
||||
ret = -2;
|
||||
goto bail;
|
||||
}
|
||||
else{
|
||||
dialog = TSIP_DIALOG_PUBLISH_CREATE(stack, operation);
|
||||
ret = tsip_dialog_publish_start(dialog);
|
||||
tsk_list_push_back_data(stack->layer_dialog->dialogs, (void**)&dialog);
|
||||
}
|
||||
}
|
||||
|
||||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tsip_publish_modify(tsip_stack_handle_t *_stack, const tsip_operation_handle_t *operation)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if(_stack && operation)
|
||||
{
|
||||
tsip_stack_t *stack = _stack;
|
||||
tsip_dialog_publish_t *dialog;
|
||||
|
||||
if((dialog = (tsip_dialog_publish_t*)tsip_dialog_layer_find_by_op(stack->layer_dialog, tsip_dialog_publish, operation))){
|
||||
ret = tsip_dialog_publish_modify(dialog);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Failed to find PUBLISH dialog with this opid [%lld]", tsip_operation_get_id(operation));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tsip_publish_remove(tsip_stack_handle_t *_stack, const tsip_operation_handle_t *operation)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if(_stack && operation)
|
||||
{
|
||||
tsip_stack_t *stack = _stack;
|
||||
tsip_dialog_publish_t *dialog;
|
||||
|
||||
if((dialog = (tsip_dialog_publish_t*)tsip_dialog_layer_find_by_op(stack->layer_dialog, tsip_dialog_publish, operation))){
|
||||
ret = tsip_dialog_publish_remove(dialog);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Failed to find PUBLISH dialog with this opid [%lld]", tsip_operation_get_id(operation));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tsip_unpublish(tsip_stack_handle_t *_stack, const tsip_operation_handle_t *operation)
|
||||
{
|
||||
if(_stack && operation)
|
||||
{
|
||||
//const tsip_stack_t *stack = self;
|
||||
//tsip_operation_handle_t *op = tsip_operation_clone(operation);
|
||||
|
||||
//tsk_list_push_back_data(stack->operations, (void**)&op);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//========================================================
|
||||
// SIP PUBLISH event object definition
|
||||
//
|
||||
static void* tsip_publish_event_create(void * self, va_list * app)
|
||||
{
|
||||
tsip_publish_event_t *sipevent = self;
|
||||
if(sipevent){
|
||||
sipevent->type = va_arg(*app, tsip_publish_event_type_t);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tsip_publish_event_destroy(void * self)
|
||||
{
|
||||
tsip_publish_event_t *sipevent = self;
|
||||
if(sipevent){
|
||||
tsip_event_deinit(TSIP_EVENT(sipevent));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static int tsip_publish_event_cmp(const void *obj1, const void *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tsip_publish_event_def_s =
|
||||
{
|
||||
sizeof(tsip_publish_event_t),
|
||||
tsip_publish_event_create,
|
||||
tsip_publish_event_destroy,
|
||||
tsip_publish_event_cmp,
|
||||
};
|
||||
const void *tsip_publish_event_def_t = &tsip_publish_event_def_s;
|
|
@ -59,14 +59,12 @@ int tsip_subscribe(tsip_stack_handle_t *_stack, const tsip_operation_handle_t *o
|
|||
tsip_dialog_subscribe_t *dialog;
|
||||
|
||||
dialog = (tsip_dialog_subscribe_t*)tsip_dialog_layer_find_by_op(stack->layer_dialog, tsip_dialog_subscribe, operation);
|
||||
if(dialog)
|
||||
{
|
||||
if(dialog){
|
||||
TSK_DEBUG_WARN("Already subscribeed.");
|
||||
ret = -2;
|
||||
goto bail;
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
dialog = TSIP_DIALOG_SUBSCRIBE_CREATE(stack, operation);
|
||||
ret = tsip_dialog_subscribe_start(dialog);
|
||||
tsk_list_push_back_data(stack->layer_dialog->dialogs, (void**)&dialog);
|
||||
|
@ -107,8 +105,7 @@ int tsip_unsubscribe(tsip_stack_handle_t *_stack, const tsip_operation_handle_t
|
|||
static void* tsip_subscribe_event_create(void * self, va_list * app)
|
||||
{
|
||||
tsip_subscribe_event_t *sipevent = self;
|
||||
if(sipevent)
|
||||
{
|
||||
if(sipevent){
|
||||
sipevent->type = va_arg(*app, tsip_subscribe_event_type_t);
|
||||
}
|
||||
return self;
|
||||
|
@ -117,8 +114,7 @@ static void* tsip_subscribe_event_create(void * self, va_list * app)
|
|||
static void* tsip_subscribe_event_destroy(void * self)
|
||||
{
|
||||
tsip_subscribe_event_t *sipevent = self;
|
||||
if(sipevent)
|
||||
{
|
||||
if(sipevent){
|
||||
tsip_event_deinit(TSIP_EVENT(sipevent));
|
||||
}
|
||||
return self;
|
||||
|
|
|
@ -122,8 +122,8 @@ int tsip_dialog_message_event_callback(const tsip_dialog_message_t *self, tsip_d
|
|||
TSK_DEBUG_WARN("Not supported status code: %d", status_code);
|
||||
}
|
||||
}
|
||||
else // REQUEST ==> Incoming MESSAGE
|
||||
{
|
||||
else{
|
||||
// REQUEST ==> Incoming MESSAGE
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_receiveMESSAGE, self, msg, self, msg);
|
||||
}
|
||||
}
|
||||
|
@ -230,10 +230,9 @@ int tsip_dialog_message_start(tsip_dialog_message_t *self)
|
|||
size_t content_length = 0;
|
||||
tsip_request_t* request;
|
||||
|
||||
|
||||
if((request = tsip_dialog_request_new(TSIP_DIALOG(self), "MESSAGE"))){
|
||||
/* content-length */
|
||||
if((param = tsip_operation_get_param(TSIP_DIALOG(self)->operation, "content-length"))){
|
||||
if((param = tsip_operation_get_header(TSIP_DIALOG(self)->operation, "Content-Length"))){
|
||||
content_length = atoi(param->value);
|
||||
}
|
||||
/* content */
|
||||
|
|
|
@ -0,0 +1,670 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as publishd by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tsip_dialog_publish.c
|
||||
* @brief SIP dialog PUBLISH as per RFC 3903.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinysip/dialogs/tsip_dialog_publish.h"
|
||||
|
||||
#include "tinysip/headers/tsip_header_Min_Expires.h"
|
||||
#include "tinysip/headers/tsip_header_SIP_ETag.h"
|
||||
#include "tinysip/headers/tsip_header_SIP_If_Match.h"
|
||||
|
||||
#include "tinysip/tsip_message.h"
|
||||
|
||||
#include "tinysip/api/tsip_api_publish.h"
|
||||
|
||||
#include "tsk_debug.h"
|
||||
#include "tsk_time.h"
|
||||
|
||||
/**@defgroup tsip_dialog_publish_group SIP dialog PUBLISH (Client side) as per RFC 3265.
|
||||
*/
|
||||
|
||||
#define DEBUG_STATE_MACHINE 1
|
||||
#define TSIP_DIALOG_PUBLISH_TIMER_SCHEDULE(TX) TSIP_DIALOG_TIMER_SCHEDULE(publish, TX)
|
||||
#define TSIP_DIALOG_PUBLISH_SIGNAL(self, type, code, phrase, message) \
|
||||
tsip_publish_event_signal(type, TSIP_DIALOG_GET_STACK(self), tsip_operation_get_id(TSIP_DIALOG(self)->operation), code, phrase, message)
|
||||
|
||||
/* ======================== internal functions ======================== */
|
||||
int send_publish(tsip_dialog_publish_t *self, refresh_type_t rtype);
|
||||
int tsip_dialog_publish_OnTerminated(tsip_dialog_publish_t *self);
|
||||
|
||||
/* ======================== transitions ======================== */
|
||||
int tsip_dialog_publish_Started_2_Trying_X_send(va_list *app);
|
||||
int tsip_dialog_publish_Trying_2_Trying_X_1xx(va_list *app);
|
||||
int tsip_dialog_publish_Trying_2_Terminated_X_2xx(va_list *app);
|
||||
int tsip_dialog_publish_Trying_2_Connected_X_2xx(va_list *app);
|
||||
int tsip_dialog_publish_Trying_2_Trying_X_401_407_421_494(va_list *app);
|
||||
int tsip_dialog_publish_Trying_2_Trying_X_423(va_list *app);
|
||||
int tsip_dialog_publish_Trying_2_Terminated_X_300_to_699(va_list *app);
|
||||
int tsip_dialog_publish_Trying_2_Terminated_X_cancel(va_list *app);
|
||||
int tsip_dialog_publish_Connected_2_Trying_X_unpublish(va_list *app);
|
||||
int tsip_dialog_publish_Connected_2_Trying_X_refresh(va_list *app);
|
||||
int tsip_dialog_publish_Any_2_Trying_X_hangup(va_list *app);
|
||||
int tsip_dialog_publish_Any_2_Terminated_X_transportError(va_list *app);
|
||||
int tsip_dialog_publish_Any_2_Terminated_X_Error(va_list *app);
|
||||
|
||||
/* ======================== conds ======================== */
|
||||
int _fsm_cond_unpublishing(tsip_dialog_publish_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return dialog->unpublishing ? 1 : 0;
|
||||
}
|
||||
int _fsm_cond_publishing(tsip_dialog_publish_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return !_fsm_cond_unpublishing(dialog, message);
|
||||
}
|
||||
|
||||
|
||||
/* ======================== actions ======================== */
|
||||
typedef enum _fsm_action_e
|
||||
{
|
||||
_fsm_action_send,
|
||||
_fsm_action_1xx,
|
||||
_fsm_action_2xx,
|
||||
_fsm_action_401_407_421_494,
|
||||
_fsm_action_423,
|
||||
_fsm_action_300_to_699,
|
||||
_fsm_action_cancel,
|
||||
_fsm_action_unpublish,
|
||||
_fsm_action_refresh,
|
||||
_fsm_action_hangup,
|
||||
_fsm_action_transporterror,
|
||||
_fsm_action_error,
|
||||
}
|
||||
_fsm_action_t;
|
||||
|
||||
/* ======================== states ======================== */
|
||||
typedef enum _fsm_state_e
|
||||
{
|
||||
_fsm_state_Started,
|
||||
_fsm_state_Trying,
|
||||
_fsm_state_Connected,
|
||||
_fsm_state_Terminated
|
||||
}
|
||||
_fsm_state_t;
|
||||
|
||||
|
||||
/**
|
||||
* Callback function called to alert the dialog for new events from the transaction/transport layers.
|
||||
*
|
||||
* @param [in,out] self A reference to the dialog.
|
||||
* @param type The event type.
|
||||
* @param [in,out] msg The incoming SIP/IMS message.
|
||||
*
|
||||
* @return Zero if succeed and non-zero error code otherwise.
|
||||
**/
|
||||
int tsip_dialog_publish_event_callback(const tsip_dialog_publish_t *self, tsip_dialog_event_type_t type, const tsip_message_t *msg)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case tsip_dialog_i_msg:
|
||||
{
|
||||
if(msg && TSIP_MESSAGE_IS_RESPONSE(msg))
|
||||
{
|
||||
//
|
||||
// RESPONSE
|
||||
//
|
||||
if(TSIP_RESPONSE_IS_1XX(msg)){
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_1xx, self, msg, self, msg);
|
||||
}
|
||||
else if(TSIP_RESPONSE_IS_2XX(msg)){
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_2xx, self, msg, self, msg);
|
||||
}
|
||||
else if(TSIP_RESPONSE_IS(msg,401) || TSIP_RESPONSE_IS(msg,407) || TSIP_RESPONSE_IS(msg,421) || TSIP_RESPONSE_IS(msg,494)){
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_401_407_421_494, self, msg, self, msg);
|
||||
}
|
||||
else if(TSIP_RESPONSE_IS(msg,423)){
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_423, self, msg, self, msg);
|
||||
}
|
||||
else{
|
||||
// Alert User
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_error, self, msg, self, msg);
|
||||
TSK_DEBUG_WARN("Not supported status code: %d", TSIP_RESPONSE_CODE(msg));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// REQUEST
|
||||
//
|
||||
if(tsk_striequals(TSIP_REQUEST_METHOD(msg), "PUBLISH")){
|
||||
// FIXME: send loop detected
|
||||
}
|
||||
else{
|
||||
// FIXME: Method not suported
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_dialog_hang_up:
|
||||
{
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_hangup, self, msg, self, msg);
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_dialog_canceled:
|
||||
{
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_cancel, self, msg, self, msg);
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_dialog_terminated:
|
||||
case tsip_dialog_timedout:
|
||||
case tsip_dialog_error:
|
||||
case tsip_dialog_transport_error:
|
||||
{
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_transporterror, self, msg, self, msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timer manager callback.
|
||||
*
|
||||
* @param [in,out] self The owner of the signaled timer.
|
||||
* @param timer_id The identifier of the signaled timer.
|
||||
*
|
||||
* @return Zero if succeed and non-zero error code otherwise.
|
||||
**/
|
||||
int tsip_dialog_publish_timer_callback(const tsip_dialog_publish_t* self, tsk_timer_id_t timer_id)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if(self)
|
||||
{
|
||||
if(timer_id == self->timerrefresh.id){
|
||||
tsk_fsm_act(self->fsm, _fsm_action_refresh, self, TSK_NULL, self, TSK_NULL, rt_timedout);
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the dialog.
|
||||
*
|
||||
* @param [in,out] self The dialog to initialize.
|
||||
**/
|
||||
int tsip_dialog_publish_init(tsip_dialog_publish_t *self)
|
||||
{
|
||||
/* Initialize the State Machine. */
|
||||
tsk_fsm_set(self->fsm,
|
||||
|
||||
/*=======================
|
||||
* === Started ===
|
||||
*/
|
||||
// Started -> (Send) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Started, _fsm_action_send, _fsm_state_Trying, tsip_dialog_publish_Started_2_Trying_X_send, "tsip_dialog_publish_Started_2_Trying_X_send"),
|
||||
// Started -> (Any) -> Started
|
||||
TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Started, "tsip_dialog_publish_Started_2_Started_X_any"),
|
||||
|
||||
|
||||
/*=======================
|
||||
* === Trying ===
|
||||
*/
|
||||
// Trying -> (1xx) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_1xx, _fsm_state_Trying, tsip_dialog_publish_Trying_2_Trying_X_1xx, "tsip_dialog_publish_Trying_2_Trying_X_1xx"),
|
||||
// Trying -> (2xx) -> Terminated
|
||||
TSK_FSM_ADD(_fsm_state_Trying, _fsm_action_2xx, _fsm_cond_unpublishing, _fsm_state_Terminated, tsip_dialog_publish_Trying_2_Terminated_X_2xx, "tsip_dialog_publish_Trying_2_Terminated_X_2xx"),
|
||||
// Trying -> (2xx) -> Connected
|
||||
TSK_FSM_ADD(_fsm_state_Trying, _fsm_action_2xx, _fsm_cond_publishing, _fsm_state_Connected, tsip_dialog_publish_Trying_2_Connected_X_2xx, "tsip_dialog_publish_Trying_2_Connected_X_2xx"),
|
||||
// Trying -> (401/407/421/494) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_401_407_421_494, _fsm_state_Trying, tsip_dialog_publish_Trying_2_Trying_X_401_407_421_494, "tsip_dialog_publish_Trying_2_Trying_X_401_407_421_494"),
|
||||
// Trying -> (423) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_423, _fsm_state_Trying, tsip_dialog_publish_Trying_2_Trying_X_423, "tsip_dialog_publish_Trying_2_Trying_X_423"),
|
||||
// Trying -> (300_to_699) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_300_to_699, _fsm_state_Terminated, tsip_dialog_publish_Trying_2_Terminated_X_300_to_699, "tsip_dialog_publish_Trying_2_Terminated_X_300_to_699"),
|
||||
// Trying -> (cancel) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_cancel, _fsm_state_Terminated, tsip_dialog_publish_Trying_2_Terminated_X_cancel, "tsip_dialog_publish_Trying_2_Terminated_X_cancel"),
|
||||
// Trying -> (Any) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Trying, "tsip_dialog_publish_Trying_2_Trying_X_any"),
|
||||
|
||||
|
||||
/*=======================
|
||||
* === Connected ===
|
||||
*/
|
||||
// Connected -> (unpublish) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Connected, _fsm_action_unpublish, _fsm_state_Trying, tsip_dialog_publish_Connected_2_Trying_X_unpublish, "tsip_dialog_publish_Connected_2_Trying_X_unpublish"),
|
||||
// Connected -> (refresh) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Connected, _fsm_action_refresh, _fsm_state_Trying, tsip_dialog_publish_Connected_2_Trying_X_refresh, "tsip_dialog_publish_Connected_2_Trying_X_refresh"),
|
||||
// Connected -> (Any) -> Connected
|
||||
TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Connected, "tsip_dialog_publish_Connected_2_Connected_X_any"),
|
||||
|
||||
/*=======================
|
||||
* === Any ===
|
||||
*/
|
||||
// Any -> (transport error) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_transporterror, _fsm_state_Terminated, tsip_dialog_publish_Any_2_Terminated_X_transportError, "tsip_dialog_publish_Any_2_Terminated_X_transportError"),
|
||||
// Any -> (transport error) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_error, _fsm_state_Terminated, tsip_dialog_publish_Any_2_Terminated_X_Error, "tsip_dialog_publish_Any_2_Terminated_X_Error"),
|
||||
// Any -> (hangup) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_hangup, _fsm_state_Trying, tsip_dialog_publish_Any_2_Trying_X_hangup, "tsip_dialog_publish_Any_2_Trying_X_hangup"),
|
||||
|
||||
TSK_FSM_ADD_NULL());
|
||||
|
||||
TSIP_DIALOG(self)->callback = TSIP_DIALOG_EVENT_CALLBACK(tsip_dialog_publish_event_callback);
|
||||
|
||||
self->timerrefresh.id = TSK_INVALID_TIMER_ID;
|
||||
self->timerrefresh.timeout = TSIP_DIALOG(self)->expires;
|
||||
self->last_rtype = rt_initial;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tsip_dialog_publish_start(tsip_dialog_publish_t *self)
|
||||
{
|
||||
int ret = -1;
|
||||
if(self && !TSIP_DIALOG(self)->running){
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_send, self, TSK_NULL, self, TSK_NULL);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tsip_dialog_publish_modify(tsip_dialog_publish_t *self)
|
||||
{
|
||||
if(self && TSIP_DIALOG(self)->running){
|
||||
return tsk_fsm_act(self->fsm, _fsm_action_refresh, self, TSK_NULL, self, TSK_NULL, rt_modify);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int tsip_dialog_publish_remove(tsip_dialog_publish_t *self)
|
||||
{
|
||||
if(self && TSIP_DIALOG(self)->running){
|
||||
return tsk_fsm_act(self->fsm, _fsm_action_refresh, self, TSK_NULL, self, TSK_NULL, rt_remove);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
// == STATE MACHINE BEGIN ==
|
||||
//--------------------------------------------------------
|
||||
|
||||
|
||||
/* Started -> (send) -> Trying
|
||||
*/
|
||||
int tsip_dialog_publish_Started_2_Trying_X_send(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
TSIP_DIALOG(self)->running = 1;
|
||||
|
||||
return send_publish(self, rt_initial);
|
||||
}
|
||||
|
||||
/* Trying -> (1xx) -> Trying
|
||||
*/
|
||||
int tsip_dialog_publish_Trying_2_Trying_X_1xx(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Trying -> (2xx) -> Terminated
|
||||
*/
|
||||
int tsip_dialog_publish_Trying_2_Terminated_X_2xx(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Trying -> (2xx) -> Connected
|
||||
*/
|
||||
int tsip_dialog_publish_Trying_2_Connected_X_2xx(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
/* RFC 3903 - 4.1. Identification of Published Event State
|
||||
For each successful PUBLISH request, the ESC will generate and assign
|
||||
an entity-tag and return it in the SIP-ETag header field of the 2xx
|
||||
response.
|
||||
*/
|
||||
const tsip_header_SIP_ETag_t *SIP_ETag;
|
||||
if((SIP_ETag = (const tsip_header_SIP_ETag_t*)tsip_message_get_header(response, tsip_htype_SIP_ETag))){
|
||||
tsk_strupdate(&self->etag, SIP_ETag->value);
|
||||
}
|
||||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
|
||||
/* Update the dialog state. */
|
||||
tsip_dialog_update(TSIP_DIALOG(self), response);
|
||||
|
||||
/* Request timeout for dialog refresh (re-publish). */
|
||||
self->timerrefresh.timeout = tsip_dialog_get_newdelay(TSIP_DIALOG(self), response);
|
||||
TSIP_DIALOG_PUBLISH_TIMER_SCHEDULE(refresh);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Trying -> (401/407/421/494) -> Trying
|
||||
*/
|
||||
int tsip_dialog_publish_Trying_2_Trying_X_401_407_421_494(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
if(tsip_dialog_update(TSIP_DIALOG(self), response)){
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return send_publish(self, self->last_rtype);
|
||||
}
|
||||
|
||||
/* Trying -> (423) -> Trying
|
||||
*/
|
||||
int tsip_dialog_publish_Trying_2_Trying_X_423(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
tsip_header_Min_Expires_t *hdr;
|
||||
|
||||
/*
|
||||
RFC 3261 - 10.2.8 Error Responses
|
||||
|
||||
If a UA receives a 423 (Interval Too Brief) response, it MAY retry
|
||||
the registration after making the expiration interval of all contact
|
||||
addresses in the PUBLISH request equal to or greater than the
|
||||
expiration interval within the Min-Expires header field of the 423
|
||||
(Interval Too Brief) response.
|
||||
*/
|
||||
hdr = (tsip_header_Min_Expires_t*)tsip_message_get_header(response, tsip_htype_Min_Expires);
|
||||
if(hdr){
|
||||
TSIP_DIALOG(self)->expires = hdr->value;
|
||||
send_publish(self, self->last_rtype);
|
||||
}
|
||||
else{
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
715, "Invalid SIP response.", response);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Trying -> (300 to 699) -> Terminated
|
||||
*/
|
||||
int tsip_dialog_publish_Trying_2_Terminated_X_300_to_699(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Trying -> (cancel) -> Terminated
|
||||
*/
|
||||
int tsip_dialog_publish_Trying_2_Terminated_X_cancel(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_message_t *message = va_arg(*app, const tsip_message_t *);
|
||||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
701, "Subscription cancelled", TSIP_NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Connected -> (unpublish) -> Trying
|
||||
*/
|
||||
int tsip_dialog_publish_Connected_2_Trying_X_unpublish(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_message_t *message = va_arg(*app, const tsip_message_t *);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Connected -> (refresh) -> Trying
|
||||
*/
|
||||
int tsip_dialog_publish_Connected_2_Trying_X_refresh(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_message_t *message = va_arg(*app, const tsip_message_t *);
|
||||
refresh_type_t rtype = va_arg(*app, refresh_type_t);
|
||||
|
||||
return send_publish(self, rtype);
|
||||
}
|
||||
|
||||
/* Connected -> (hangup) -> Trying
|
||||
*/
|
||||
int tsip_dialog_publish_Any_2_Trying_X_hangup(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_message_t *message = va_arg(*app, const tsip_message_t *);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Any -> (transport error) -> Terminated
|
||||
*/
|
||||
int tsip_dialog_publish_Any_2_Terminated_X_transportError(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_message_t *message = va_arg(*app, const tsip_message_t *);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Any -> (Error) -> Terminated
|
||||
*/
|
||||
int tsip_dialog_publish_Any_2_Terminated_X_Error(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
const tsip_message_t *message = va_arg(*app, const tsip_message_t *);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// == STATE MACHINE END ==
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
|
||||
/**
|
||||
* Sends a PUBLISH request.
|
||||
**/
|
||||
int send_publish(tsip_dialog_publish_t *self, refresh_type_t rtype)
|
||||
{
|
||||
tsip_request_t *request;
|
||||
int ret = -1;
|
||||
int addbody;
|
||||
|
||||
/* IMPORTANT: Update last refresh type before trying (because of 423, 401, 407, ...)*/
|
||||
|
||||
if(self->unpublishing){
|
||||
TSIP_DIALOG(self)->expires = 0;
|
||||
self->last_rtype = rt_remove; /* Who know? */
|
||||
}
|
||||
else{
|
||||
self->last_rtype = rtype;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* RFC 3903 - 4.1. Identification of Published Event State
|
||||
The presence of a body and the SIP-If-Match header field determine
|
||||
the specific operation that the request is performing, as described in Table 1.
|
||||
+-----------+-------+---------------+---------------+
|
||||
| Operation | Body? | SIP-If-Match? | Expires Value |
|
||||
+-----------+-------+---------------+---------------+
|
||||
| Initial | yes | no | > 0 |
|
||||
| Refresh | no | yes | > 0 |
|
||||
| Modify | yes | yes | > 0 |
|
||||
| Remove | no | yes | 0 |
|
||||
+-----------+-------+---------------+---------------+
|
||||
Table 1: Publication Operations
|
||||
*/
|
||||
addbody = (TSIP_DIALOG(self)->expires > 0 && rtype == rt_initial) /* Initial */
|
||||
|| (TSIP_DIALOG(self)->expires > 0 && rtype == rt_modify); /* Modify */
|
||||
|
||||
if((request = tsip_dialog_request_new(TSIP_DIALOG(self), "PUBLISH"))){
|
||||
/*Etag. If initial then etag is null. */
|
||||
if(self->etag){
|
||||
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_SIP_IF_MATCH_VA_ARGS(self->etag));
|
||||
}
|
||||
/*Body*/
|
||||
if(addbody){
|
||||
const tsk_param_t* param;
|
||||
const void* content = TSIP_NULL;
|
||||
size_t content_length = 0;
|
||||
|
||||
/* content-length */
|
||||
if((param = tsip_operation_get_header(TSIP_DIALOG(self)->operation, "Content-Length"))){
|
||||
content_length = atoi(param->value);
|
||||
}
|
||||
/* content */
|
||||
if((param = tsip_operation_get_param(TSIP_DIALOG(self)->operation, "content"))){
|
||||
content = param->value;
|
||||
if(!content_length && content){
|
||||
content_length = strlen(content);
|
||||
}
|
||||
if(content){
|
||||
tsip_message_add_content(request, TSIP_NULL, content, content_length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = tsip_dialog_request_send(TSIP_DIALOG(self), request);
|
||||
TSK_OBJECT_SAFE_FREE(request);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function called by the state machine manager to signal that the final state has been reached.
|
||||
*
|
||||
* @param [in,out] self The state machine owner.
|
||||
**/
|
||||
int tsip_dialog_publish_OnTerminated(tsip_dialog_publish_t *self)
|
||||
{
|
||||
TSK_DEBUG_INFO("=== PUBLISH Dialog terminated ===");
|
||||
|
||||
/* Cancel all timers */
|
||||
DIALOG_TIMER_CANCEL(refresh);
|
||||
|
||||
/* Remove from the dialog layer. */
|
||||
return tsip_dialog_remove(TSIP_DIALOG(self));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//========================================================
|
||||
// SIP dialog PUBLISH object definition
|
||||
//
|
||||
static void* tsip_dialog_publish_create(void * self, va_list * app)
|
||||
{
|
||||
tsip_dialog_publish_t *dialog = self;
|
||||
if(dialog)
|
||||
{
|
||||
tsip_stack_handle_t *stack = va_arg(*app, tsip_stack_handle_t *);
|
||||
tsip_operation_handle_t *operation = va_arg(*app, tsip_operation_handle_t *);
|
||||
|
||||
/* create FSM */
|
||||
dialog->fsm = TSK_FSM_CREATE(_fsm_state_Started, _fsm_state_Terminated);
|
||||
dialog->fsm->debug = DEBUG_STATE_MACHINE;
|
||||
tsk_fsm_set_callback_terminated(dialog->fsm, TSK_FSM_ONTERMINATED(tsip_dialog_publish_OnTerminated), (const void*)dialog);
|
||||
|
||||
/* init base class */
|
||||
tsip_dialog_init(TSIP_DIALOG(self), tsip_dialog_publish, stack, 0, operation);
|
||||
|
||||
/* init the class itself */
|
||||
tsip_dialog_publish_init(self);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tsip_dialog_publish_destroy(void * self)
|
||||
{
|
||||
tsip_dialog_publish_t *dialog = self;
|
||||
if(dialog)
|
||||
{
|
||||
/* deinit base class */
|
||||
tsip_dialog_deinit(TSIP_DIALOG(self));
|
||||
|
||||
/* FSM */
|
||||
TSK_OBJECT_SAFE_FREE(dialog->fsm);
|
||||
|
||||
/* deinit self*/
|
||||
TSK_FREE(dialog->etag);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static int tsip_dialog_publish_cmp(const void *dialog1, const void *dialog2)
|
||||
{
|
||||
return tsip_dialog_cmp(dialog1, dialog2);
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tsip_dialog_publish_def_s =
|
||||
{
|
||||
sizeof(tsip_dialog_publish_t),
|
||||
tsip_dialog_publish_create,
|
||||
tsip_dialog_publish_destroy,
|
||||
tsip_dialog_publish_cmp,
|
||||
};
|
||||
const void *tsip_dialog_publish_def_t = &tsip_dialog_publish_def_s;
|
|
@ -216,8 +216,7 @@ int tsip_dialog_register_timer_callback(const tsip_dialog_register_t* self, tsk_
|
|||
|
||||
if(self)
|
||||
{
|
||||
if(timer_id == self->timerrefresh.id)
|
||||
{
|
||||
if(timer_id == self->timerrefresh.id){
|
||||
ret = tsk_fsm_act((self)->fsm, _fsm_action_refresh, self, TSK_NULL, self, TSK_NULL);
|
||||
}
|
||||
}
|
||||
|
@ -335,6 +334,8 @@ int tsip_dialog_register_Started_2_Trying_X_send(va_list *app)
|
|||
tsip_dialog_register_t *self = va_arg(*app, tsip_dialog_register_t *);
|
||||
const tsip_message_t *message = va_arg(*app, const tsip_message_t *);
|
||||
|
||||
TSIP_DIALOG(self)->running = 1;
|
||||
|
||||
return send_register(self, TSIP_TRUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
#include "tsk_debug.h"
|
||||
#include "tsk_time.h"
|
||||
|
||||
/**@defgroup tsip_dialog_subscribe_group SIP dialog SUBSCRIBE (Client side) as per RFC 3265.
|
||||
*/
|
||||
|
||||
#define DEBUG_STATE_MACHINE 1
|
||||
#define TSIP_DIALOG_SUBSCRIBE_TIMER_SCHEDULE(TX) TSIP_DIALOG_TIMER_SCHEDULE(subscribe, TX)
|
||||
#define TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, type, code, phrase, message) \
|
||||
|
@ -123,13 +126,7 @@ typedef enum _fsm_state_e
|
|||
_fsm_state_t;
|
||||
|
||||
/**
|
||||
* @fn int tsip_dialog_subscribe_event_callback(const tsip_dialog_subscribe_t *self, tsip_dialog_event_type_t type,
|
||||
* const tsip_message_t *msg)
|
||||
*
|
||||
* @brief Callback function called to alert the dialog for new events from the transaction/transport layers.
|
||||
*
|
||||
* @author Mamadou
|
||||
* @date 1/4/2010
|
||||
* Callback function called to alert the dialog for new events from the transaction/transport layers.
|
||||
*
|
||||
* @param [in,out] self A reference to the dialog.
|
||||
* @param type The event type.
|
||||
|
@ -150,24 +147,19 @@ int tsip_dialog_subscribe_event_callback(const tsip_dialog_subscribe_t *self, ts
|
|||
//
|
||||
// RESPONSE
|
||||
//
|
||||
if(TSIP_RESPONSE_IS_1XX(msg))
|
||||
{
|
||||
if(TSIP_RESPONSE_IS_1XX(msg)){
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_1xx, self, msg, self, msg);
|
||||
}
|
||||
else if(TSIP_RESPONSE_IS_2XX(msg))
|
||||
{
|
||||
else if(TSIP_RESPONSE_IS_2XX(msg)){
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_2xx, self, msg, self, msg);
|
||||
}
|
||||
else if(TSIP_RESPONSE_IS(msg,401) || TSIP_RESPONSE_IS(msg,407) || TSIP_RESPONSE_IS(msg,421) || TSIP_RESPONSE_IS(msg,494))
|
||||
{
|
||||
else if(TSIP_RESPONSE_IS(msg,401) || TSIP_RESPONSE_IS(msg,407) || TSIP_RESPONSE_IS(msg,421) || TSIP_RESPONSE_IS(msg,494)){
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_401_407_421_494, self, msg, self, msg);
|
||||
}
|
||||
else if(TSIP_RESPONSE_IS(msg,423))
|
||||
{
|
||||
else if(TSIP_RESPONSE_IS(msg,423)){
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_423, self, msg, self, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
// Alert User
|
||||
ret = tsk_fsm_act(self->fsm, _fsm_action_error, self, msg, self, msg);
|
||||
TSK_DEBUG_WARN("Not supported status code: %d", TSIP_RESPONSE_CODE(msg));
|
||||
|
@ -181,9 +173,13 @@ int tsip_dialog_subscribe_event_callback(const tsip_dialog_subscribe_t *self, ts
|
|||
if(tsk_striequals(TSIP_REQUEST_METHOD(msg), "NOTIFY")){
|
||||
ret = tsk_fsm_act((self)->fsm, _fsm_action_notify, self, msg, self, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: send something
|
||||
else{
|
||||
if(tsk_striequals(TSIP_REQUEST_METHOD(msg), "SUBSCRIBE")){
|
||||
// FIXME: send loop detected
|
||||
}
|
||||
else{
|
||||
// FIXME: Method not suported
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -234,8 +230,7 @@ int tsip_dialog_subscribe_timer_callback(const tsip_dialog_subscribe_t* self, ts
|
|||
|
||||
if(self)
|
||||
{
|
||||
if(timer_id == self->timerrefresh.id)
|
||||
{
|
||||
if(timer_id == self->timerrefresh.id){
|
||||
tsk_fsm_act(self->fsm, _fsm_action_refresh, self, TSK_NULL, self, TSK_NULL);
|
||||
ret = 0;
|
||||
}
|
||||
|
@ -308,8 +303,8 @@ int tsip_dialog_subscribe_init(tsip_dialog_subscribe_t *self)
|
|||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_transporterror, _fsm_state_Terminated, tsip_dialog_subscribe_Any_2_Terminated_X_transportError, "tsip_dialog_subscribe_Any_2_Terminated_X_transportError"),
|
||||
// Any -> (transport error) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_error, _fsm_state_Terminated, tsip_dialog_subscribe_Any_2_Terminated_X_Error, "tsip_dialog_subscribe_Any_2_Terminated_X_Error"),
|
||||
// Any -> (hangup) -> Terminated
|
||||
// Any -> (hangup) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_hangup, _fsm_state_Trying, tsip_dialog_subscribe_Any_2_Trying_X_hangup, "tsip_dialog_subscribe_Any_2_Trying_X_hangup"),
|
||||
|
||||
TSK_FSM_ADD_NULL());
|
||||
|
||||
|
@ -344,6 +339,8 @@ int tsip_dialog_subscribe_Started_2_Trying_X_send(va_list *app)
|
|||
tsip_dialog_subscribe_t *self = va_arg(*app, tsip_dialog_subscribe_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
TSIP_DIALOG(self)->running = 1;
|
||||
|
||||
return send_subscribe(self);
|
||||
}
|
||||
|
||||
|
@ -399,8 +396,7 @@ int tsip_dialog_subscribe_Trying_2_Trying_X_401_407_421_494(va_list *app)
|
|||
tsip_dialog_subscribe_t *self = va_arg(*app, tsip_dialog_subscribe_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
if(tsip_dialog_update(TSIP_DIALOG(self), response))
|
||||
{
|
||||
if(tsip_dialog_update(TSIP_DIALOG(self), response)){
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, self->unsubscribing ? tsip_ao_unsubscribe : tsip_ao_subscribe,
|
||||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
|
@ -430,13 +426,11 @@ int tsip_dialog_subscribe_Trying_2_Trying_X_423(va_list *app)
|
|||
(Interval Too Brief) response.
|
||||
*/
|
||||
hdr = (tsip_header_Min_Expires_t*)tsip_message_get_header(response, tsip_htype_Min_Expires);
|
||||
if(hdr)
|
||||
{
|
||||
if(hdr){
|
||||
TSIP_DIALOG(self)->expires = hdr->value;
|
||||
send_subscribe(self);
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, self->unsubscribing ? tsip_ao_unsubscribe : tsip_ao_subscribe,
|
||||
715, "Invalid SIP response.", response);
|
||||
|
||||
|
@ -501,7 +495,7 @@ int tsip_dialog_subscribe_Connected_2_Trying_X_refresh(va_list *app)
|
|||
tsip_dialog_subscribe_t *self = va_arg(*app, tsip_dialog_subscribe_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
return 0;
|
||||
return send_subscribe(self);
|
||||
}
|
||||
|
||||
/* Connected -> (NOTIFY) -> Connected
|
||||
|
@ -574,12 +568,7 @@ int tsip_dialog_subscribe_Any_2_Terminated_X_Error(va_list *app)
|
|||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
/**
|
||||
* @fn int send_subscribe(tsip_dialog_subscribe_t *self)
|
||||
*
|
||||
* @brief Sends a SUBSCRIBE request.
|
||||
*
|
||||
* @author Mamadou
|
||||
* @date 1/4/2010
|
||||
* Sends a SUBSCRIBE request.
|
||||
*
|
||||
* @param [in,out] self The caller.
|
||||
*
|
||||
|
@ -615,12 +604,7 @@ int send_notify_200ok(tsip_dialog_subscribe_t *self, const tsip_request_t* reque
|
|||
}
|
||||
|
||||
/**
|
||||
* @fn int tsip_dialog_subscribe_OnTerminated(tsip_dialog_subscribe_t *self)
|
||||
*
|
||||
* @brief Callback function called by the state machine manager to signal that the final state has been reached.
|
||||
*
|
||||
* @author Mamadou
|
||||
* @date 1/5/2010
|
||||
* Callback function called by the state machine manager to signal that the final state has been reached.
|
||||
*
|
||||
* @param [in,out] self The state machine owner.
|
||||
**/
|
||||
|
|
|
@ -313,8 +313,6 @@ _again:
|
|||
// Allow_events header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Allow_events_group
|
||||
*/
|
||||
static void* tsip_header_Allow_Events_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Allow_Events_t *Allow_events = self;
|
||||
|
@ -330,8 +328,6 @@ static void* tsip_header_Allow_Events_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Allow_events_group
|
||||
*/
|
||||
static void* tsip_header_Allow_Events_destroy(void *self)
|
||||
{
|
||||
tsip_header_Allow_Events_t *Allow_events = self;
|
||||
|
|
|
@ -286,8 +286,6 @@ _again:
|
|||
// CSeq header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_CSeq_group
|
||||
*/
|
||||
static void* tsip_header_CSeq_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_CSeq_t *CSeq = self;
|
||||
|
@ -305,8 +303,6 @@ static void* tsip_header_CSeq_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_CSeq_group
|
||||
*/
|
||||
static void* tsip_header_CSeq_destroy(void *self)
|
||||
{
|
||||
tsip_header_CSeq_t *CSeq = self;
|
||||
|
|
|
@ -295,8 +295,6 @@ _again:
|
|||
// Call_ID header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Call_ID_group
|
||||
*/
|
||||
static void* tsip_header_Call_ID_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Call_ID_t *Call_ID = self;
|
||||
|
@ -313,8 +311,6 @@ static void* tsip_header_Call_ID_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Call_ID_group
|
||||
*/
|
||||
static void* tsip_header_Call_ID_destroy(void *self)
|
||||
{
|
||||
tsip_header_Call_ID_t *Call_ID = self;
|
||||
|
|
|
@ -642,8 +642,6 @@ _again:
|
|||
// Contact header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Contact_group
|
||||
*/
|
||||
static void* tsip_header_Contact_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Contact_t *Contact = self;
|
||||
|
@ -660,8 +658,6 @@ static void* tsip_header_Contact_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Contact_group
|
||||
*/
|
||||
static void* tsip_header_Contact_destroy(void *self)
|
||||
{
|
||||
tsip_header_Contact_t *Contact = self;
|
||||
|
@ -707,8 +703,6 @@ const void *tsip_header_Contact_def_t = &tsip_header_Contact_def_s;
|
|||
// return self;
|
||||
//}
|
||||
//
|
||||
///**@ingroup tsip_header_Contact_group
|
||||
//*/
|
||||
//static void* tsip_contact_destroy(void *self)
|
||||
//{
|
||||
// tsip_contact_t *contact = self;
|
||||
|
|
|
@ -273,8 +273,6 @@ _again:
|
|||
// Content_Length header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Content_Length_group
|
||||
*/
|
||||
static void* tsip_header_Content_Length_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Content_Length_t *Content_Length = self;
|
||||
|
@ -292,8 +290,6 @@ static void* tsip_header_Content_Length_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Content_Length_group
|
||||
*/
|
||||
static void* tsip_header_Content_Length_destroy(void *self)
|
||||
{
|
||||
tsip_header_Content_Length_t *Content_Length = self;
|
||||
|
|
|
@ -383,8 +383,6 @@ _again:
|
|||
// Content_Type header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Content_Type_group
|
||||
*/
|
||||
static void* tsip_header_Content_Type_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Content_Type_t *Content_Type = self;
|
||||
|
@ -402,8 +400,6 @@ static void* tsip_header_Content_Type_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Content_Type_group
|
||||
*/
|
||||
static void* tsip_header_Content_Type_destroy(void *self)
|
||||
{
|
||||
tsip_header_Content_Type_t *Content_Type = self;
|
||||
|
|
|
@ -278,8 +278,6 @@ _again:
|
|||
// Dummy header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Dummy_group
|
||||
*/
|
||||
static void* tsip_header_Dummy_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Dummy_t *Dummy = self;
|
||||
|
@ -298,8 +296,6 @@ static void* tsip_header_Dummy_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Dummy_group
|
||||
*/
|
||||
static void* tsip_header_Dummy_destroy(void *self)
|
||||
{
|
||||
tsip_header_Dummy_t *Dummy = self;
|
||||
|
|
|
@ -425,8 +425,6 @@ _again:
|
|||
// Event header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Event_group
|
||||
*/
|
||||
static void* tsip_header_Event_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Event_t *Event = self;
|
||||
|
@ -443,8 +441,6 @@ static void* tsip_header_Event_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Event_group
|
||||
*/
|
||||
static void* tsip_header_Event_destroy(void *self)
|
||||
{
|
||||
tsip_header_Event_t *Event = self;
|
||||
|
|
|
@ -267,8 +267,6 @@ _again:
|
|||
// Expires header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Expires_group
|
||||
*/
|
||||
static void* tsip_header_Expires_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Expires_t *Expires = self;
|
||||
|
@ -285,8 +283,6 @@ static void* tsip_header_Expires_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Expires_group
|
||||
*/
|
||||
static void* tsip_header_Expires_destroy(void *self)
|
||||
{
|
||||
tsip_header_Expires_t *Expires = self;
|
||||
|
|
|
@ -533,8 +533,6 @@ _again:
|
|||
// From header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_From_group
|
||||
*/
|
||||
static void* tsip_header_From_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_From_t *From = self;
|
||||
|
@ -558,8 +556,6 @@ static void* tsip_header_From_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_From_group
|
||||
*/
|
||||
static void* tsip_header_From_destroy(void *self)
|
||||
{
|
||||
tsip_header_From_t *From = self;
|
||||
|
|
|
@ -276,8 +276,6 @@ _again:
|
|||
// Max_Forwards header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Max_Forwards_group
|
||||
*/
|
||||
static void* tsip_header_Max_Forwards_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Max_Forwards_t *Max_Forwards = self;
|
||||
|
@ -294,8 +292,6 @@ static void* tsip_header_Max_Forwards_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Max_Forwards_group
|
||||
*/
|
||||
static void* tsip_header_Max_Forwards_destroy(void *self)
|
||||
{
|
||||
tsip_header_Max_Forwards_t *Max_Forwards = self;
|
||||
|
|
|
@ -276,8 +276,6 @@ _again:
|
|||
// Min-Expires header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Min_Expires_group
|
||||
*/
|
||||
static void* tsip_header_Min_Expires_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Min_Expires_t *Min_Expires = self;
|
||||
|
@ -294,8 +292,6 @@ static void* tsip_header_Min_Expires_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Min_Expires_group
|
||||
*/
|
||||
static void* tsip_header_Min_Expires_destroy(void *self)
|
||||
{
|
||||
tsip_header_Min_Expires_t *Min_Expires = self;
|
||||
|
|
|
@ -296,8 +296,6 @@ _again:
|
|||
// P_Access_Network_Info header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_P_Access_Network_Info_group
|
||||
*/
|
||||
static void* tsip_header_P_Access_Network_Info_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_P_Access_Network_Info_t *P_Access_Network_Info = self;
|
||||
|
@ -314,8 +312,6 @@ static void* tsip_header_P_Access_Network_Info_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_P_Access_Network_Info_group
|
||||
*/
|
||||
static void* tsip_header_P_Access_Network_Info_destroy(void *self)
|
||||
{
|
||||
tsip_header_P_Access_Network_Info_t *P_Access_Network_Info = self;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -523,8 +523,6 @@ _again:
|
|||
// P_Associated_URI header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_P_Associated_URI_group
|
||||
*/
|
||||
static void* tsip_header_P_Associated_URI_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_P_Associated_URI_t *P_Associated_URI = self;
|
||||
|
@ -545,8 +543,6 @@ static void* tsip_header_P_Associated_URI_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_P_Associated_URI_group
|
||||
*/
|
||||
static void* tsip_header_P_Associated_URI_destroy(void *self)
|
||||
{
|
||||
tsip_header_P_Associated_URI_t *P_Associated_URI = self;
|
||||
|
|
|
@ -731,8 +731,6 @@ _again:
|
|||
// P_Charging_Function_Addresses header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_P_Charging_Function_Addresses_group
|
||||
*/
|
||||
static void* tsip_header_P_Charging_Function_Addresses_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_P_Charging_Function_Addresses_t *P_Charging_Function_Addresses = self;
|
||||
|
@ -748,8 +746,6 @@ static void* tsip_header_P_Charging_Function_Addresses_create(void *self, va_lis
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_P_Charging_Function_Addresses_group
|
||||
*/
|
||||
static void* tsip_header_P_Charging_Function_Addresses_destroy(void *self)
|
||||
{
|
||||
tsip_header_P_Charging_Function_Addresses_t *P_Charging_Function_Addresses = self;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -503,8 +503,6 @@ _again:
|
|||
// Path header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Path_group
|
||||
*/
|
||||
static void* tsip_header_Path_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Path_t *Path = self;
|
||||
|
@ -525,8 +523,6 @@ static void* tsip_header_Path_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Path_group
|
||||
*/
|
||||
static void* tsip_header_Path_destroy(void *self)
|
||||
{
|
||||
tsip_header_Path_t *Path = self;
|
||||
|
|
|
@ -450,8 +450,6 @@ _again:
|
|||
// Privacy header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Privacy_group
|
||||
*/
|
||||
static void* tsip_header_Privacy_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Privacy_t *Privacy = self;
|
||||
|
@ -467,8 +465,6 @@ static void* tsip_header_Privacy_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Privacy_group
|
||||
*/
|
||||
static void* tsip_header_Privacy_destroy(void *self)
|
||||
{
|
||||
tsip_header_Privacy_t *Privacy = self;
|
||||
|
|
|
@ -310,8 +310,6 @@ _again:
|
|||
// Proxy_Require header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Proxy_Require_group
|
||||
*/
|
||||
static void* tsip_header_Proxy_Require_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Proxy_Require_t *Proxy_Require = self;
|
||||
|
@ -336,8 +334,6 @@ static void* tsip_header_Proxy_Require_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Proxy_Require_group
|
||||
*/
|
||||
static void* tsip_header_Proxy_Require_destroy(void *self)
|
||||
{
|
||||
tsip_header_Proxy_Require_t *Proxy_Require = self;
|
||||
|
|
|
@ -276,8 +276,6 @@ _again:
|
|||
// Record_Route header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Record_Route_group
|
||||
*/
|
||||
static void* tsip_header_Record_Route_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Record_Route_t *Record_Route = self;
|
||||
|
@ -294,8 +292,6 @@ static void* tsip_header_Record_Route_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Record_Route_group
|
||||
*/
|
||||
static void* tsip_header_Record_Route_destroy(void *self)
|
||||
{
|
||||
tsip_header_Record_Route_t *Record_Route = self;
|
||||
|
|
|
@ -300,8 +300,6 @@ _again:
|
|||
// Require header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Require_group
|
||||
*/
|
||||
static void* tsip_header_Require_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Require_t *Require = self;
|
||||
|
@ -326,8 +324,6 @@ static void* tsip_header_Require_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Require_group
|
||||
*/
|
||||
static void* tsip_header_Require_destroy(void *self)
|
||||
{
|
||||
tsip_header_Require_t *Require = self;
|
||||
|
|
|
@ -503,8 +503,6 @@ _again:
|
|||
// Route header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Route_group
|
||||
*/
|
||||
static void* tsip_header_Route_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Route_t *Route = self;
|
||||
|
@ -526,8 +524,6 @@ static void* tsip_header_Route_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Route_group
|
||||
*/
|
||||
static void* tsip_header_Route_destroy(void *self)
|
||||
{
|
||||
tsip_header_Route_t *Route = self;
|
||||
|
|
|
@ -1 +1,322 @@
|
|||
|
||||
|
||||
/* #line 1 "tsip_parser_header_SIP_ETag.rl" */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tsip_header_SIP_ETag.c
|
||||
* @brief SIP SIP-ETag header.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinysip/headers/tsip_header_SIP_ETag.h"
|
||||
|
||||
#include "tinysip/parsers/tsip_parser_uri.h"
|
||||
|
||||
#include "tsk_debug.h"
|
||||
#include "tsk_memory.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**@defgroup tsip_header_SIP_ETag_group SIP SIP_ETag header.
|
||||
*/
|
||||
|
||||
/***********************************
|
||||
* Ragel state machine.
|
||||
*/
|
||||
|
||||
/* #line 71 "tsip_parser_header_SIP_ETag.rl" */
|
||||
|
||||
|
||||
int tsip_header_SIP_ETag_tostring(const void* header, tsk_buffer_t* output)
|
||||
{
|
||||
if(header)
|
||||
{
|
||||
const tsip_header_SIP_ETag_t *SIP_ETag = header;
|
||||
if(SIP_ETag->value){
|
||||
tsk_buffer_append(output, SIP_ETag->value, strlen(SIP_ETag->value));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsip_header_SIP_ETag_t *tsip_header_SIP_ETag_parse(const char *data, size_t size)
|
||||
{
|
||||
int cs = 0;
|
||||
const char *p = data;
|
||||
const char *pe = p + size;
|
||||
const char *eof = pe;
|
||||
tsip_header_SIP_ETag_t *hdr_etag = TSIP_HEADER_SIP_ETAG_CREATE_NULL();
|
||||
|
||||
const char *tag_start;
|
||||
|
||||
|
||||
/* #line 78 "../src/headers/tsip_header_SIP_ETag.c" */
|
||||
static const char _tsip_machine_parser_header_SIP_ETag_actions[] = {
|
||||
0, 1, 0, 1, 1, 1, 2
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_ETag_key_offsets[] = {
|
||||
0, 0, 2, 4, 6, 7, 9, 11,
|
||||
13, 15, 18, 35, 36, 38, 54, 69,
|
||||
70
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_ETag_trans_keys[] = {
|
||||
83, 115, 73, 105, 80, 112, 45, 69,
|
||||
101, 84, 116, 65, 97, 71, 103, 9,
|
||||
32, 58, 9, 13, 32, 33, 37, 39,
|
||||
126, 42, 43, 45, 46, 48, 57, 65,
|
||||
90, 95, 122, 10, 9, 32, 9, 32,
|
||||
33, 37, 39, 126, 42, 43, 45, 46,
|
||||
48, 57, 65, 90, 95, 122, 13, 33,
|
||||
37, 39, 126, 42, 43, 45, 46, 48,
|
||||
57, 65, 90, 95, 122, 10, 0
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_ETag_single_lengths[] = {
|
||||
0, 2, 2, 2, 1, 2, 2, 2,
|
||||
2, 3, 7, 1, 2, 6, 5, 1,
|
||||
0
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_ETag_range_lengths[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 5, 0, 0, 5, 5, 0,
|
||||
0
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_ETag_index_offsets[] = {
|
||||
0, 0, 3, 6, 9, 11, 14, 17,
|
||||
20, 23, 27, 40, 42, 45, 57, 68,
|
||||
70
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_ETag_indicies[] = {
|
||||
0, 0, 1, 2, 2, 1, 3, 3,
|
||||
1, 4, 1, 5, 5, 1, 6, 6,
|
||||
1, 7, 7, 1, 8, 8, 1, 8,
|
||||
8, 9, 1, 9, 10, 9, 11, 11,
|
||||
11, 11, 11, 11, 11, 11, 11, 1,
|
||||
12, 1, 13, 13, 1, 13, 13, 11,
|
||||
11, 11, 11, 11, 11, 11, 11, 11,
|
||||
1, 14, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 1, 16, 1, 1, 0
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_ETag_trans_targs[] = {
|
||||
2, 0, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 14, 12, 13, 15, 14,
|
||||
16
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_ETag_trans_actions[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 3, 0,
|
||||
5
|
||||
};
|
||||
|
||||
static const int tsip_machine_parser_header_SIP_ETag_start = 1;
|
||||
static const int tsip_machine_parser_header_SIP_ETag_first_final = 16;
|
||||
static const int tsip_machine_parser_header_SIP_ETag_error = 0;
|
||||
|
||||
static const int tsip_machine_parser_header_SIP_ETag_en_main = 1;
|
||||
|
||||
|
||||
/* #line 98 "tsip_parser_header_SIP_ETag.rl" */
|
||||
|
||||
/* #line 152 "../src/headers/tsip_header_SIP_ETag.c" */
|
||||
{
|
||||
cs = tsip_machine_parser_header_SIP_ETag_start;
|
||||
}
|
||||
|
||||
/* #line 99 "tsip_parser_header_SIP_ETag.rl" */
|
||||
|
||||
/* #line 159 "../src/headers/tsip_header_SIP_ETag.c" */
|
||||
{
|
||||
int _klen;
|
||||
unsigned int _trans;
|
||||
const char *_acts;
|
||||
unsigned int _nacts;
|
||||
const char *_keys;
|
||||
|
||||
if ( p == pe )
|
||||
goto _test_eof;
|
||||
if ( cs == 0 )
|
||||
goto _out;
|
||||
_resume:
|
||||
_keys = _tsip_machine_parser_header_SIP_ETag_trans_keys + _tsip_machine_parser_header_SIP_ETag_key_offsets[cs];
|
||||
_trans = _tsip_machine_parser_header_SIP_ETag_index_offsets[cs];
|
||||
|
||||
_klen = _tsip_machine_parser_header_SIP_ETag_single_lengths[cs];
|
||||
if ( _klen > 0 ) {
|
||||
const char *_lower = _keys;
|
||||
const char *_mid;
|
||||
const char *_upper = _keys + _klen - 1;
|
||||
while (1) {
|
||||
if ( _upper < _lower )
|
||||
break;
|
||||
|
||||
_mid = _lower + ((_upper-_lower) >> 1);
|
||||
if ( (*p) < *_mid )
|
||||
_upper = _mid - 1;
|
||||
else if ( (*p) > *_mid )
|
||||
_lower = _mid + 1;
|
||||
else {
|
||||
_trans += (_mid - _keys);
|
||||
goto _match;
|
||||
}
|
||||
}
|
||||
_keys += _klen;
|
||||
_trans += _klen;
|
||||
}
|
||||
|
||||
_klen = _tsip_machine_parser_header_SIP_ETag_range_lengths[cs];
|
||||
if ( _klen > 0 ) {
|
||||
const char *_lower = _keys;
|
||||
const char *_mid;
|
||||
const char *_upper = _keys + (_klen<<1) - 2;
|
||||
while (1) {
|
||||
if ( _upper < _lower )
|
||||
break;
|
||||
|
||||
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
|
||||
if ( (*p) < _mid[0] )
|
||||
_upper = _mid - 2;
|
||||
else if ( (*p) > _mid[1] )
|
||||
_lower = _mid + 2;
|
||||
else {
|
||||
_trans += ((_mid - _keys)>>1);
|
||||
goto _match;
|
||||
}
|
||||
}
|
||||
_trans += _klen;
|
||||
}
|
||||
|
||||
_match:
|
||||
_trans = _tsip_machine_parser_header_SIP_ETag_indicies[_trans];
|
||||
cs = _tsip_machine_parser_header_SIP_ETag_trans_targs[_trans];
|
||||
|
||||
if ( _tsip_machine_parser_header_SIP_ETag_trans_actions[_trans] == 0 )
|
||||
goto _again;
|
||||
|
||||
_acts = _tsip_machine_parser_header_SIP_ETag_actions + _tsip_machine_parser_header_SIP_ETag_trans_actions[_trans];
|
||||
_nacts = (unsigned int) *_acts++;
|
||||
while ( _nacts-- > 0 )
|
||||
{
|
||||
switch ( *_acts++ )
|
||||
{
|
||||
case 0:
|
||||
/* #line 53 "tsip_parser_header_SIP_ETag.rl" */
|
||||
{
|
||||
tag_start = p;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
/* #line 58 "tsip_parser_header_SIP_ETag.rl" */
|
||||
{
|
||||
TSK_PARSER_SET_STRING(hdr_etag->value);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
/* #line 63 "tsip_parser_header_SIP_ETag.rl" */
|
||||
{
|
||||
}
|
||||
break;
|
||||
/* #line 250 "../src/headers/tsip_header_SIP_ETag.c" */
|
||||
}
|
||||
}
|
||||
|
||||
_again:
|
||||
if ( cs == 0 )
|
||||
goto _out;
|
||||
if ( ++p != pe )
|
||||
goto _resume;
|
||||
_test_eof: {}
|
||||
_out: {}
|
||||
}
|
||||
|
||||
/* #line 100 "tsip_parser_header_SIP_ETag.rl" */
|
||||
|
||||
if( cs <
|
||||
/* #line 266 "../src/headers/tsip_header_SIP_ETag.c" */
|
||||
16
|
||||
/* #line 101 "tsip_parser_header_SIP_ETag.rl" */
|
||||
)
|
||||
{
|
||||
TSK_OBJECT_SAFE_FREE(hdr_etag);
|
||||
}
|
||||
|
||||
return hdr_etag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//========================================================
|
||||
// SIP_ETag header object definition
|
||||
//
|
||||
|
||||
static void* tsip_header_SIP_ETag_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_SIP_ETag_t *SIP_ETag = self;
|
||||
if(SIP_ETag)
|
||||
{
|
||||
TSIP_HEADER(SIP_ETag)->type = tsip_htype_SIP_ETag;
|
||||
TSIP_HEADER(SIP_ETag)->tostring = tsip_header_SIP_ETag_tostring;
|
||||
SIP_ETag->value = tsk_strdup(va_arg(*app, const char*));
|
||||
}
|
||||
else
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create new SIP_ETag header.");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tsip_header_SIP_ETag_destroy(void *self)
|
||||
{
|
||||
tsip_header_SIP_ETag_t *SIP_ETag = self;
|
||||
if(SIP_ETag)
|
||||
{
|
||||
TSK_FREE(SIP_ETag->value);
|
||||
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(SIP_ETag));
|
||||
}
|
||||
else TSK_DEBUG_ERROR("Null SIP_ETag header.");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tsip_header_SIP_ETag_def_s =
|
||||
{
|
||||
sizeof(tsip_header_SIP_ETag_t),
|
||||
tsip_header_SIP_ETag_create,
|
||||
tsip_header_SIP_ETag_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_SIP_ETag_def_t = &tsip_header_SIP_ETag_def_s;
|
||||
|
|
|
@ -1 +1,326 @@
|
|||
|
||||
|
||||
/* #line 1 "tsip_parser_header_SIP_If_Match.rl" */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tsip_header_SIP_If_Match.c
|
||||
* @brief SIP SIP-If-Match header.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinysip/headers/tsip_header_SIP_If_Match.h"
|
||||
|
||||
#include "tinysip/parsers/tsip_parser_uri.h"
|
||||
|
||||
#include "tsk_debug.h"
|
||||
#include "tsk_memory.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**@defgroup tsip_header_SIP_If_Match_group SIP SIP_If_Match header.
|
||||
*/
|
||||
|
||||
/***********************************
|
||||
* Ragel state machine.
|
||||
*/
|
||||
|
||||
/* #line 71 "tsip_parser_header_SIP_If_Match.rl" */
|
||||
|
||||
|
||||
int tsip_header_SIP_If_Match_tostring(const void* header, tsk_buffer_t* output)
|
||||
{
|
||||
if(header)
|
||||
{
|
||||
const tsip_header_SIP_If_Match_t *SIP_If_Match = header;
|
||||
if(SIP_If_Match->value){
|
||||
tsk_buffer_append(output, SIP_If_Match->value, strlen(SIP_If_Match->value));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsip_header_SIP_If_Match_t *tsip_header_SIP_If_Match_parse(const char *data, size_t size)
|
||||
{
|
||||
int cs = 0;
|
||||
const char *p = data;
|
||||
const char *pe = p + size;
|
||||
const char *eof = pe;
|
||||
tsip_header_SIP_If_Match_t *hdr_ifmatch = TSIP_HEADER_SIP_IF_MATCH_CREATE_NULL();
|
||||
|
||||
const char *tag_start;
|
||||
|
||||
|
||||
/* #line 78 "../src/headers/tsip_header_SIP_If_Match.c" */
|
||||
static const char _tsip_machine_parser_header_SIP_If_Match_actions[] = {
|
||||
0, 1, 0, 1, 1, 1, 2
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_If_Match_key_offsets[] = {
|
||||
0, 0, 2, 4, 6, 7, 9, 11,
|
||||
12, 14, 16, 18, 20, 22, 25, 42,
|
||||
43, 45, 61, 76, 77
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_If_Match_trans_keys[] = {
|
||||
83, 115, 73, 105, 80, 112, 45, 73,
|
||||
105, 70, 102, 45, 77, 109, 65, 97,
|
||||
84, 116, 67, 99, 72, 104, 9, 32,
|
||||
58, 9, 13, 32, 33, 37, 39, 126,
|
||||
42, 43, 45, 46, 48, 57, 65, 90,
|
||||
95, 122, 10, 9, 32, 9, 32, 33,
|
||||
37, 39, 126, 42, 43, 45, 46, 48,
|
||||
57, 65, 90, 95, 122, 13, 33, 37,
|
||||
39, 126, 42, 43, 45, 46, 48, 57,
|
||||
65, 90, 95, 122, 10, 0
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_If_Match_single_lengths[] = {
|
||||
0, 2, 2, 2, 1, 2, 2, 1,
|
||||
2, 2, 2, 2, 2, 3, 7, 1,
|
||||
2, 6, 5, 1, 0
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_If_Match_range_lengths[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 5, 0,
|
||||
0, 5, 5, 0, 0
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_If_Match_index_offsets[] = {
|
||||
0, 0, 3, 6, 9, 11, 14, 17,
|
||||
19, 22, 25, 28, 31, 34, 38, 51,
|
||||
53, 56, 68, 79, 81
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_If_Match_indicies[] = {
|
||||
0, 0, 1, 2, 2, 1, 3, 3,
|
||||
1, 4, 1, 5, 5, 1, 6, 6,
|
||||
1, 7, 1, 8, 8, 1, 9, 9,
|
||||
1, 10, 10, 1, 11, 11, 1, 12,
|
||||
12, 1, 12, 12, 13, 1, 13, 14,
|
||||
13, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 1, 16, 1, 17, 17, 1,
|
||||
17, 17, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 1, 18, 19, 19, 19,
|
||||
19, 19, 19, 19, 19, 19, 1, 20,
|
||||
1, 1, 0
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_If_Match_trans_targs[] = {
|
||||
2, 0, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 18,
|
||||
16, 17, 19, 18, 20
|
||||
};
|
||||
|
||||
static const char _tsip_machine_parser_header_SIP_If_Match_trans_actions[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 1,
|
||||
0, 0, 3, 0, 5
|
||||
};
|
||||
|
||||
static const int tsip_machine_parser_header_SIP_If_Match_start = 1;
|
||||
static const int tsip_machine_parser_header_SIP_If_Match_first_final = 20;
|
||||
static const int tsip_machine_parser_header_SIP_If_Match_error = 0;
|
||||
|
||||
static const int tsip_machine_parser_header_SIP_If_Match_en_main = 1;
|
||||
|
||||
|
||||
/* #line 98 "tsip_parser_header_SIP_If_Match.rl" */
|
||||
|
||||
/* #line 155 "../src/headers/tsip_header_SIP_If_Match.c" */
|
||||
{
|
||||
cs = tsip_machine_parser_header_SIP_If_Match_start;
|
||||
}
|
||||
|
||||
/* #line 99 "tsip_parser_header_SIP_If_Match.rl" */
|
||||
|
||||
/* #line 162 "../src/headers/tsip_header_SIP_If_Match.c" */
|
||||
{
|
||||
int _klen;
|
||||
unsigned int _trans;
|
||||
const char *_acts;
|
||||
unsigned int _nacts;
|
||||
const char *_keys;
|
||||
|
||||
if ( p == pe )
|
||||
goto _test_eof;
|
||||
if ( cs == 0 )
|
||||
goto _out;
|
||||
_resume:
|
||||
_keys = _tsip_machine_parser_header_SIP_If_Match_trans_keys + _tsip_machine_parser_header_SIP_If_Match_key_offsets[cs];
|
||||
_trans = _tsip_machine_parser_header_SIP_If_Match_index_offsets[cs];
|
||||
|
||||
_klen = _tsip_machine_parser_header_SIP_If_Match_single_lengths[cs];
|
||||
if ( _klen > 0 ) {
|
||||
const char *_lower = _keys;
|
||||
const char *_mid;
|
||||
const char *_upper = _keys + _klen - 1;
|
||||
while (1) {
|
||||
if ( _upper < _lower )
|
||||
break;
|
||||
|
||||
_mid = _lower + ((_upper-_lower) >> 1);
|
||||
if ( (*p) < *_mid )
|
||||
_upper = _mid - 1;
|
||||
else if ( (*p) > *_mid )
|
||||
_lower = _mid + 1;
|
||||
else {
|
||||
_trans += (_mid - _keys);
|
||||
goto _match;
|
||||
}
|
||||
}
|
||||
_keys += _klen;
|
||||
_trans += _klen;
|
||||
}
|
||||
|
||||
_klen = _tsip_machine_parser_header_SIP_If_Match_range_lengths[cs];
|
||||
if ( _klen > 0 ) {
|
||||
const char *_lower = _keys;
|
||||
const char *_mid;
|
||||
const char *_upper = _keys + (_klen<<1) - 2;
|
||||
while (1) {
|
||||
if ( _upper < _lower )
|
||||
break;
|
||||
|
||||
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
|
||||
if ( (*p) < _mid[0] )
|
||||
_upper = _mid - 2;
|
||||
else if ( (*p) > _mid[1] )
|
||||
_lower = _mid + 2;
|
||||
else {
|
||||
_trans += ((_mid - _keys)>>1);
|
||||
goto _match;
|
||||
}
|
||||
}
|
||||
_trans += _klen;
|
||||
}
|
||||
|
||||
_match:
|
||||
_trans = _tsip_machine_parser_header_SIP_If_Match_indicies[_trans];
|
||||
cs = _tsip_machine_parser_header_SIP_If_Match_trans_targs[_trans];
|
||||
|
||||
if ( _tsip_machine_parser_header_SIP_If_Match_trans_actions[_trans] == 0 )
|
||||
goto _again;
|
||||
|
||||
_acts = _tsip_machine_parser_header_SIP_If_Match_actions + _tsip_machine_parser_header_SIP_If_Match_trans_actions[_trans];
|
||||
_nacts = (unsigned int) *_acts++;
|
||||
while ( _nacts-- > 0 )
|
||||
{
|
||||
switch ( *_acts++ )
|
||||
{
|
||||
case 0:
|
||||
/* #line 53 "tsip_parser_header_SIP_If_Match.rl" */
|
||||
{
|
||||
tag_start = p;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
/* #line 58 "tsip_parser_header_SIP_If_Match.rl" */
|
||||
{
|
||||
TSK_PARSER_SET_STRING(hdr_ifmatch->value);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
/* #line 63 "tsip_parser_header_SIP_If_Match.rl" */
|
||||
{
|
||||
}
|
||||
break;
|
||||
/* #line 253 "../src/headers/tsip_header_SIP_If_Match.c" */
|
||||
}
|
||||
}
|
||||
|
||||
_again:
|
||||
if ( cs == 0 )
|
||||
goto _out;
|
||||
if ( ++p != pe )
|
||||
goto _resume;
|
||||
_test_eof: {}
|
||||
_out: {}
|
||||
}
|
||||
|
||||
/* #line 100 "tsip_parser_header_SIP_If_Match.rl" */
|
||||
|
||||
if( cs <
|
||||
/* #line 269 "../src/headers/tsip_header_SIP_If_Match.c" */
|
||||
20
|
||||
/* #line 101 "tsip_parser_header_SIP_If_Match.rl" */
|
||||
)
|
||||
{
|
||||
TSK_OBJECT_SAFE_FREE(hdr_ifmatch);
|
||||
}
|
||||
|
||||
return hdr_ifmatch;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//========================================================
|
||||
// SIP_If_Match header object definition
|
||||
//
|
||||
|
||||
static void* tsip_header_SIP_If_Match_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_SIP_If_Match_t *SIP_If_Match = self;
|
||||
if(SIP_If_Match)
|
||||
{
|
||||
TSIP_HEADER(SIP_If_Match)->type = tsip_htype_SIP_If_Match;
|
||||
TSIP_HEADER(SIP_If_Match)->tostring = tsip_header_SIP_If_Match_tostring;
|
||||
SIP_If_Match->value = tsk_strdup(va_arg(*app, const char*));
|
||||
}
|
||||
else
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create new SIP_If_Match header.");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tsip_header_SIP_If_Match_destroy(void *self)
|
||||
{
|
||||
tsip_header_SIP_If_Match_t *SIP_If_Match = self;
|
||||
if(SIP_If_Match)
|
||||
{
|
||||
TSK_FREE(SIP_If_Match->value);
|
||||
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(SIP_If_Match));
|
||||
}
|
||||
else TSK_DEBUG_ERROR("Null SIP_If_Match header.");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tsip_header_SIP_If_Match_def_s =
|
||||
{
|
||||
sizeof(tsip_header_SIP_If_Match_t),
|
||||
tsip_header_SIP_If_Match_create,
|
||||
tsip_header_SIP_If_Match_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_SIP_If_Match_def_t = &tsip_header_SIP_If_Match_def_s;
|
||||
|
||||
|
|
|
@ -912,8 +912,6 @@ _again:
|
|||
// Security_Client header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Security_Client_group
|
||||
*/
|
||||
static void* tsip_header_Security_Client_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Security_Client_t *Security_Client = self;
|
||||
|
@ -950,8 +948,6 @@ static void* tsip_header_Security_Client_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Security_Client_group
|
||||
*/
|
||||
static void* tsip_header_Security_Client_destroy(void *self)
|
||||
{
|
||||
tsip_header_Security_Client_t *Security_Client = self;
|
||||
|
|
|
@ -913,8 +913,6 @@ _again:
|
|||
// Security_Server header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Security_Server_group
|
||||
*/
|
||||
static void* tsip_header_Security_Server_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Security_Server_t *Security_Server = self;
|
||||
|
@ -933,8 +931,6 @@ static void* tsip_header_Security_Server_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Security_Server_group
|
||||
*/
|
||||
static void* tsip_header_Security_Server_destroy(void *self)
|
||||
{
|
||||
tsip_header_Security_Server_t *Security_Server = self;
|
||||
|
|
|
@ -912,8 +912,6 @@ _again:
|
|||
// Security_Verify header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Security_Verify_group
|
||||
*/
|
||||
static void* tsip_header_Security_Verify_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Security_Verify_t *Security_Verify = self;
|
||||
|
@ -932,8 +930,6 @@ static void* tsip_header_Security_Verify_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Security_Verify_group
|
||||
*/
|
||||
static void* tsip_header_Security_Verify_destroy(void *self)
|
||||
{
|
||||
tsip_header_Security_Verify_t *Security_Verify = self;
|
||||
|
|
|
@ -267,8 +267,6 @@ _again:
|
|||
// Server header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Server_group
|
||||
*/
|
||||
static void* tsip_header_Server_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Server_t *Server = self;
|
||||
|
@ -285,8 +283,6 @@ static void* tsip_header_Server_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Server_group
|
||||
*/
|
||||
static void* tsip_header_Server_destroy(void *self)
|
||||
{
|
||||
tsip_header_Server_t *Server = self;
|
||||
|
|
|
@ -512,8 +512,6 @@ _again:
|
|||
// Service_Route header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Service_Route_group
|
||||
*/
|
||||
static void* tsip_header_Service_Route_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Service_Route_t *Service_Route = self;
|
||||
|
@ -534,8 +532,6 @@ static void* tsip_header_Service_Route_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Service_Route_group
|
||||
*/
|
||||
static void* tsip_header_Service_Route_destroy(void *self)
|
||||
{
|
||||
tsip_header_Service_Route_t *Service_Route = self;
|
||||
|
|
|
@ -655,8 +655,6 @@ _again:
|
|||
// Subscription_State header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Subscription_State_group
|
||||
*/
|
||||
static void* tsip_header_Subscription_State_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Subscription_State_t *Subscription_State = self;
|
||||
|
@ -675,8 +673,6 @@ static void* tsip_header_Subscription_State_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Subscription_State_group
|
||||
*/
|
||||
static void* tsip_header_Subscription_State_destroy(void *self)
|
||||
{
|
||||
tsip_header_Subscription_State_t *Subscription_State = self;
|
||||
|
|
|
@ -307,8 +307,6 @@ _again:
|
|||
// Supported header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Supported_group
|
||||
*/
|
||||
static void* tsip_header_Supported_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Supported_t *Supported = self;
|
||||
|
@ -333,8 +331,6 @@ static void* tsip_header_Supported_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Supported_group
|
||||
*/
|
||||
static void* tsip_header_Supported_destroy(void *self)
|
||||
{
|
||||
tsip_header_Supported_t *Supported = self;
|
||||
|
|
|
@ -1207,8 +1207,6 @@ _again:
|
|||
// To header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_To_group
|
||||
*/
|
||||
static void* tsip_header_To_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_To_t *To = self;
|
||||
|
@ -1232,8 +1230,6 @@ static void* tsip_header_To_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_To_group
|
||||
*/
|
||||
static void* tsip_header_To_destroy(void *self)
|
||||
{
|
||||
tsip_header_To_t *To = self;
|
||||
|
|
|
@ -272,8 +272,6 @@ _again:
|
|||
// User_Agent header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_User_Agent_group
|
||||
*/
|
||||
static void* tsip_header_User_Agent_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_User_Agent_t *User_Agent = self;
|
||||
|
@ -290,8 +288,6 @@ static void* tsip_header_User_Agent_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_User_Agent_group
|
||||
*/
|
||||
static void* tsip_header_User_Agent_destroy(void *self)
|
||||
{
|
||||
tsip_header_User_Agent_t *User_Agent = self;
|
||||
|
|
|
@ -1290,8 +1290,6 @@ _again:
|
|||
// Via header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Via_group
|
||||
*/
|
||||
static void* tsip_header_Via_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Via_t *via = self;
|
||||
|
@ -1326,8 +1324,6 @@ static void* tsip_header_Via_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Via_group
|
||||
*/
|
||||
static void* tsip_header_Via_destroy(void *self)
|
||||
{
|
||||
tsip_header_Via_t *via = self;
|
||||
|
|
|
@ -518,8 +518,6 @@ _again:
|
|||
// Warning header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Warning_group
|
||||
*/
|
||||
static void* tsip_header_Warning_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Warning_t *Warning = self;
|
||||
|
@ -537,8 +535,6 @@ static void* tsip_header_Warning_create(void *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Warning_group
|
||||
*/
|
||||
static void* tsip_header_Warning_destroy(void *self)
|
||||
{
|
||||
tsip_header_Warning_t *Warning = self;
|
||||
|
|
|
@ -60,6 +60,8 @@
|
|||
#include "tinysip/headers/tsip_header_Security_Verify.h"
|
||||
#include "tinysip/headers/tsip_header_Server.h"
|
||||
#include "tinysip/headers/tsip_header_Service_Route.h"
|
||||
#include "tinysip/headers/tsip_header_SIP_ETag.h"
|
||||
#include "tinysip/headers/tsip_header_SIP_If_Match.h"
|
||||
#include "tinysip/headers/tsip_header_Subscription_State.h"
|
||||
#include "tinysip/headers/tsip_header_Supported.h"
|
||||
#include "tinysip/headers/tsip_header_To.h"
|
||||
|
@ -96,7 +98,7 @@
|
|||
* Ragel state machine.
|
||||
*/
|
||||
|
||||
/* #line 745 "tsip_parser_header.rl" */
|
||||
/* #line 749 "tsip_parser_header.rl" */
|
||||
|
||||
|
||||
TSIP_BOOLEAN tsip_header_parse(tsk_ragel_state_t *state, tsip_message_t *message)
|
||||
|
@ -107,7 +109,7 @@ TSIP_BOOLEAN tsip_header_parse(tsk_ragel_state_t *state, tsip_message_t *message
|
|||
const char *eof = pe;
|
||||
|
||||
|
||||
/* #line 111 "../src/parsers/tsip_parser_header.c" */
|
||||
/* #line 113 "../src/parsers/tsip_parser_header.c" */
|
||||
static const char _tsip_machine_parser_headers_actions[] = {
|
||||
0, 1, 0, 1, 1, 1, 2, 1,
|
||||
3, 1, 4, 1, 5, 1, 6, 1,
|
||||
|
@ -2158,16 +2160,16 @@ static const int tsip_machine_parser_headers_error = 0;
|
|||
static const int tsip_machine_parser_headers_en_main = 1;
|
||||
|
||||
|
||||
/* #line 755 "tsip_parser_header.rl" */
|
||||
/* #line 759 "tsip_parser_header.rl" */
|
||||
|
||||
/* #line 2164 "../src/parsers/tsip_parser_header.c" */
|
||||
/* #line 2166 "../src/parsers/tsip_parser_header.c" */
|
||||
{
|
||||
cs = tsip_machine_parser_headers_start;
|
||||
}
|
||||
|
||||
/* #line 756 "tsip_parser_header.rl" */
|
||||
/* #line 760 "tsip_parser_header.rl" */
|
||||
|
||||
/* #line 2171 "../src/parsers/tsip_parser_header.c" */
|
||||
/* #line 2173 "../src/parsers/tsip_parser_header.c" */
|
||||
{
|
||||
int _klen;
|
||||
unsigned int _trans;
|
||||
|
@ -2241,70 +2243,70 @@ _match:
|
|||
switch ( *_acts++ )
|
||||
{
|
||||
case 0:
|
||||
/* #line 102 "tsip_parser_header.rl" */
|
||||
/* #line 104 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Accept NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
/* #line 108 "tsip_parser_header.rl" */
|
||||
/* #line 110 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Accept_Contact NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
/* #line 114 "tsip_parser_header.rl" */
|
||||
/* #line 116 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Accept_Encoding NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
/* #line 120 "tsip_parser_header.rl" */
|
||||
/* #line 122 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Accept_Language NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
/* #line 126 "tsip_parser_header.rl" */
|
||||
/* #line 128 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Accept_Resource_Priority NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
/* #line 132 "tsip_parser_header.rl" */
|
||||
/* #line 134 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Alert_Info NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
/* #line 138 "tsip_parser_header.rl" */
|
||||
/* #line 140 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Allow_t *header = tsip_header_Allow_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
/* #line 145 "tsip_parser_header.rl" */
|
||||
/* #line 147 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Allow_Events_t *header = tsip_header_Allow_Events_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
/* #line 152 "tsip_parser_header.rl" */
|
||||
/* #line 154 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Authentication_Info NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
/* #line 158 "tsip_parser_header.rl" */
|
||||
/* #line 160 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Authorization_t *header = tsip_header_Authorization_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
/* #line 165 "tsip_parser_header.rl" */
|
||||
/* #line 167 "tsip_parser_header.rl" */
|
||||
{
|
||||
if(!message->Call_ID)
|
||||
{
|
||||
|
@ -2313,13 +2315,13 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 11:
|
||||
/* #line 174 "tsip_parser_header.rl" */
|
||||
/* #line 176 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Call_Info NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
/* #line 180 "tsip_parser_header.rl" */
|
||||
/* #line 182 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Contacts_L_t* headers = tsip_header_Contact_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
if(headers)
|
||||
|
@ -2341,25 +2343,25 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 13:
|
||||
/* #line 202 "tsip_parser_header.rl" */
|
||||
/* #line 204 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Content_Disposition NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
/* #line 208 "tsip_parser_header.rl" */
|
||||
/* #line 210 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("PARSE_HEADER_ACCEPT NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
/* #line 214 "tsip_parser_header.rl" */
|
||||
/* #line 216 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Content_Language NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
/* #line 220 "tsip_parser_header.rl" */
|
||||
/* #line 222 "tsip_parser_header.rl" */
|
||||
{
|
||||
if(!message->Content_Length)
|
||||
{
|
||||
|
@ -2368,7 +2370,7 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 17:
|
||||
/* #line 229 "tsip_parser_header.rl" */
|
||||
/* #line 231 "tsip_parser_header.rl" */
|
||||
{
|
||||
if(!message->Content_Type)
|
||||
{
|
||||
|
@ -2377,7 +2379,7 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 18:
|
||||
/* #line 238 "tsip_parser_header.rl" */
|
||||
/* #line 240 "tsip_parser_header.rl" */
|
||||
{
|
||||
if(!message->CSeq)
|
||||
{
|
||||
|
@ -2386,26 +2388,26 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 19:
|
||||
/* #line 247 "tsip_parser_header.rl" */
|
||||
/* #line 249 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Date NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 20:
|
||||
/* #line 253 "tsip_parser_header.rl" */
|
||||
/* #line 255 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Error_Info NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 21:
|
||||
/* #line 259 "tsip_parser_header.rl" */
|
||||
/* #line 261 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Event_t *header = tsip_header_Event_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 22:
|
||||
/* #line 266 "tsip_parser_header.rl" */
|
||||
/* #line 268 "tsip_parser_header.rl" */
|
||||
{
|
||||
if(!message->Expires)
|
||||
{
|
||||
|
@ -2414,7 +2416,7 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 23:
|
||||
/* #line 275 "tsip_parser_header.rl" */
|
||||
/* #line 277 "tsip_parser_header.rl" */
|
||||
{
|
||||
if(!message->From)
|
||||
{
|
||||
|
@ -2423,284 +2425,284 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 24:
|
||||
/* #line 284 "tsip_parser_header.rl" */
|
||||
/* #line 286 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_History_Info NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
/* #line 290 "tsip_parser_header.rl" */
|
||||
/* #line 292 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Identity NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 26:
|
||||
/* #line 296 "tsip_parser_header.rl" */
|
||||
/* #line 298 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Identity_Info NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 27:
|
||||
/* #line 302 "tsip_parser_header.rl" */
|
||||
/* #line 304 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_In_Reply_To NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 28:
|
||||
/* #line 308 "tsip_parser_header.rl" */
|
||||
/* #line 310 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Join NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 29:
|
||||
/* #line 314 "tsip_parser_header.rl" */
|
||||
/* #line 316 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Max_Forwards_t *header = tsip_header_Max_Forwards_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 30:
|
||||
/* #line 321 "tsip_parser_header.rl" */
|
||||
/* #line 323 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_MIME_Version NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 31:
|
||||
/* #line 327 "tsip_parser_header.rl" */
|
||||
/* #line 329 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Min_Expires_t *header = tsip_header_Min_Expires_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
/* #line 334 "tsip_parser_header.rl" */
|
||||
/* #line 336 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Min_SE NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
/* #line 340 "tsip_parser_header.rl" */
|
||||
/* #line 342 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Organization NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 34:
|
||||
/* #line 346 "tsip_parser_header.rl" */
|
||||
/* #line 348 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_P_Access_Network_Info_t *header = tsip_header_P_Access_Network_Info_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 35:
|
||||
/* #line 353 "tsip_parser_header.rl" */
|
||||
/* #line 355 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_Answer_State NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 36:
|
||||
/* #line 359 "tsip_parser_header.rl" */
|
||||
/* #line 361 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_P_Asserted_Identities_L_t* headers = tsip_header_P_Asserted_Identity_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADERS(headers);
|
||||
}
|
||||
break;
|
||||
case 37:
|
||||
/* #line 366 "tsip_parser_header.rl" */
|
||||
/* #line 368 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_P_Associated_URIs_L_t* headers = tsip_header_P_Associated_URI_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADERS(headers);
|
||||
}
|
||||
break;
|
||||
case 38:
|
||||
/* #line 373 "tsip_parser_header.rl" */
|
||||
/* #line 375 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_Called_Party_ID NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 39:
|
||||
/* #line 379 "tsip_parser_header.rl" */
|
||||
/* #line 381 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_P_Charging_Function_Addressess_L_t* headers = tsip_header_P_Charging_Function_Addresses_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADERS(headers);
|
||||
}
|
||||
break;
|
||||
case 40:
|
||||
/* #line 386 "tsip_parser_header.rl" */
|
||||
/* #line 388 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_Charging_Vector NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 41:
|
||||
/* #line 392 "tsip_parser_header.rl" */
|
||||
/* #line 394 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_DCS_Billing_Info NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 42:
|
||||
/* #line 398 "tsip_parser_header.rl" */
|
||||
/* #line 400 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_DCS_LAES NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 43:
|
||||
/* #line 404 "tsip_parser_header.rl" */
|
||||
/* #line 406 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_DCS_OSPS NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 44:
|
||||
/* #line 410 "tsip_parser_header.rl" */
|
||||
/* #line 412 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_DCS_Redirect NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 45:
|
||||
/* #line 416 "tsip_parser_header.rl" */
|
||||
/* #line 418 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_DCS_Trace_Party_ID NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 46:
|
||||
/* #line 422 "tsip_parser_header.rl" */
|
||||
/* #line 424 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_Early_Media NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 47:
|
||||
/* #line 428 "tsip_parser_header.rl" */
|
||||
/* #line 430 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_Media_Authorization NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 48:
|
||||
/* #line 434 "tsip_parser_header.rl" */
|
||||
/* #line 436 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_P_Preferred_Identity_t *header = tsip_header_P_Preferred_Identity_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 49:
|
||||
/* #line 441 "tsip_parser_header.rl" */
|
||||
/* #line 443 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_Profile_Key NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 50:
|
||||
/* #line 447 "tsip_parser_header.rl" */
|
||||
/* #line 449 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_User_Database NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 51:
|
||||
/* #line 453 "tsip_parser_header.rl" */
|
||||
/* #line 455 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_P_Visited_Network_ID NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 52:
|
||||
/* #line 459 "tsip_parser_header.rl" */
|
||||
/* #line 461 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Paths_L_t* headers = tsip_header_Path_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADERS(headers);
|
||||
}
|
||||
break;
|
||||
case 53:
|
||||
/* #line 466 "tsip_parser_header.rl" */
|
||||
/* #line 468 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Priority NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 54:
|
||||
/* #line 472 "tsip_parser_header.rl" */
|
||||
/* #line 474 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Privacy_t *header = tsip_header_Privacy_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 55:
|
||||
/* #line 479 "tsip_parser_header.rl" */
|
||||
/* #line 481 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Proxy_Authenticate_t *header = tsip_header_Proxy_Authenticate_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 56:
|
||||
/* #line 486 "tsip_parser_header.rl" */
|
||||
/* #line 488 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Proxy_Authorization_t *header = tsip_header_Proxy_Authorization_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 57:
|
||||
/* #line 493 "tsip_parser_header.rl" */
|
||||
/* #line 495 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Proxy_Require_t *header = tsip_header_Proxy_Require_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 58:
|
||||
/* #line 500 "tsip_parser_header.rl" */
|
||||
/* #line 502 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_RAck NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 59:
|
||||
/* #line 506 "tsip_parser_header.rl" */
|
||||
/* #line 508 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Reason NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 60:
|
||||
/* #line 512 "tsip_parser_header.rl" */
|
||||
/* #line 514 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Record_Route_t *header = tsip_header_Record_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 61:
|
||||
/* #line 519 "tsip_parser_header.rl" */
|
||||
/* #line 521 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Refer_Sub NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 62:
|
||||
/* #line 525 "tsip_parser_header.rl" */
|
||||
/* #line 527 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Refer_To NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 63:
|
||||
/* #line 531 "tsip_parser_header.rl" */
|
||||
/* #line 533 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Referred_By NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 64:
|
||||
/* #line 537 "tsip_parser_header.rl" */
|
||||
/* #line 539 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Reject_Contact NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 65:
|
||||
/* #line 543 "tsip_parser_header.rl" */
|
||||
/* #line 545 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Replaces NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 66:
|
||||
/* #line 549 "tsip_parser_header.rl" */
|
||||
/* #line 551 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Reply_To NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 67:
|
||||
/* #line 555 "tsip_parser_header.rl" */
|
||||
/* #line 557 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Request_Disposition NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 68:
|
||||
/* #line 561 "tsip_parser_header.rl" */
|
||||
/* #line 563 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Require_t *header = tsip_header_Require_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
if(header)
|
||||
|
@ -2710,117 +2712,119 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 69:
|
||||
/* #line 571 "tsip_parser_header.rl" */
|
||||
/* #line 573 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Resource_Priority NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 70:
|
||||
/* #line 577 "tsip_parser_header.rl" */
|
||||
/* #line 579 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Retry_After NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 71:
|
||||
/* #line 583 "tsip_parser_header.rl" */
|
||||
/* #line 585 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Routes_L_t* headers = tsip_header_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADERS(headers);
|
||||
}
|
||||
break;
|
||||
case 72:
|
||||
/* #line 590 "tsip_parser_header.rl" */
|
||||
/* #line 592 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_RSeq NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 73:
|
||||
/* #line 596 "tsip_parser_header.rl" */
|
||||
/* #line 598 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Security_Clients_L_t* headers = tsip_header_Security_Client_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADERS(headers);
|
||||
}
|
||||
break;
|
||||
case 74:
|
||||
/* #line 603 "tsip_parser_header.rl" */
|
||||
/* #line 605 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Security_Servers_L_t* headers = tsip_header_Security_Server_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADERS(headers);
|
||||
}
|
||||
break;
|
||||
case 75:
|
||||
/* #line 610 "tsip_parser_header.rl" */
|
||||
/* #line 612 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Security_Verifies_L_t* headers = tsip_header_Security_Verify_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADERS(headers);
|
||||
}
|
||||
break;
|
||||
case 76:
|
||||
/* #line 617 "tsip_parser_header.rl" */
|
||||
/* #line 619 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Server_t *header = tsip_header_Server_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 77:
|
||||
/* #line 624 "tsip_parser_header.rl" */
|
||||
/* #line 626 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Service_Routes_L_t* headers = tsip_header_Service_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADERS(headers);
|
||||
}
|
||||
break;
|
||||
case 78:
|
||||
/* #line 631 "tsip_parser_header.rl" */
|
||||
/* #line 633 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Session_Expires NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 79:
|
||||
/* #line 637 "tsip_parser_header.rl" */
|
||||
/* #line 639 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_SIP_ETag NOT IMPLEMENTED");
|
||||
tsip_header_SIP_ETag_t *header = tsip_header_SIP_ETag_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 80:
|
||||
/* #line 643 "tsip_parser_header.rl" */
|
||||
/* #line 646 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_SIP_If_Match NOT IMPLEMENTED");
|
||||
tsip_header_SIP_If_Match_t *header = tsip_header_SIP_If_Match_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 81:
|
||||
/* #line 649 "tsip_parser_header.rl" */
|
||||
/* #line 653 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Subject NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 82:
|
||||
/* #line 655 "tsip_parser_header.rl" */
|
||||
/* #line 659 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Subscription_State_t* header = tsip_header_Subscription_State_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 83:
|
||||
/* #line 662 "tsip_parser_header.rl" */
|
||||
/* #line 666 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Supported_t *header = tsip_header_Supported_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 84:
|
||||
/* #line 669 "tsip_parser_header.rl" */
|
||||
/* #line 673 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Target_Dialog NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 85:
|
||||
/* #line 675 "tsip_parser_header.rl" */
|
||||
/* #line 679 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Timestamp NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 86:
|
||||
/* #line 681 "tsip_parser_header.rl" */
|
||||
/* #line 685 "tsip_parser_header.rl" */
|
||||
{
|
||||
if(!message->To)
|
||||
{
|
||||
|
@ -2829,20 +2833,20 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 87:
|
||||
/* #line 690 "tsip_parser_header.rl" */
|
||||
/* #line 694 "tsip_parser_header.rl" */
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Unsupported NOT IMPLEMENTED");
|
||||
}
|
||||
break;
|
||||
case 88:
|
||||
/* #line 696 "tsip_parser_header.rl" */
|
||||
/* #line 700 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_User_Agent_t *header = tsip_header_User_Agent_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
case 89:
|
||||
/* #line 703 "tsip_parser_header.rl" */
|
||||
/* #line 707 "tsip_parser_header.rl" */
|
||||
{
|
||||
if(!message->firstVia)
|
||||
{
|
||||
|
@ -2859,20 +2863,20 @@ _match:
|
|||
}
|
||||
break;
|
||||
case 90:
|
||||
/* #line 720 "tsip_parser_header.rl" */
|
||||
/* #line 724 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_Warnings_L_t* headers = tsip_header_Warning_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADERS(headers);
|
||||
}
|
||||
break;
|
||||
case 91:
|
||||
/* #line 727 "tsip_parser_header.rl" */
|
||||
/* #line 731 "tsip_parser_header.rl" */
|
||||
{
|
||||
tsip_header_WWW_Authenticate_t *header = tsip_header_WWW_Authenticate_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
ADD_HEADER(header);
|
||||
}
|
||||
break;
|
||||
/* #line 2876 "../src/parsers/tsip_parser_header.c" */
|
||||
/* #line 2880 "../src/parsers/tsip_parser_header.c" */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2885,12 +2889,12 @@ _again:
|
|||
_out: {}
|
||||
}
|
||||
|
||||
/* #line 757 "tsip_parser_header.rl" */
|
||||
/* #line 761 "tsip_parser_header.rl" */
|
||||
|
||||
return ( cs >=
|
||||
/* #line 2892 "../src/parsers/tsip_parser_header.c" */
|
||||
/* #line 2896 "../src/parsers/tsip_parser_header.c" */
|
||||
1299
|
||||
/* #line 758 "tsip_parser_header.rl" */
|
||||
/* #line 762 "tsip_parser_header.rl" */
|
||||
);
|
||||
//return (cs == tsip_machine_parser_headers_first_final);
|
||||
}
|
||||
|
|
|
@ -92,13 +92,12 @@ int __tsip_operation_set(tsip_operation_t *self, va_list values)
|
|||
const char* name = va_arg(values, const char *);
|
||||
const char* value = va_arg(values, const char *);
|
||||
|
||||
tsk_param_t *param = TSK_PARAM_CREATE(name, value);
|
||||
if(curr == optype_param){
|
||||
tsk_list_push_back_data(self->params, ((void**) ¶m));
|
||||
tsk_params_add_param(&self->params, name, value); // Add or Update a param
|
||||
} else if(curr == optype_header){
|
||||
tsk_list_push_back_data(self->headers, ((void**) ¶m));
|
||||
tsk_params_add_param(&self->headers, name, value);
|
||||
}else if(curr == optype_caps){
|
||||
tsk_list_push_back_data(self->caps, ((void**) ¶m));
|
||||
tsk_params_add_param(&self->caps, name, value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -154,6 +153,15 @@ const tsk_param_t* tsip_operation_get_param(const tsip_operation_handle_t *self,
|
|||
return TSIP_NULL;
|
||||
}
|
||||
|
||||
const tsk_param_t* tsip_operation_get_header(const tsip_operation_handle_t *self, const char* hname)
|
||||
{
|
||||
if(self){
|
||||
const tsip_operation_t *operation = self;
|
||||
return tsk_params_get_param_by_name(operation->headers, hname);
|
||||
}
|
||||
return TSIP_NULL;
|
||||
}
|
||||
|
||||
const tsk_params_L_t* tsip_operation_get_headers(const tsip_operation_handle_t *self)
|
||||
{
|
||||
if(self){
|
||||
|
|
|
@ -32,6 +32,41 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#define TEST_STACK_PIDF \
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
|
||||
"<presence xmlns:cp=\"urn:ietf:params:xml:ns:pidf:cipid\" xmlns:caps=\"urn:ietf:params:xml:ns:pidf:caps\" xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" xmlns:pdm=\"urn:ietf:params:xml:ns:pidf:data-model\" xmlns:p=\"urn:ietf:params:xml:ns:pidf-diff\" xmlns:op=\"urn:oma:xml:prs:pidf:oma-pres\" entity=\"sip:mamadou@ericsson.com\" xmlns=\"urn:ietf:params:xml:ns:pidf\">"\
|
||||
" <pdm:person id=\"CRUVREZS\">"\
|
||||
" <op:overriding-willingness>"\
|
||||
" <op:basic>open</op:basic>"\
|
||||
" </op:overriding-willingness>"\
|
||||
" <rpid:activities>"\
|
||||
" <rpid:unknown />"\
|
||||
" </rpid:activities>"\
|
||||
" <rpid:mood>"\
|
||||
" <rpid:neutral />"\
|
||||
" </rpid:mood>"\
|
||||
" <pdm:note>Hello world</pdm:note>"\
|
||||
" </pdm:person>"\
|
||||
" <pdm:device id=\"d0001\">"\
|
||||
" <status>"\
|
||||
" <basic>open</basic>"\
|
||||
" </status>"\
|
||||
" <caps:devcaps>"\
|
||||
" <caps:mobility>"\
|
||||
" <caps:supported>"\
|
||||
" <caps:fixed />"\
|
||||
" </caps:supported>"\
|
||||
" </caps:mobility>"\
|
||||
" </caps:devcaps>"\
|
||||
" <op:network-availability>"\
|
||||
" <op:network id=\"IMS\">"\
|
||||
" <op:active />"\
|
||||
" </op:network>"\
|
||||
" </op:network-availability>"\
|
||||
" <pdm:deviceID>urn:uuid:dd1289fa-c3d7-47bd-a40d-f1f1b2cc5ffc</pdm:deviceID>"\
|
||||
" </pdm:device>"\
|
||||
"</presence>"
|
||||
|
||||
int test_stack_callback(const tsip_event_t *sipevent)
|
||||
{
|
||||
TSK_DEBUG_INFO("\n====\nSTACK event: %d [%s] with opid=%lld\n=====",
|
||||
|
@ -188,7 +223,7 @@ int test_stack_callback(const tsip_event_t *sipevent)
|
|||
|
||||
void test_stack()
|
||||
{
|
||||
/*
|
||||
/*
|
||||
tsip_stack_handle_t *stack = tsip_stack_create(test_stack_callback,
|
||||
TSIP_STACK_SET_DISPLAY_NAME("2233392625"),
|
||||
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:2233392625@sip2sip.info"),
|
||||
|
@ -201,11 +236,11 @@ void test_stack()
|
|||
//TSIP_STACK_SET_PROXY_CSCF("192.168.0.15", "udp", 0),
|
||||
TSIP_STACK_SET_PROXY_CSCF_PORT(5060),
|
||||
TSIP_STACK_SET_MOBILITY("fixed"),
|
||||
TSIP_STACK_SET_DEVICE_ID("DD1289FA-C3D7-47bd-A40D-F1F1B2CC5FFC"),
|
||||
TSIP_STACK_SET_DEVICE_ID("dd1289fa-c3d7-47bd-a40d-f1f1b2cc5ffc"),
|
||||
TSIP_STACK_SET_NETINFO("ADSL;utran-cell-id-3gpp=00000000"),
|
||||
TSIP_STACK_SET_PRIVACY("header;id"),
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
tsip_stack_handle_t *stack = tsip_stack_create(test_stack_callback,
|
||||
TSIP_STACK_SET_DISPLAY_NAME("Mamadou"),
|
||||
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:mamadou@ericsson.com"),
|
||||
|
@ -217,13 +252,13 @@ void test_stack()
|
|||
TSIP_STACK_SET_PROXY_CSCF("192.168.0.11", "udp", 0),
|
||||
//TSIP_STACK_SET_PROXY_CSCF("192.168.0.15", "udp", 0),
|
||||
TSIP_STACK_SET_PROXY_CSCF_PORT(5081),
|
||||
TSIP_STACK_SET_SECAGREE_IPSEC("hmac-md5-96", "null", "trans", "esp"),
|
||||
//TSIP_STACK_SET_SECAGREE_IPSEC("hmac-md5-96", "null", "trans", "esp"),
|
||||
TSIP_STACK_SET_MOBILITY("fixed"),
|
||||
TSIP_STACK_SET_DEVICE_ID("DD1289FA-C3D7-47bd-A40D-F1F1B2CC5FFC"),
|
||||
TSIP_STACK_SET_DEVICE_ID("dd1289fa-c3d7-47bd-a40d-f1f1b2cc5ffc"),
|
||||
TSIP_STACK_SET_NETINFO("ADSL;utran-cell-id-3gpp=00000000"),
|
||||
TSIP_STACK_SET_PRIVACY("header;id"),
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
tsip_stack_handle_t *stack = tsip_stack_create(test_stack_callback,
|
||||
TSIP_STACK_SET_DISPLAY_NAME("Mamadou"),
|
||||
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:mamadou@ims.inexbee.com"),
|
||||
|
@ -237,9 +272,10 @@ void test_stack()
|
|||
TSIP_STACK_SET_PROXY_CSCF_PORT(4060),
|
||||
//TSIP_STACK_SET_SECAGREE_IPSEC("hmac-md5-96", "null", "trans", "esp"),
|
||||
TSIP_STACK_SET_MOBILITY("fixed"),
|
||||
TSIP_STACK_SET_DEVICE_ID("DD1289FA-C3D7-47bd-A40D-F1F1B2CC5FFC"),
|
||||
TSIP_STACK_SET_DEVICE_ID("dd1289fa-c3d7-47bd-a40d-f1f1b2cc5ffc"),
|
||||
TSIP_STACK_SET_NETINFO("ADSL;utran-cell-id-3gpp=00000000"),
|
||||
TSIP_STACK_SET_PRIVACY("header;id"),
|
||||
*/
|
||||
|
||||
TSIP_STACK_SET_NULL());
|
||||
|
||||
|
@ -261,29 +297,43 @@ void test_stack()
|
|||
|
||||
tsk_thread_sleep(2000);
|
||||
|
||||
///* SUBSCRIBE */
|
||||
//{
|
||||
// tsip_operation_handle_t *op2 = TSIP_OPERATION_CREATE(stack,
|
||||
// TSIP_OPERATION_SET_PARAM("to", "sip:mamadou@ims.inexbee.com"),
|
||||
// TSIP_OPERATION_SET_PARAM("expires", "30"),
|
||||
// TSIP_OPERATION_SET_HEADER("Event", "reg"),
|
||||
// TSIP_OPERATION_SET_HEADER("Accept", "application/reginfo+xml"),
|
||||
// TSIP_OPERATION_SET_HEADER("Allow-Events", "refer, presence, presence.winfo, xcap-diff"),
|
||||
// TSIP_OPERATION_SET_HEADER("Allow", "INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER"),
|
||||
//
|
||||
// TSIP_OPERATION_SET_NULL());
|
||||
// tsip_subscribe(stack, op2);
|
||||
//}
|
||||
|
||||
///* MESSAGE */
|
||||
//{
|
||||
// tsip_operation_handle_t *op3 = TSIP_OPERATION_CREATE(stack,
|
||||
// TSIP_OPERATION_SET_PARAM("to", "sip:laurent@ims.inexbee.com"),
|
||||
// TSIP_OPERATION_SET_HEADER("Accept-Contact", "*;+g.oma.sip-im"),
|
||||
// TSIP_OPERATION_SET_HEADER("Content-Type", "text/plain"),
|
||||
|
||||
// TSIP_OPERATION_SET_PARAM("content", "test"),
|
||||
//
|
||||
// TSIP_OPERATION_SET_NULL());
|
||||
// tsip_message(stack, op3);
|
||||
//}
|
||||
|
||||
/* PUBLISH */
|
||||
{
|
||||
tsip_operation_handle_t *op2 = TSIP_OPERATION_CREATE(stack,
|
||||
TSIP_OPERATION_SET_PARAM("to", "sip:mamadou@ims.inexbee.com"),
|
||||
TSIP_OPERATION_SET_PARAM("expires", "30"),
|
||||
TSIP_OPERATION_SET_HEADER("Event", "reg"),
|
||||
TSIP_OPERATION_SET_HEADER("Accept", "application/reginfo+xml"),
|
||||
TSIP_OPERATION_SET_HEADER("Allow-Events", "refer, presence, presence.winfo, xcap-diff"),
|
||||
TSIP_OPERATION_SET_HEADER("Allow", "INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER"),
|
||||
tsip_operation_handle_t *op4 = TSIP_OPERATION_CREATE(stack,
|
||||
TSIP_OPERATION_SET_PARAM("to", "sip:mamadou@ericsson.com"),
|
||||
TSIP_OPERATION_SET_HEADER("Content-Type", "application/pidf+xml"),
|
||||
|
||||
TSIP_OPERATION_SET_PARAM("content", TEST_STACK_PIDF),
|
||||
|
||||
TSIP_OPERATION_SET_NULL());
|
||||
tsip_subscribe(stack, op2);
|
||||
}
|
||||
|
||||
{
|
||||
tsip_operation_handle_t *op3 = TSIP_OPERATION_CREATE(stack,
|
||||
TSIP_OPERATION_SET_PARAM("to", "sip:laurent@ims.inexbee.com"),
|
||||
TSIP_OPERATION_SET_HEADER("Accept-Contact", "*;+g.oma.sip-im"),
|
||||
TSIP_OPERATION_SET_HEADER("Content-Type", "text/plain"),
|
||||
|
||||
TSIP_OPERATION_SET_PARAM("content", "test"),
|
||||
|
||||
TSIP_OPERATION_SET_NULL());
|
||||
tsip_message(stack, op3);
|
||||
tsip_publish(stack, op4);
|
||||
}
|
||||
|
||||
//while(1);//tsk_thread_sleep(500);
|
||||
|
|
Loading…
Reference in New Issue