- Begin adding support for presence (SUBSCRIBE).

- Implement some missing headers (P-Asserted-Id; Path; Warning; ...).
This commit is contained in:
bossiel 2010-02-15 19:32:09 +00:00
parent 241c1e51b4
commit 28397e547d
59 changed files with 11868 additions and 1801 deletions

View File

@ -57,6 +57,8 @@ typedef int (*thttp_header_value_tostring)(const struct thttp_header_s* header,
typedef enum thttp_header_type_e
{
thttp_htype_Authorization,
thttp_htype_Content_Length,
thttp_htype_Content_Type,
thttp_htype_Proxy_Authenticate,
thttp_htype_Proxy_Authorization,
thttp_htype_WWW_Authenticate,

View File

@ -75,7 +75,11 @@ typedef char tnet_ip_t[INET6_ADDRSTRLEN];
# define TNET_ERROR_WOULDBLOCK WSAEWOULDBLOCK
# define TNET_ERROR_INPROGRESS WSAEINPROGRESS
# define TNET_ERROR_CONNRESET WSAECONNRESET
# define tnet_gai_strerror gai_strerrorA
# if defined(_WIN32_WCE)
# define tnet_gai_strerror(...) "FIXME"
# else
# define tnet_gai_strerror gai_strerrorA
# endif
#else
# define TNET_INVALID_SOCKET -1
# define TNET_ERROR_WOULDBLOCK EWOULDBLOCK

View File

@ -97,7 +97,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
}
tz->tz_minuteswest = _timezone / 60;
tz->tz_dsttime = _daylight;
}
}
return 0;
}

View File

@ -1013,7 +1013,7 @@ transport = "UDP" / "TCP" / "TLS" / "SCTP" / "TLS-SCTP" / other-transport
sent-by = host [ COLON port ]
ttl = 1*3DIGIT
;;;; Warning RFC 3261 Up
;;;; Warning
Warning = "Warning" HCOLON warning-value *(COMMA warning-value)
warning-value = warn-code SP warn-agent SP warn-text
warn-code = 3DIGIT

View File

@ -0,0 +1,74 @@
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_subscribe.h
* @brief Public registration (SUBSCRIBE) functions.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef TINYSIP_TSIP_SUBSCRIBE_H
#define TINYSIP_TSIP_SUBSCRIBE_H
#include "tinysip_config.h"
#include "tinysip/tsip_event.h"
TSIP_BEGIN_DECLS
#define TSIP_SUBSCRIBE_EVENT(self) ((tsip_subscribe_event_t*)(self))
typedef enum tsip_subscribe_event_type_e
{
tsip_subscribe_ok,
tsip_subscribe_nok,
tsip_unsubscribe_ok,
tsip_unsubscribe_nok,
tsip_subscribeing,
tsip_unsubscribeing,
tsip_subscribe_sent,
tsip_subscribe_cancelled,
tsip_subscribe_auth_nok,
tsip_subscribe_secagree_nok,
tsip_subscribe_transporterr,
tsip_subscribe_terminated,
}
tsip_subscribe_event_type_t;
typedef struct tsip_subscribe_event_e
{
TSIP_DECLARE_EVENT;
tsip_subscribe_event_type_t type;
}
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, unsigned incoming);
typedef int (*tsip_subscribe_callback)(const tsip_subscribe_event_t *sipevent);
TINYSIP_GEXTERN const void *tsip_subscribe_event_def_t;
TSIP_END_DECLS
#endif /* TINYSIP_TSIP_SUBSCRIBE_H */

View File

@ -69,7 +69,7 @@ TSIP_BEGIN_DECLS
typedef enum tsip_dialog_state_e
{
tsip_none,
tsip_initial,
tsip_early,
tsip_established,
tsip_terminated
@ -85,7 +85,8 @@ typedef enum tsip_dialog_type_e
tsip_dialog_prack,
tsip_dialog_publish,
tsip_dialog_refer,
tsip_dialog_register
tsip_dialog_register,
tsip_dialog_subscribe,
}
tsip_dialog_type_t;

View File

@ -0,0 +1,81 @@
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_subscribe.h
* @brief SIP dialog SUBSCRIBE.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef TINYSIP_DIALOG_SUBSCRIBE_H
#define TINYSIP_DIALOG_SUBSCRIBE_H
#include "tinysip_config.h"
#include "tinysip/dialogs/tsip_dialog.h"
#include "tinysip/smc/tsip_dialog_subscribe_sm.h"
TSIP_BEGIN_DECLS
#define TSIP_DIALOG_SUBSCRIBE_CREATE(stack, operation) tsk_object_new(tsip_dialog_subscribe_def_t, (tsip_stack_handle_t *)stack, (tsip_operation_handle_t*) operation)
#define TSIP_DIALOG_SUBSCRIBE(self) ((tsip_dialog_subscribe_t*)(self))
typedef struct tsip_dialog_subscribe
{
TSIP_DECLARE_DIALOG;
struct tsip_dialog_subscribeContext _fsm;
tsip_timer_t timerrefresh;
unsigned unsubscribeing:1;
char* package;
}
tsip_dialog_subscribe_t;
int tsip_dialog_subscribe_start(tsip_dialog_subscribe_t *self);
void tsip_dialog_subscribe_Started_2_Trying_X_send(tsip_dialog_subscribe_t *self);
void tsip_dialog_subscribe_Trying_2_Trying_X_1xx(tsip_dialog_subscribe_t *self, const tsip_response_t* response);
void tsip_dialog_subscribe_Trying_2_Terminated_X_2xx(tsip_dialog_subscribe_t *self, const tsip_response_t* response);
void tsip_dialog_subscribe_Trying_2_Connected_X_2xx(tsip_dialog_subscribe_t *self, const tsip_response_t* response);
void tsip_dialog_subscribe_Trying_2_Trying_X_401_407_421_494(tsip_dialog_subscribe_t *self, const tsip_response_t* response);
void tsip_dialog_subscribe_Trying_2_Trying_X_423(tsip_dialog_subscribe_t *self, const tsip_response_t* response);
void tsip_dialog_subscribe_Trying_2_Terminated_X_300_to_699(tsip_dialog_subscribe_t *self, const tsip_response_t* response);
void tsip_dialog_subscribe_Trying_2_Terminated_X_cancel(tsip_dialog_subscribe_t *self);
void tsip_dialog_subscribe_Trying_2_Trying_X_NOTIFY(tsip_dialog_subscribe_t *self, const tsip_request_t* request);
void tsip_dialog_subscribe_Connected_2_Trying_X_unsubscribe(tsip_dialog_subscribe_t *self);
void tsip_dialog_subscribe_Connected_2_Trying_X_refresh(tsip_dialog_subscribe_t *self);
void tsip_dialog_subscribe_Connected_2_Connected_X_NOTIFY(tsip_dialog_subscribe_t *self, const tsip_request_t* request);
void tsip_dialog_subscribe_Connected_2_Terminated_X_NOTIFY(tsip_dialog_subscribe_t *self, const tsip_request_t* request);
void tsip_dialog_subscribe_Any_2_Trying_X_hangup(tsip_dialog_subscribe_t *self);
void tsip_dialog_subscribe_Any_2_Terminated_X_transportError(tsip_dialog_subscribe_t *self);
void tsip_dialog_subscribe_OnTerminated(tsip_dialog_subscribe_t *self);
void tsip_dialog_subscribe_OnTerminated(tsip_dialog_subscribe_t *self);
TINYSIP_GEXTERN const void *tsip_dialog_subscribe_def_t;
TSIP_END_DECLS
#endif /* TINYSIP_DIALOG_SUBSCRIBE_H */

View File

@ -21,7 +21,7 @@
*/
/**@file tsip_header_Event.h
* @brief SIP header 'Event'.
* @brief SIP header 'Event/o'as per RFC 3265.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
@ -35,22 +35,43 @@
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_EVENT_CREATE
* Creates new sip 'Event' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_EVENT_VA_ARGS(package) tsip_header_Event_def_t, (const char*)package
#define TSIP_HEADER_EVENT_CREATE(package) tsk_object_new(TSIP_HEADER_EVENT_VA_ARGS(package))
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SIP header 'Accept-Contact' .
/// @brief SIP header 'Event/o' .
/// @author Mamadou
/// @date 12/3/2009
///
/// @par ABNF
/// @par ABNF: Event / o
/// Event = ( "Event" / "o" ) HCOLON event-type *( SEMI event-param )
/// event-type = event-package *( "." event-template )
/// event-package = token-nodot
/// event-template = token-nodot
/// token-nodot = 1*( alphanum / "-" / "!" / "%" / "*" / "_" / "+" / "`" / "'" / "~" )
/// event-param = generic-param / ( "id" EQUAL token ) / call-ident / from-tag / to-tag / with-sessd
/// call-ident = "call-id" EQUAL ( token / DQUOTE callid DQUOTE )
/// with-sessd = "include-session-description"
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsip_header_Event_s
{
TSIP_DECLARE_HEADER;
char *package;
}
tsip_header_Event_t;
tsip_header_Event_t *tsip_header_Event_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_Event_def_t;
TSIP_END_DECLS
#endif /* _TSIP_HEADER_EVENT_H_ */

View File

@ -21,7 +21,7 @@
*/
/**@file tsip_header_P_Asserted_Identity.h
* @brief SIP header 'P-Asserted-Identity'.
* @brief SIP header 'P-Asserted-Identity' as per RFC 3325.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
@ -33,24 +33,43 @@
#include "tinysip_config.h"
#include "tinysip/headers/tsip_header.h"
#include "tinysip/tsip_uri.h"
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_P_ASSERTED_IDENTITY_CREATE
* Creates new sip 'P_Asserted_Identity' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_P_ASSERTED_IDENTITY_CREATE() tsk_object_new(tsip_header_P_Asserted_Identity_def_t)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SIP header 'P-Asserted-Identity'.
/// @brief SIP header 'P-Asserted-Identity' as per RFC 3325.
/// @author Mamadou
/// @date 12/3/2009
///
/// @par ABNF
/// @par ABNF: P-Asserted-Identity = PAssertedID
/// PAssertedID = "P-Asserted-Identity" HCOLON PAssertedID-value *(COMMA PAssertedID-value)
/// PAssertedID-value = name-addr / addr-spec
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsip_header_P_Asserted_Identity_s
{
TSIP_DECLARE_HEADER;
char *display_name;
tsip_uri_t *uri;
}
tsip_header_P_Asserted_Identity_t;
typedef tsk_list_t tsip_header_P_Asserted_Identities_L_t;
tsip_header_P_Asserted_Identities_L_t *tsip_header_P_Asserted_Identity_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_P_Asserted_Identity_def_t;
TSIP_END_DECLS
#endif /* _TSIP_HEADER_P_ASSERTED_IDENTITY_H_ */

View File

@ -33,24 +33,45 @@
#include "tinysip_config.h"
#include "tinysip/headers/tsip_header.h"
#include "tinysip/tsip_uri.h"
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_P_ASSOCIATED_URI_CREATE
* Creates new sip 'P-Associated-URI' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_P_ASSOCIATED_URI_VA_ARGS(uri) tsip_header_P_Associated_URI_def_t, (const tsip_uri_t*)uri
#define TSIP_HEADER_P_ASSOCIATED_URI_CREATE(uri) tsk_object_new(TSIP_HEADER_P_ASSOCIATED_URI_VA_ARGS(uri))
#define TSIP_HEADER_P_ASSOCIATED_URI_CREATE_NULL() TSIP_HEADER_P_ASSOCIATED_URI_CREATE(0)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SIP header 'P-Associated-URI'.
/// @brief SIP header 'P-Associated-URI' as per RFC 3455.
/// @author Mamadou
/// @date 12/3/2009
///
/// @par ABNF
/// @par ABNF: P-Associated-URI = "P-Associated-URI" HCOLON p-aso-uri-spec *(COMMA p-aso-uri-spec)
/// p-aso-uri-spec = name-addr *( SEMI ai-param )
/// ai-param = generic-param
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsip_header_P_Associated_URI_s
{
TSIP_DECLARE_HEADER;
char *display_name;
tsip_uri_t *uri;
}
tsip_header_P_Associated_URI_t;
typedef tsk_list_t tsip_header_P_Associated_URIs_L_t;
tsip_header_P_Associated_URIs_L_t *tsip_header_P_Associated_URI_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_P_Associated_URI_def_t;
TSIP_END_DECLS
#endif /* _TSIP_HEADER_P_ASSOCIATED_URI_H_ */

View File

@ -35,22 +35,40 @@
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_P_ASSOCIATED_URI_CREATE
* Creates new sip 'P-Associated-URI' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_P_CHARGING_FUNCTION_ADDRESSES_CREATE() tsk_object_new(tsip_header_P_Charging_Function_Addresses_def_t)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SIP header 'P-Charging-Function-Addresses'.
/// @brief SIP header 'P-Charging-Function-Addresses' as per RFC 3455.
/// @author Mamadou
/// @date 12/3/2009
///
/// @par ABNF
/// @par ABNF: P-Charging-Function-Addresses = P-Charging-Addr
/// P-Charging-Addr = "P-Charging-Function-Addresses" HCOLON charge-addr-params *( SEMI charge-addr-params )
/// charge-addr-params = ccf / ecf / generic-param
/// ccf = "ccf" EQUAL gen-value
/// ecf = "ecf" EQUAL gen-value
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsip_header_P_Charging_Function_Addresses_s
{
TSIP_DECLARE_HEADER;
char* ccf;
char* ecf;
}
tsip_header_P_Charging_Function_Addresses_t;
typedef tsk_list_t tsip_header_P_Charging_Function_Addressess_L_t;
tsip_header_P_Charging_Function_Addressess_L_t *tsip_header_P_Charging_Function_Addresses_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_P_Charging_Function_Addresses_def_t;
TSIP_END_DECLS
#endif /* _TSIP_HEADER_P_CHARGING_FUNCTION_ADDRESSES_H_ */

View File

@ -41,7 +41,9 @@ TSIP_BEGIN_DECLS
* Creates new sip 'Path' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_PATH_CREATE() tsk_object_new(tsip_header_Path_def_t)
#define TSIP_HEADER_PATH_VA_ARGS(uri) tsip_header_Path_def_t, (const tsip_uri_t*)uri
#define TSIP_HEADER_PATH_CREATE(uri) tsk_object_new(TSIP_HEADER_PATH_VA_ARGS(uri))
#define TSIP_HEADER_PATH_CREATE_NULL() TSIP_HEADER_PATH_CREATE(0)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct

View File

@ -41,7 +41,9 @@ TSIP_BEGIN_DECLS
* Creates new sip 'Route' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_ROUTE_CREATE() tsk_object_new(tsip_header_Route_def_t)
#define TSIP_HEADER_ROUTE_VA_ARGS(uri) tsip_header_Route_def_t, (const tsip_uri_t*)uri
#define TSIP_HEADER_ROUTE_CREATE(uri) tsk_object_new(TSIP_HEADER_ROUTE_VA_ARGS(uri))
#define TSIP_HEADER_ROUTE_CREATE_NULL() TSIP_HEADER_ROUTE_CREATE(0)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct

View File

@ -35,6 +35,13 @@
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_SERVER_CREATE
* Creates new sip 'Server' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_SERVER_VA_ARGS(server) tsip_header_Server_def_t, (const char*)server
#define TSIP_HEADER_SERVER_CREATE(server) tsk_object_new(TSIP_HEADER_SERVER_VA_ARGS(server))
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
@ -42,15 +49,23 @@ TSIP_BEGIN_DECLS
/// @author Mamadou
/// @date 12/3/2009
///
/// @par ABNF
/// @par ABNF: Server = "Server" HCOLON server-val *(LWS server-val)
/// server-val = product / comment
/// product = token [SLASH product-version]
/// product-version = token
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsip_header_Server_s
{
TSIP_DECLARE_HEADER;
char* value;
}
tsip_header_Server_t;
tsip_header_Server_t *tsip_header_Server_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_Server_def_t;
TSIP_END_DECLS
#endif /* _TSIP_HEADER_SERVER_H_ */

View File

@ -41,7 +41,9 @@ TSIP_BEGIN_DECLS
* Creates new sip 'Service-Route' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_SERVICE_ROUTE_CREATE() tsk_object_new(tsip_header_Service_Route_def_t)
#define TSIP_HEADER_SERVICE_ROUTE_VA_ARGS(uri) tsip_header_Service_Route_def_t, (const tsip_uri_t*)uri
#define TSIP_HEADER_SERVICE_ROUTE_CREATE(uri) tsk_object_new(TSIP_HEADER_SERVICE_ROUTE_VA_ARGS(uri))
#define TSIP_HEADER_SERVICE_ROUTE_CREATE_NULL() TSIP_HEADER_SERVICE_ROUTE_CREATE(0)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct

View File

@ -35,6 +35,12 @@
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_WARNING_CREATE
* Creates new sip 'Warning' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_WARNING_CREATE() tsk_object_new(tsip_header_Warning_def_t)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
@ -42,15 +48,30 @@ TSIP_BEGIN_DECLS
/// @author Mamadou
/// @date 12/3/2009
///
/// @par ABNF
/// @par ABNF: Warning = "Warning" HCOLON warning-value *(COMMA warning-value)
/// warning-value = warn-code SP warn-agent SP warn-text
/// warn-code = 3DIGIT
/// warn-agent = hostport / pseudonym
/// warn-text = quoted-string
/// pseudonym = token
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsip_header_Warning_s
{
TSIP_DECLARE_HEADER;
int32_t code;
char* agent;
char* text;
}
tsip_header_Warning_t;
typedef tsk_list_t tsip_header_Warnings_L_t;
tsip_header_Warnings_L_t *tsip_header_Warning_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_Warning_def_t;
TSIP_END_DECLS
#endif /* _TSIP_HEADER_WARNING_H_ */

View File

@ -0,0 +1,73 @@
/*
* ex: set ro:
* DO NOT EDIT.
* generated by smc (http://smc.sourceforge.net/)
* from file : tsip_dialog_subscribe.sm
*/
#ifndef _H_TSIP_DIALOG_SUBSCRIBE_SM
#define _H_TSIP_DIALOG_SUBSCRIBE_SM
#include <statemap.h>
struct tsip_dialog_subscribe;
struct tsip_dialog_subscribeContext;
struct tsip_dialog_subscribeState
{
void(*Entry)(struct tsip_dialog_subscribeContext*);
void(*sm_1xx)(struct tsip_dialog_subscribeContext*, const tsip_message_t*);
void(*sm_2xx)(struct tsip_dialog_subscribeContext*, int, const tsip_response_t*);
void(*sm_300_to_699)(struct tsip_dialog_subscribeContext*, const tsip_response_t*);
void(*sm_401_407_421_494)(struct tsip_dialog_subscribeContext*, const tsip_response_t*);
void(*sm_423)(struct tsip_dialog_subscribeContext*, const tsip_response_t*);
void(*sm_NOTIFY)(struct tsip_dialog_subscribeContext*, int, const tsip_request_t*);
void(*sm_cancel)(struct tsip_dialog_subscribeContext*);
void(*sm_error)(struct tsip_dialog_subscribeContext*);
void(*sm_hangup)(struct tsip_dialog_subscribeContext*);
void(*sm_refresh)(struct tsip_dialog_subscribeContext*);
void(*sm_send)(struct tsip_dialog_subscribeContext*);
void(*sm_transportError)(struct tsip_dialog_subscribeContext*);
void(*sm_unsubscribe)(struct tsip_dialog_subscribeContext*);
void(*Default)(struct tsip_dialog_subscribeContext*);
STATE_MEMBERS
};
extern const struct tsip_dialog_subscribeState tsip_dialog_subscribe_Started;
extern const struct tsip_dialog_subscribeState tsip_dialog_subscribe_Trying;
extern const struct tsip_dialog_subscribeState tsip_dialog_subscribe_Connected;
extern const struct tsip_dialog_subscribeState tsip_dialog_subscribe_Terminated;
struct tsip_dialog_subscribeContext
{
FSM_MEMBERS(tsip_dialog_subscribe)
struct tsip_dialog_subscribe *_owner;
};
extern void tsip_dialog_subscribeContext_Init(struct tsip_dialog_subscribeContext*, struct tsip_dialog_subscribe*);
extern void tsip_dialog_subscribeContext_EnterStartState(struct tsip_dialog_subscribeContext*);
extern void tsip_dialog_subscribeContext_sm_1xx(struct tsip_dialog_subscribeContext*, const tsip_message_t*);
extern void tsip_dialog_subscribeContext_sm_2xx(struct tsip_dialog_subscribeContext*, int, const tsip_response_t*);
extern void tsip_dialog_subscribeContext_sm_300_to_699(struct tsip_dialog_subscribeContext*, const tsip_response_t*);
extern void tsip_dialog_subscribeContext_sm_401_407_421_494(struct tsip_dialog_subscribeContext*, const tsip_response_t*);
extern void tsip_dialog_subscribeContext_sm_423(struct tsip_dialog_subscribeContext*, const tsip_response_t*);
extern void tsip_dialog_subscribeContext_sm_NOTIFY(struct tsip_dialog_subscribeContext*, int, const tsip_request_t*);
extern void tsip_dialog_subscribeContext_sm_cancel(struct tsip_dialog_subscribeContext*);
extern void tsip_dialog_subscribeContext_sm_error(struct tsip_dialog_subscribeContext*);
extern void tsip_dialog_subscribeContext_sm_hangup(struct tsip_dialog_subscribeContext*);
extern void tsip_dialog_subscribeContext_sm_refresh(struct tsip_dialog_subscribeContext*);
extern void tsip_dialog_subscribeContext_sm_send(struct tsip_dialog_subscribeContext*);
extern void tsip_dialog_subscribeContext_sm_transportError(struct tsip_dialog_subscribeContext*);
extern void tsip_dialog_subscribeContext_sm_unsubscribe(struct tsip_dialog_subscribeContext*);
#endif
/*
* Local variables:
* buffer-read-only: t
* End:
*/

View File

@ -58,6 +58,7 @@ typedef void tsip_operation_handle_t;
tsip_operation_handle_t *tsip_operation_clone(const 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);
typedef tsk_list_t tsip_operations_L_t; /**< List of @ref tsip_operation_handle_t elements. */
TINYSIP_GEXTERN const void *tsip_operation_def_t;

View File

@ -37,9 +37,9 @@
#include "tinysip/tsip_event.h"
#include "tinysip/api/tsip_register.h"
#include "tinysip/api/tsip_subscribe.h"
#include "tinysip/headers/tsip_header_Service_Route.h"
#include "tinysip/headers/tsip_header_Path.h"
#include "tinysip/tsip_uri.h"
#include "tnet_socket.h"
#include "dns/tnet_dns.h"
@ -128,11 +128,12 @@ typedef struct tsip_stack_s
tsip_stack_callback callback;
tsip_register_callback callback_register;
tsip_subscribe_callback callback_subscribe;
/* Identity */
char* display_name;
struct tsip_uri_s *public_identity;
struct tsip_uri_s *preferred_identity;
tsip_uri_t *public_identity;
tsip_uri_t *preferred_identity;
//struct tsip_uri_s *associated_identity;
char *private_identity;
char *password;
@ -153,8 +154,9 @@ typedef struct tsip_stack_s
char* device_id;
char* mobility;
char* sec_agree_mech;
tsip_header_Paths_L_t* paths;
tsip_header_Service_Routes_L_t* service_routes;
tsip_uris_L_t* paths;
tsip_uris_L_t* service_routes;
tsip_uris_L_t* associated_uris;
/* DNS */
tnet_dns_ctx_t *dns_ctx;
@ -200,10 +202,12 @@ TINYSIP_API tsip_stack_handle_t *tsip_stack_create(tsip_stack_callback callback,
TINYSIP_API int tsip_stack_start(tsip_stack_handle_t *self);
TINYSIP_API int tsip_stack_set(tsip_stack_handle_t *self, ...);
TINYSIP_API int tsip_stack_set_callback_register(tsip_stack_handle_t *self, tsip_register_callback callback);
TINYSIP_API int tsip_stack_set_callback_subscribe(tsip_stack_handle_t *self, tsip_subscribe_callback callback);
int tsip_stack_alert(const tsip_stack_handle_t *self, tsip_operation_id_t opid, short status_code, char *reason_phrase, int incoming, tsip_event_type_t type);
TINYSIP_API int tsip_stack_stop(tsip_stack_handle_t *self);
TINYSIP_API int tsip_stack_destroy(tsip_stack_handle_t *self);
tsip_uri_t* tsip_stack_get_contacturi(const tsip_stack_handle_t *self, const char* protocol);
const tsk_timer_manager_handle_t* tsip_stack_get_timer_mgr(const tsip_stack_handle_t *self);
struct tsip_dialog_layer_s* tsip_stack_get_dialog_layer(const tsip_stack_handle_t *self);
struct tsip_transac_layer_s* tsip_stack_get_transac_layer(const tsip_stack_handle_t *self);
@ -212,6 +216,9 @@ struct tsip_transport_layer_s* tsip_stack_get_transport_layer(const tsip_stack_h
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_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);
#define TSIP_STACK_EVENT_RAISE(stack, status_code, reason_phrase, incoming, type) \
TSK_RUNNABLE_ENQUEUE(TSK_RUNNABLE(stack), (const tsip_stack_handle_t*)stack, (short)status_code, (const char*)reason_phrase, (unsigned)incoming, (tsip_event_type_t)type);

View File

@ -38,6 +38,9 @@ ragel.exe $OPTIONS -o ../src/headers/tsip_header_Contact.c tsip_parser_header_Co
# ==CSeq
ragel.exe $OPTIONS -o ../src/headers/tsip_header_CSeq.c tsip_parser_header_CSeq.rl
# ==Event
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Event.c tsip_parser_header_Event.rl
# ==Expires
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Expires.c tsip_parser_header_Expires.rl
@ -56,6 +59,15 @@ ragel.exe $OPTIONS -o ../src/headers/tsip_header_Path.c tsip_parser_header_Path.
# ==P-Access-Network-Info
ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Access_Network_Info.c tsip_parser_header_P_Access_Network_Info.rl
# ==P-Asserted-Identity
ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Asserted_Identity.c tsip_parser_header_P_Asserted_Identity.rl
# ==P-Associated-URI
ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Associated_URI.c tsip_parser_header_P_Associated_URI.rl
# ==P-Charging-Function-Addresses
ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Charging_Function_Addresses.c tsip_parser_header_P_Charging_Function_Addresses.rl
# ==P-Preferred-Identity
ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Preferred_Identity.c tsip_parser_header_P_Preferred_Identity.rl
@ -74,7 +86,10 @@ ragel.exe $OPTIONS -o ../src/headers/tsip_header_Record_Route.c tsip_parser_head
# ==Require
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Require.c tsip_parser_header_Require.rl
# == Service-Route
# == Server
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Server.c tsip_parser_header_Server.rl
# == Route
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Route.c tsip_parser_header_Route.rl
# == Service-Route
@ -92,5 +107,8 @@ ragel.exe $OPTIONS -o ../src/headers/tsip_header_User_Agent.c tsip_parser_header
# ==Via
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Via.c tsip_parser_header_Via.rl
# ==Warning
ragel.exe $OPTIONS -o ../src/headers/tsip_header_Warning.c tsip_parser_header_Warning.rl
# ==WWW-Authenticate
#########ragel.exe $OPTIONS -o ../src/headers/tsip_header_WWW_Authenticate.c tsip_parser_header_WWW_Authenticate.rl

View File

@ -35,12 +35,16 @@
#include "tinysip/headers/tsip_header_Call_ID.h"
#include "tinysip/headers/tsip_header_Contact.h"
#include "tinysip/headers/tsip_header_CSeq.h"
#include "tinysip/headers/tsip_header_Event.h"
#include "tinysip/headers/tsip_header_Expires.h"
#include "tinysip/headers/tsip_header_From.h"
#include "tinysip/headers/tsip_header_Max_Forwards.h"
#include "tinysip/headers/tsip_header_Min_Expires.h"
#include "tinysip/headers/tsip_header_Path.h"
#include "tinysip/headers/tsip_header_P_Access_Network_Info.h"
#include "tinysip/headers/tsip_header_P_Asserted_Identity.h"
#include "tinysip/headers/tsip_header_P_Associated_URI.h"
#include "tinysip/headers/tsip_header_P_Charging_Function_Addresses.h"
#include "tinysip/headers/tsip_header_P_Preferred_Identity.h"
#include "tinysip/headers/tsip_header_Privacy.h"
#include "tinysip/headers/tsip_header_Proxy_Authenticate.h"
@ -48,15 +52,39 @@
#include "tinysip/headers/tsip_header_Record_Route.h"
#include "tinysip/headers/tsip_header_Require.h"
#include "tinysip/headers/tsip_header_Route.h"
#include "tinysip/headers/tsip_header_Server.h"
#include "tinysip/headers/tsip_header_Service_Route.h"
#include "tinysip/headers/tsip_header_Supported.h"
#include "tinysip/headers/tsip_header_To.h"
#include "tinysip/headers/tsip_header_User_Agent.h"
#include "tinysip/headers/tsip_header_Via.h"
#include "tinysip/headers/tsip_header_Warning.h"
#include "tinysip/headers/tsip_header_WWW_Authenticate.h"
#include "tsk_debug.h"
#undef ADD_HEADERS
#undef ADD_HEADER
#define ADD_HEADERS(headers)\
if(headers)\
{\
tsk_list_item_t *item;\
tsk_list_foreach(item, headers)\
{\
tsip_header_t *hdr = tsk_object_ref(item->data);\
tsk_list_push_back_data(message->headers, ((void**) &hdr));\
}\
\
TSK_OBJECT_SAFE_FREE(headers);\
}
#define ADD_HEADER(header)\
if(header)\
{\
tsk_list_push_back_data(message->headers, ((void**) &header));\
}
/***********************************
* Ragel state machine.
*/
@ -104,20 +132,14 @@
action parse_header_Allow
{
tsip_header_Allow_t *header = tsip_header_Allow_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== Allow-Events: ==*/
action parse_header_Allow_Events
{
tsip_header_Allow_Events_t *header = tsip_header_Allow_Events_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== Authentication-Info: ==*/
@ -130,10 +152,7 @@
action parse_header_Authorization
{
tsip_header_Authorization_t *header = tsip_header_Authorization_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== Call-ID: ==*/
@ -155,24 +174,7 @@
action parse_header_Contact
{
tsip_header_Contacts_L_t* headers = tsip_header_Contact_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Contact_t *hdr = tsk_object_ref(item->data);
if(!message->Contact)
{
message->Contact = hdr;
}
else
{
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
}
TSK_OBJECT_SAFE_FREE(headers);
}
ADD_HEADERS(headers);
}
# /*== Content-Disposition: ==*/
@ -235,7 +237,8 @@
# /*== Event: ==*/
action parse_header_Event
{
TSK_DEBUG_ERROR("parse_header_Event NOT IMPLEMENTED");
tsip_header_Event_t *header = tsip_header_Event_parse(state->tag_start, (state->tag_end-state->tag_start));
ADD_HEADER(header);
}
# /*== Expires: ==*/
@ -290,10 +293,7 @@
action parse_header_Max_Forwards
{
tsip_header_Max_Forwards_t *header = tsip_header_Max_Forwards_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== MIME-Version: ==*/
@ -306,10 +306,7 @@
action parse_header_Min_Expires
{
tsip_header_Min_Expires_t *header = tsip_header_Min_Expires_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== Min-SE: ==*/
@ -328,10 +325,7 @@
action parse_header_P_Access_Network_Info
{
tsip_header_P_Access_Network_Info_t *header = tsip_header_P_Access_Network_Info_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== P-Answer-State: ==*/
@ -343,13 +337,15 @@
# /*== P-Asserted-Identity: ==*/
action parse_header_P_Asserted_Identity
{
TSK_DEBUG_ERROR("parse_header_P_Asserted_Identity NOT IMPLEMENTED");
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);
}
# /*== P-Associated-URI: ==*/
action parse_header_P_Associated_URI
action parse_header_P_Associated_URI
{
TSK_DEBUG_ERROR("parse_header_P_Associated_URI NOT IMPLEMENTED");
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);
}
# /*== P-Called-Party-ID: ==*/
@ -361,7 +357,8 @@
# /*== P-Charging-Function-Addresses : ==*/
action parse_header_P_Charging_Function_Addresses
{
TSK_DEBUG_ERROR("parse_header_P_Charging_Function_Addresses NOT IMPLEMENTED");
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);
}
# /*== P_Charging_Vector: ==*/
@ -416,10 +413,7 @@
action parse_header_P_Preferred_Identity
{
tsip_header_P_Preferred_Identity_t *header = tsip_header_P_Preferred_Identity_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== P-Profile-Key: ==*/
@ -444,17 +438,7 @@
action parse_header_Path
{
tsip_header_Paths_L_t* headers = tsip_header_Path_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
ADD_HEADERS(headers);
}
# /* == Priority: ==*/
@ -467,30 +451,21 @@
action parse_header_Privacy
{
tsip_header_Privacy_t *header = tsip_header_Privacy_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== Authenticate: ==*/
action parse_header_Proxy_Authenticate
{
tsip_header_Proxy_Authenticate_t *header = tsip_header_Proxy_Authenticate_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== Proxy-Authorization: ==*/
action parse_header_Proxy_Authorization
{
tsip_header_Proxy_Authorization_t *header = tsip_header_Proxy_Authorization_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== Proxy-Require: ==*/
@ -515,10 +490,7 @@
action parse_header_Record_Route
{
tsip_header_Record_Route_t *header = tsip_header_Record_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== Refer-Sub: ==*/
@ -589,17 +561,7 @@
action parse_header_Route
{
tsip_header_Routes_L_t* headers = tsip_header_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
ADD_HEADERS(headers);
}
# /*== RSeq: ==*/
@ -629,24 +591,15 @@
# /*== Server: ==*/
action parse_header_Server
{
TSK_DEBUG_ERROR("parse_header_Server NOT IMPLEMENTED");
tsip_header_Server_t *header = tsip_header_Server_parse(state->tag_start, (state->tag_end-state->tag_start));
ADD_HEADER(header);
}
# /*== Service-Route: ==*/
action parse_header_Service_Route
{
tsip_header_Service_Routes_L_t* headers = tsip_header_Service_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Service_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
ADD_HEADERS(headers);
}
# /*== Session-Expires: ==*/
@ -683,10 +636,7 @@
action parse_header_Supported
{
tsip_header_Supported_t *header = tsip_header_Supported_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== Target-Dialog: ==*/
@ -720,10 +670,7 @@
action parse_header_User_Agent
{
tsip_header_User_Agent_t *header = tsip_header_User_Agent_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== Via: ==*/
@ -746,17 +693,15 @@
# /*== Warning: ==*/
action parse_header_Warning
{
TSK_DEBUG_ERROR("parse_header_Warning NOT IMPLEMENTED");
tsip_header_Warnings_L_t* headers = tsip_header_Warning_parse(state->tag_start, (state->tag_end-state->tag_start));
ADD_HEADERS(headers);
}
# /*== WWW-Authenticate: ==*/
action parse_header_WWW_Authenticate
{
tsip_header_WWW_Authenticate_t *header = tsip_header_WWW_Authenticate_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
# /*== extension_header: ==*/

View File

@ -0,0 +1,169 @@
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_Event.c
* @brief SIP Event/o header as per RFC 3265..
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_Event.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include <string.h>
/**@defgroup tsip_header_Event_group SIP Event header as per RFC 3265.
*/
/***********************************
* Ragel state machine.
*/
%%{
machine tsip_machine_parser_header_Event;
# Includes
include tsip_machine_utils "./tsip_machine_utils.rl";
action tag
{
tag_start = p;
}
action parse_package
{
TSK_PARSER_SET_STRING(hdr_event->package);
}
action parse_param
{
TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_event));
}
action eob
{
}
event_param = generic_param>tag %parse_param;
event_package = token_nodot;
event_template = token_nodot;
event_type = (event_package ( "." event_template )*)>tag %parse_package;
Event = ( "Event"i | "o"i ) HCOLON event_type ( SEMI event_param )*;
# Entry point
main := Event :>CRLF @eob;
}%%
int tsip_header_Event_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_Event_t *Event = header;
if(Event->package)
{
tsk_buffer_append(output, Event->package, strlen(Event->package));
}
return 0;
}
return -1;
}
tsip_header_Event_t *tsip_header_Event_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_Event_t *hdr_event = TSIP_HEADER_EVENT_CREATE(0);
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% )
{
TSK_OBJECT_SAFE_FREE(hdr_event);
}
return hdr_event;
}
//========================================================
// 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;
if(Event)
{
TSIP_HEADER(Event)->type = tsip_htype_Event;
TSIP_HEADER(Event)->tostring = tsip_header_Event_tostring;
Event->package = tsk_strdup(va_arg(*app, const char*));
}
else
{
TSK_DEBUG_ERROR("Failed to create new Event header.");
}
return self;
}
/**@ingroup tsip_header_Event_group
*/
static void* tsip_header_Event_destroy(void *self)
{
tsip_header_Event_t *Event = self;
if(Event)
{
TSK_FREE(Event->package);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Event));
}
else TSK_DEBUG_ERROR("Null Event header.");
return self;
}
static const tsk_object_def_t tsip_header_Event_def_s =
{
sizeof(tsip_header_Event_t),
tsip_header_Event_create,
tsip_header_Event_destroy,
0
};
const void *tsip_header_Event_def_t = &tsip_header_Event_def_s;

View File

@ -0,0 +1,202 @@
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_P_Asserted_Identity.c
* @brief SIP P-Asserted-Identity header as per RFC 3325.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_P_Asserted_Identity.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_time.h"
#include <string.h>
/**@defgroup tsip_header_P_Asserted_Identity_group SIP P_Asserted_Identity header.
*/
/***********************************
* Ragel state machine.
*/
%%{
machine tsip_machine_parser_header_P_Asserted_Identity;
# Includes
include tsip_machine_utils "./tsip_machine_utils.rl";
action tag
{
tag_start = p;
}
action create_p_asserted_identity
{
if(!curr_p_asserted_identity)
{
curr_p_asserted_identity = TSIP_HEADER_P_ASSERTED_IDENTITY_CREATE();
}
}
action parse_display_name
{
if(curr_p_asserted_identity)
{
TSK_PARSER_SET_STRING(curr_p_asserted_identity->display_name);
}
}
action parse_uri
{
if(curr_p_asserted_identity && !curr_p_asserted_identity->uri)
{
int len = (int)(p - tag_start);
curr_p_asserted_identity->uri = tsip_uri_parse(tag_start, (size_t)len);
}
}
action add_p_asserted_identity
{
if(curr_p_asserted_identity)
{
tsk_list_push_back_data(hdr_p_asserted_identities, ((void**) &curr_p_asserted_identity));
}
}
action eob
{
}
URI = (scheme HCOLON any+)>tag %parse_uri;
display_name = (( token LWS )+ | quoted_string)>tag %parse_display_name;
my_name_addr = display_name? :>LAQUOT<: URI :>RAQUOT;
PAssertedID_value = (my_name_addr | URI) >create_p_asserted_identity %add_p_asserted_identity;
PAssertedID = "P-Asserted-Identity"i HCOLON PAssertedID_value ( COMMA PAssertedID_value )*;
P_Asserted_Identity = PAssertedID;
# Entry point
main := P_Asserted_Identity :>CRLF @eob;
}%%
int tsip_header_P_Asserted_Identity_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_P_Asserted_Identity_t *P_Asserted_Identity = header;
int ret = 0;
if(P_Asserted_Identity->display_name){ /* Display Name */
tsk_buffer_appendEx(output, "\"%s\"", P_Asserted_Identity->display_name);
}
if(ret=tsip_uri_serialize(P_Asserted_Identity->uri, 1, 1, output)){ /* P_Asserted_Identity */
return ret;
}
return ret;
}
return -1;
}
tsip_header_P_Asserted_Identities_L_t *tsip_header_P_Asserted_Identity_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_P_Asserted_Identities_L_t *hdr_p_asserted_identities = TSK_LIST_CREATE();
const char *tag_start;
tsip_header_P_Asserted_Identity_t *curr_p_asserted_identity = 0;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% )
{
TSK_OBJECT_SAFE_FREE(curr_p_asserted_identity);
TSK_OBJECT_SAFE_FREE(hdr_p_asserted_identities);
}
return hdr_p_asserted_identities;
}
//========================================================
// P_Asserted_Identity header object definition
//
/**@ingroup tsip_header_P_Asserted_Identity_group
*/
static void* tsip_header_P_Asserted_Identity_create(void *self, va_list * app)
{
tsip_header_P_Asserted_Identity_t *P_Asserted_Identity = self;
if(P_Asserted_Identity)
{
TSIP_HEADER(P_Asserted_Identity)->type = tsip_htype_P_Asserted_Identity;
TSIP_HEADER(P_Asserted_Identity)->tostring = tsip_header_P_Asserted_Identity_tostring;
}
else
{
TSK_DEBUG_ERROR("Failed to create new P_Asserted_Identity header.");
}
return self;
}
/**@ingroup tsip_header_P_Asserted_Identity_group
*/
static void* tsip_header_P_Asserted_Identity_destroy(void *self)
{
tsip_header_P_Asserted_Identity_t *P_Asserted_Identity = self;
if(P_Asserted_Identity)
{
TSK_FREE(P_Asserted_Identity->display_name);
TSK_OBJECT_SAFE_FREE(P_Asserted_Identity->uri);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(P_Asserted_Identity));
}
else TSK_DEBUG_ERROR("Null P_Asserted_Identity header.");
return self;
}
static const tsk_object_def_t tsip_header_P_Asserted_Identity_def_s =
{
sizeof(tsip_header_P_Asserted_Identity_t),
tsip_header_P_Asserted_Identity_create,
tsip_header_P_Asserted_Identity_destroy,
0
};
const void *tsip_header_P_Asserted_Identity_def_t = &tsip_header_P_Asserted_Identity_def_s;

View File

@ -0,0 +1,215 @@
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_P_Associated_URI.c
* @brief SIP P-Associated-URI header as per RFC 3455.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_P_Associated_URI.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_time.h"
#include <string.h>
/**@defgroup tsip_header_P_Associated_URI_group SIP P_Associated_URI header.
*/
/***********************************
* Ragel state machine.
*/
%%{
machine tsip_machine_parser_header_P_Associated_URI;
# Includes
include tsip_machine_utils "./tsip_machine_utils.rl";
action tag
{
tag_start = p;
}
action create_p_associated_uri
{
if(!curr_p_associated_uri)
{
curr_p_associated_uri = TSIP_HEADER_P_ASSOCIATED_URI_CREATE_NULL();
}
}
action parse_display_name
{
if(curr_p_associated_uri)
{
TSK_PARSER_SET_STRING(curr_p_associated_uri->display_name);
}
}
action parse_uri
{
if(curr_p_associated_uri && !curr_p_associated_uri->uri)
{
int len = (int)(p - tag_start);
curr_p_associated_uri->uri = tsip_uri_parse(tag_start, (size_t)len);
}
}
action parse_param
{
if(curr_p_associated_uri)
{
TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_p_associated_uri));
}
}
action add_p_associated_uri
{
if(curr_p_associated_uri)
{
tsk_list_push_back_data(hdr_p_associated_uris, ((void**) &curr_p_associated_uri));
}
}
action eob
{
}
URI = (scheme HCOLON any+)>tag %parse_uri;
display_name = (( token LWS )+ | quoted_string)>tag %parse_display_name;
my_name_addr = display_name? :>LAQUOT<: URI :>RAQUOT;
ai_param = (generic_param)>tag %parse_param;
p_aso_uri_spec = (my_name_addr ( SEMI ai_param )*) >create_p_associated_uri %add_p_associated_uri;
P_Associated_URI = "P-Associated-URI"i HCOLON p_aso_uri_spec ( COMMA p_aso_uri_spec )*;
# Entry point
main := P_Associated_URI :>CRLF @eob;
}%%
int tsip_header_P_Associated_URI_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_P_Associated_URI_t *P_Associated_URI = header;
int ret = 0;
if(P_Associated_URI->display_name){ /* Display Name */
tsk_buffer_appendEx(output, "\"%s\"", P_Associated_URI->display_name);
}
if(ret=tsip_uri_serialize(P_Associated_URI->uri, 1, 1, output)){ /* P_Associated_URI */
return ret;
}
return ret;
}
return -1;
}
tsip_header_P_Associated_URIs_L_t *tsip_header_P_Associated_URI_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_P_Associated_URIs_L_t *hdr_p_associated_uris = TSK_LIST_CREATE();
const char *tag_start;
tsip_header_P_Associated_URI_t *curr_p_associated_uri = 0;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% )
{
TSK_OBJECT_SAFE_FREE(curr_p_associated_uri);
TSK_OBJECT_SAFE_FREE(hdr_p_associated_uris);
}
return hdr_p_associated_uris;
}
//========================================================
// 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;
if(P_Associated_URI)
{
const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*);
TSIP_HEADER(P_Associated_URI)->type = tsip_htype_P_Associated_URI;
TSIP_HEADER(P_Associated_URI)->tostring = tsip_header_P_Associated_URI_tostring;
if(uri){
P_Associated_URI->uri = tsk_object_ref((void*)uri);
}
}
else
{
TSK_DEBUG_ERROR("Failed to create new P_Associated_URI header.");
}
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;
if(P_Associated_URI)
{
TSK_FREE(P_Associated_URI->display_name);
TSK_OBJECT_SAFE_FREE(P_Associated_URI->uri);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(P_Associated_URI));
}
else TSK_DEBUG_ERROR("Null P_Associated_URI header.");
return self;
}
static const tsk_object_def_t tsip_header_P_Associated_URI_def_s =
{
sizeof(tsip_header_P_Associated_URI_t),
tsip_header_P_Associated_URI_create,
tsip_header_P_Associated_URI_destroy,
0
};
const void *tsip_header_P_Associated_URI_def_t = &tsip_header_P_Associated_URI_def_s;

View File

@ -0,0 +1,204 @@
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_P_Charging_Function_Addresses.c
* @brief SIP P-Charging-Function-Addresses header as per RFC 3455.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_P_Charging_Function_Addresses.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_time.h"
#include <string.h>
/**@defgroup tsip_header_P_Charging_Function_Addresses_group SIP P_Charging_Function_Addresses header.
*/
/***********************************
* Ragel state machine.
*/
%%{
machine tsip_machine_parser_header_P_Charging_Function_Addresses;
# Includes
include tsip_machine_utils "./tsip_machine_utils.rl";
action tag
{
tag_start = p;
}
action create_p_charging_function_addresses
{
if(!curr_p_charging_function_addresses)
{
curr_p_charging_function_addresses = TSIP_HEADER_P_CHARGING_FUNCTION_ADDRESSES_CREATE();
}
}
action parse_ccf
{
if(!curr_p_charging_function_addresses->ccf)
{
TSK_PARSER_SET_STRING(curr_p_charging_function_addresses->ccf);
}
}
action parse_ecf
{
if(!curr_p_charging_function_addresses->ecf)
{
TSK_PARSER_SET_STRING(curr_p_charging_function_addresses->ecf);
}
}
action parse_param
{
if(curr_p_charging_function_addresses)
{
TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_p_charging_function_addresses));
}
}
action add_p_charging_function_addresses
{
if(curr_p_charging_function_addresses)
{
tsk_list_push_back_data(hdr_p_charging_function_addressess, ((void**) &curr_p_charging_function_addresses));
}
}
action eob
{
}
ccf = "ccf"i EQUAL gen_value;
ecf = "ecf"i EQUAL gen_value;
charge_addr_params = (ccf>tag %parse_ccf | ecf>tag %parse_ecf | generic_param>tag %parse_param) >create_p_charging_function_addresses %add_p_charging_function_addresses;
P_Charging_Addr = "P-Charging-Function-Addresses"i HCOLON charge_addr_params ( SEMI charge_addr_params )*;
P_Charging_Function_Addresses = P_Charging_Addr;
# Entry point
main := P_Charging_Function_Addresses :>CRLF @eob;
}%%
int tsip_header_P_Charging_Function_Addresses_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_P_Charging_Function_Addresses_t *P_Charging_Function_Addresses = header;
return tsk_buffer_appendEx(output, "%s%s%s%s%s",
P_Charging_Function_Addresses->ecf ? "ecf=" : "",
P_Charging_Function_Addresses->ecf ? P_Charging_Function_Addresses->ecf : "",
(P_Charging_Function_Addresses->ecf && P_Charging_Function_Addresses->ccf) ? ";" : "",
P_Charging_Function_Addresses->ccf ? "ccf=" : "",
P_Charging_Function_Addresses->ccf ? P_Charging_Function_Addresses->ccf : ""
);
}
return -1;
}
tsip_header_P_Charging_Function_Addressess_L_t *tsip_header_P_Charging_Function_Addresses_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_P_Charging_Function_Addressess_L_t *hdr_p_charging_function_addressess = TSK_LIST_CREATE();
const char *tag_start;
tsip_header_P_Charging_Function_Addresses_t *curr_p_charging_function_addresses = 0;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% )
{
TSK_OBJECT_SAFE_FREE(curr_p_charging_function_addresses);
TSK_OBJECT_SAFE_FREE(hdr_p_charging_function_addressess);
}
return hdr_p_charging_function_addressess;
}
//========================================================
// 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;
if(P_Charging_Function_Addresses)
{
TSIP_HEADER(P_Charging_Function_Addresses)->type = tsip_htype_P_Charging_Function_Addresses;
TSIP_HEADER(P_Charging_Function_Addresses)->tostring = tsip_header_P_Charging_Function_Addresses_tostring;
}
else
{
TSK_DEBUG_ERROR("Failed to create new P_Charging_Function_Addresses header.");
}
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;
if(P_Charging_Function_Addresses)
{
TSK_FREE(P_Charging_Function_Addresses->ecf);
TSK_FREE(P_Charging_Function_Addresses->ccf);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(P_Charging_Function_Addresses));
}
else TSK_DEBUG_ERROR("Null P_Charging_Function_Addresses header.");
return self;
}
static const tsk_object_def_t tsip_header_P_Charging_Function_Addresses_def_s =
{
sizeof(tsip_header_P_Charging_Function_Addresses_t),
tsip_header_P_Charging_Function_Addresses_create,
tsip_header_P_Charging_Function_Addresses_destroy,
0
};
const void *tsip_header_P_Charging_Function_Addresses_def_t = &tsip_header_P_Charging_Function_Addresses_def_s;

View File

@ -58,7 +58,7 @@
{
if(!curr_path)
{
curr_path = TSIP_HEADER_PATH_CREATE();
curr_path = TSIP_HEADER_PATH_CREATE_NULL();
}
}
@ -174,8 +174,13 @@ static void* tsip_header_Path_create(void *self, va_list * app)
tsip_header_Path_t *Path = self;
if(Path)
{
const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*);
TSIP_HEADER(Path)->type = tsip_htype_Path;
TSIP_HEADER(Path)->tostring = tsip_header_Path_tostring;
if(uri){
Path->uri = tsk_object_ref((void*)uri);
}
}
else
{

View File

@ -21,7 +21,7 @@
*/
/**@file tsip_header_Route.c
* @brief SIP Service-Route header as per RFC 3608.
* @brief SIP Route header.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
@ -37,7 +37,7 @@
#include <string.h>
/**@defgroup tsip_header_Route_group SIP Service-Route header.
/**@defgroup tsip_header_Route_group SIP Route header.
*/
/***********************************
@ -58,7 +58,7 @@
{
if(!curr_route)
{
curr_route = TSIP_HEADER_ROUTE_CREATE();
curr_route = TSIP_HEADER_ROUTE_CREATE_NULL();
}
}
@ -177,8 +177,14 @@ static void* tsip_header_Route_create(void *self, va_list * app)
tsip_header_Route_t *Route = self;
if(Route)
{
const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*);
TSIP_HEADER(Route)->type = tsip_htype_Route;
TSIP_HEADER(Route)->tostring = tsip_header_Route_tostring;
if(uri){
Route->uri = tsk_object_ref((void*)uri);
}
}
else
{

View File

@ -0,0 +1,164 @@
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_Server.c
* @brief SIP Server header.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_Server.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include <string.h>
/**@defgroup tsip_header_Server_group SIP Server header.
*/
/***********************************
* Ragel state machine.
*/
%%{
machine tsip_machine_parser_header_Server;
# Includes
include tsip_machine_utils "./tsip_machine_utils.rl";
action tag
{
tag_start = p;
}
action parse_server
{
TSK_PARSER_SET_STRING(hdr_server->value);
}
action eob
{
}
# product_version = token;
# product = token ( SLASH product_version )?;
# server_val = product | comment;
# Server = "Server"i HCOLON (server_val ( LWS server_val )*)>tag %parse_server;
Server = "Server"i HCOLON (any*)>tag %parse_server;
# Entry point
main := Server :>CRLF @eob;
}%%
int tsip_header_Server_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_Server_t *Server = header;
if(Server->value)
{
return tsk_buffer_append(output, Server->value, strlen(Server->value));
}
return 0;
}
return -1;
}
tsip_header_Server_t *tsip_header_Server_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_Server_t *hdr_server = TSIP_HEADER_SERVER_CREATE(0);
const char *tag_start;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% )
{
TSK_OBJECT_SAFE_FREE(hdr_server);
}
return hdr_server;
}
//========================================================
// 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;
if(Server)
{
TSIP_HEADER(Server)->type = tsip_htype_Server;
TSIP_HEADER(Server)->tostring = tsip_header_Server_tostring;
Server->value = tsk_strdup(va_arg(*app, const char*));
}
else
{
TSK_DEBUG_ERROR("Failed to create new Server header.");
}
return self;
}
/**@ingroup tsip_header_Server_group
*/
static void* tsip_header_Server_destroy(void *self)
{
tsip_header_Server_t *Server = self;
if(Server)
{
TSK_FREE(Server->value);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Server));
}
else TSK_DEBUG_ERROR("Null Server header.");
return self;
}
static const tsk_object_def_t tsip_header_Server_def_s =
{
sizeof(tsip_header_Server_t),
tsip_header_Server_create,
tsip_header_Server_destroy,
0
};
const void *tsip_header_Server_def_t = &tsip_header_Server_def_s;

View File

@ -58,7 +58,7 @@
{
if(!curr_service)
{
curr_service = TSIP_HEADER_SERVICE_ROUTE_CREATE();
curr_service = TSIP_HEADER_SERVICE_ROUTE_CREATE_NULL();
}
}
@ -174,8 +174,13 @@ static void* tsip_header_Service_Route_create(void *self, va_list * app)
tsip_header_Service_Route_t *Service_Route = self;
if(Service_Route)
{
const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*);
TSIP_HEADER(Service_Route)->type = tsip_htype_Service_Route;
TSIP_HEADER(Service_Route)->tostring = tsip_header_Service_Route_tostring;
if(uri){
Service_Route->uri = tsk_object_ref((void*)uri);
}
}
else
{

View File

@ -142,6 +142,7 @@ static void* tsip_header_User_Agent_destroy(void *self)
if(User_Agent)
{
TSK_FREE(User_Agent->value);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(User_Agent));
}
else TSK_DEBUG_ERROR("Null User_Agent header.");

View File

@ -0,0 +1,200 @@
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_Warning.c
* @brief SIP Warning header.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_Warning.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_time.h"
#include <string.h>
/**@defgroup tsip_header_Warning_group SIP Warning header.
*/
/***********************************
* Ragel state machine.
*/
%%{
machine tsip_machine_parser_header_Warning;
# Includes
include tsip_machine_utils "./tsip_machine_utils.rl";
action tag
{
tag_start = p;
}
action create_warning
{
if(!curr_warning)
{
curr_warning = TSIP_HEADER_WARNING_CREATE();
}
}
action parse_agent
{
if(curr_warning)
{
TSK_PARSER_SET_STRING(curr_warning->agent);
}
}
action parse_text
{
if(curr_warning)
{
TSK_PARSER_SET_STRING(curr_warning->text);
}
}
action parse_code
{
if(curr_warning)
{
TSK_PARSER_SET_INTEGER(curr_warning->code);
}
}
action add_warning
{
if(curr_warning)
{
tsk_list_push_back_data(hdr_warnings, ((void**) &curr_warning));
}
}
action eob
{
}
warn_code = DIGIT{3};
pseudonym = token;
warn_agent = hostport | pseudonym;
warn_text = quoted_string;
warning_value = (warn_code>tag %parse_code :>SP warn_agent>tag %parse_agent :>SP warn_text>tag %parse_text) >create_warning %add_warning;
Warning = "Warning"i HCOLON warning_value ( COMMA warning_value )*;
# Entry point
main := Warning :>CRLF @eob;
}%%
int tsip_header_Warning_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_Warning_t *Warning = header;
return tsk_buffer_appendEx(output, "%d %s %s",
Warning->code, Warning->agent, Warning->text); /* warn-code SP warn-agent SP warn-text */
}
return -1;
}
tsip_header_Warnings_L_t *tsip_header_Warning_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_Warnings_L_t *hdr_warnings = TSK_LIST_CREATE();
const char *tag_start;
tsip_header_Warning_t *curr_warning = 0;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% )
{
TSK_OBJECT_SAFE_FREE(curr_warning);
TSK_OBJECT_SAFE_FREE(hdr_warnings);
}
return hdr_warnings;
}
//========================================================
// 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;
if(Warning)
{
TSIP_HEADER(Warning)->type = tsip_htype_Warning;
TSIP_HEADER(Warning)->tostring = tsip_header_Warning_tostring;
Warning->code = -1;
}
else
{
TSK_DEBUG_ERROR("Failed to create new Warning header.");
}
return self;
}
/**@ingroup tsip_header_Warning_group
*/
static void* tsip_header_Warning_destroy(void *self)
{
tsip_header_Warning_t *Warning = self;
if(Warning)
{
TSK_FREE(Warning->agent);
TSK_FREE(Warning->text);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Warning));
}
else TSK_DEBUG_ERROR("Null Warning header.");
return self;
}
static const tsk_object_def_t tsip_header_Warning_def_s =
{
sizeof(tsip_header_Warning_t),
tsip_header_Warning_create,
tsip_header_Warning_destroy,
0
};
const void *tsip_header_Warning_def_t = &tsip_header_Warning_def_s;

View File

@ -0,0 +1,219 @@
%{
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_subscribe.sm.
* @brief SIP dialog SUBSCRIBE (RFC 2543).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
%}
%class tsip_dialog_subscribe
%header "tinysip/dialogs/tsip_dialog_subscribe.h"
%header "tinysip/tsip_message.h"
%start tsip_dialog_subscribe::Started
%include "tsk_debug.h"
%map tsip_dialog_subscribe
%%
//------------------------
//------------------------
Started
Entry
{
}
Exit
{
}
{
sm_send()
Trying
{
Started_2_Trying_X_send();
}
Default
nil
{
}
}
//------------------------
//------------------------
Trying
Entry
{
}
Exit
{
}
{
sm_1xx(msg: const tsip_message_t*)
nil
{
Trying_2_Trying_X_1xx(msg);
}
sm_2xx(unsubscribeing: int, response: const tsip_response_t*) [unsubscribeing]
Terminated
{
Trying_2_Terminated_X_2xx(response);
}
sm_2xx(unsubscribeing: int, response: const tsip_response_t*) [!unsubscribeing]
Connected
{
Trying_2_Connected_X_2xx(response);
}
sm_401_407_421_494(response: const tsip_response_t*)
nil
{
Trying_2_Trying_X_401_407_421_494(response);
}
sm_423(response: const tsip_response_t*)
nil
{
Trying_2_Trying_X_423(response);
}
sm_300_to_699(response: const tsip_response_t*)
Terminated
{
Trying_2_Terminated_X_300_to_699(response);
}
sm_cancel()
Terminated
{
Trying_2_Terminated_X_cancel();
}
sm_NOTIFY(sterminated: int, request: const tsip_request_t*)
nil
{
Trying_2_Trying_X_NOTIFY(request);
}
Default
nil
{
}
}
//------------------------
//------------------------
Connected
Entry
{
}
Exit
{
}
{
sm_unsubscribe()
Trying
{
Connected_2_Trying_X_unsubscribe();
}
sm_refresh()
Trying
{
Connected_2_Trying_X_refresh();
}
sm_NOTIFY(sterminated: int, request: const tsip_request_t*)[!sterminated]
nil
{
Connected_2_Connected_X_NOTIFY(request);
}
sm_NOTIFY(sterminated: int, request: const tsip_request_t*)[sterminated]
Terminated
{
Connected_2_Terminated_X_NOTIFY(request);
}
Default
nil
{
}
}
//------------------------
//------------------------
Terminated
Entry
{
OnTerminated();
}
Exit
{
}
{
Default
nil
{
}
}
//------------------------
//------------------------
Default
Entry
{
}
Exit
{
}
{
sm_hangup()
Trying
{
Any_2_Trying_X_hangup();
}
sm_transportError()
Terminated
{
Any_2_Terminated_X_transportError();
}
sm_error()
Terminated
{
}
Default
nil
{
}
}
%%

View File

@ -0,0 +1,139 @@
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_subscribe.c
* @brief Public registration (SUBSCRIBE) functions.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/api/tsip_subscribe.h"
#include "tinysip/dialogs/tsip_dialog_layer.h"
#include "tinysip/dialogs/tsip_dialog_subscribe.h"
#include "tsip.h"
#include "tsk_runnable.h"
#include "tsk_debug.h"
#define TSIP_SUBSCRIBE_EVENT_CREATE( type) tsk_object_new(tsip_subscribe_event_def_t, type)
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, unsigned incoming)
{
tsip_subscribe_event_t* sipevent = TSIP_SUBSCRIBE_EVENT_CREATE(type);
tsip_event_init(TSIP_EVENT(sipevent), stack, opid, status_code, phrase, incoming, tsip_event_subscribe);
TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(stack), sipevent);
return 0;
}
int tsip_subscribe(tsip_stack_handle_t *_stack, const tsip_operation_handle_t *operation)
{
int ret = -1;
if(_stack && operation)
{
tsip_stack_t *stack = _stack;
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)
{
TSK_DEBUG_WARN("Already subscribeed.");
ret = -2;
goto bail;
}
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);
}
}
bail:
return ret;
}
int tsip_unsubscribe(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 SUBSCRIBE event object definition
//
static void* tsip_subscribe_event_create(void * self, va_list * app)
{
tsip_subscribe_event_t *sipevent = self;
if(sipevent)
{
sipevent->type = va_arg(*app, tsip_subscribe_event_type_t);
}
return self;
}
static void* tsip_subscribe_event_destroy(void * self)
{
tsip_subscribe_event_t *sipevent = self;
if(sipevent)
{
tsip_event_deinit(TSIP_EVENT(sipevent));
}
return self;
}
static int tsip_subscribe_event_cmp(const void *obj1, const void *obj2)
{
return -1;
}
static const tsk_object_def_t tsip_subscribe_event_def_s =
{
sizeof(tsip_subscribe_event_t),
tsip_subscribe_event_create,
tsip_subscribe_event_destroy,
tsip_subscribe_event_cmp,
};
const void *tsip_subscribe_event_def_t = &tsip_subscribe_event_def_s;

View File

@ -35,9 +35,12 @@
#include "tinysip/transactions/tsip_transac_nict.h"
#include "tinysip/headers/tsip_header_Authorization.h"
#include "tinysip/headers/tsip_header_Proxy_Authorization.h"
#include "tinysip/headers/tsip_header_WWW_Authenticate.h"
#include "tinysip/headers/tsip_header_Contact.h"
#include "tinysip/headers/tsip_header_Expires.h"
#include "tinysip/headers/tsip_header_Proxy_Authenticate.h"
#include "tinysip/headers/tsip_header_Proxy_Authorization.h"
#include "tinysip/headers/tsip_header_Route.h"
#include "tinysip/headers/tsip_header_WWW_Authenticate.h"
#include "tsk_debug.h"
@ -99,7 +102,7 @@ tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* m
into the Request-URI. The UAC MUST NOT add a Route header field to
the request.
*/
if(TSK_LIST_IS_EMPTY(self->routes))
if(!self->routes || TSK_LIST_IS_EMPTY(self->routes))
{
request_uri = tsk_object_ref((void*)self->uri_remote_target);
}
@ -173,12 +176,19 @@ tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* m
TSK_FREE(contact);
}
/* Dialog Routes */
if(copy_routes_start !=-1)
{
// FIXME:
tsk_list_item_t *item;
int32_t index = -1;
tsk_list_foreach(item, self->routes)
{
const tsip_uri_t* uri = item->data;
if(++index < copy_routes_start || !uri){
continue;
}
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_ROUTE_VA_ARGS(uri));
}
}
@ -191,7 +201,7 @@ tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* m
/* Update authorizations */
if(TSK_LIST_IS_EMPTY(self->challenges))
{
if(tsk_strequals("REGISTER", method) && !TSIP_STACK(self->stack)->enable_earlyIMS)
if(tsk_striequals("REGISTER", method) && !TSIP_STACK(self->stack)->enable_earlyIMS)
{
/* 3GPP TS 34.229 - 5.1.1.1A === 3GPP TS 33.978 - 6.2.3.1
On sending a REGISTER request, the UE shall populate the header fields as follows:
@ -225,11 +235,20 @@ tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* m
}
/* Update CSeq */
if(!tsk_striequals(request->method, "ACK") && !tsk_striequals(request->method, "CANCEL"))
if(!tsk_striequals(method, "ACK") && !tsk_striequals(method, "CANCEL"))
{
request->CSeq->seq = ++(TSIP_DIALOG(self)->cseq_value);
}
/* Route generation
* ==> http://betelco.blogspot.com/2008/11/proxy-and-service-route-discovery-in.html
* The dialog Routes have been copied above.
*/
if(!tsk_striequals("REGISTER", method))
{ // According to the above link ==> Initial/Re/De registration do not have routes.
}
TSK_OBJECT_SAFE_FREE(request_uri);
TSK_OBJECT_SAFE_FREE(from_uri);
@ -347,25 +366,49 @@ int tsip_dialog_get_newdelay(tsip_dialog_t *self, const tsip_response_t* respons
{
int expires = self->expires;
int newdelay = expires; /* default value */
const tsip_header_t* hdr;
size_t i;
/*
* NOTIFY with subscription-state header with expires parameter.
/*== NOTIFY with subscription-state header with expires parameter.
*/
if(response->CSeq && tsk_striequals(response->CSeq->method, "NOTIFY"))
{
if(response->CSeq && tsk_striequals(response->CSeq->method, "NOTIFY")){
// FIXME:
//expires = tsk_params_get_asint("expires");
goto compute;
}
/*
* Exipires header or contact header with expires param?
/*== Expires header.
*/
if((expires = tsip_message_getExpires(response)) >0)
{
if((hdr = tsip_message_get_header(response, tsip_htype_Event))){
expires = ((const tsip_header_Expires_t*)hdr)->delta_seconds;
goto compute;
}
/*== Contact header.
*/
for(i=0; (hdr = tsip_message_get_headerAt(response, tsip_htype_Contact, i)); i++){
const tsip_header_Contact_t* contact = (const tsip_header_Contact_t*)hdr;
if(contact && contact->uri)
{
tsip_uri_t* contactUri = tsip_stack_get_contacturi(self->stack, tsk_params_get_param_value(contact->uri->params, "transport"));
if(contactUri)
{
if(tsk_strequals(contact->uri->user_name, contactUri->user_name)
&& tsk_strequals(contact->uri->host, contactUri->host)
&& contact->uri->port == contactUri->port)
{
if(contact->expires>=0){ /* No expires parameter ==> -1*/
expires = contact->expires;
TSK_OBJECT_SAFE_FREE(contactUri);
goto compute;
}
}
TSK_OBJECT_SAFE_FREE(contactUri);
}
}
}
/*
* 3GPP TS 24.229 -
*
@ -421,7 +464,7 @@ int tsip_dialog_update(tsip_dialog_t *self, const tsip_response_t* response)
acceptNewVector = (isRegister && self->state == tsip_established);
return tsip_dialog_update_challenges(self, response, acceptNewVector);
}
else if(100 <= code || code >= 300)
else if(100 < code && code < 300)
{
tsip_dialog_state_t state = self->state;
@ -447,16 +490,30 @@ int tsip_dialog_update(tsip_dialog_t *self, const tsip_response_t* response)
}
}
/* Route sets + cseq + tags + ... */
if(self->state == tsip_established && tsk_striequals(self->tag_remote, tag))
/* Route sets
*/
{
size_t index;
const tsip_header_t *hdr;
TSK_OBJECT_SAFE_FREE(self->routes);
for(index = 0; (hdr = tsip_message_get_headerAt(response, tsip_htype_Record_Route, index)); index++){
if(!self->routes){
self->routes = TSK_LIST_CREATE();
}
hdr = tsk_object_ref((void*)hdr);
tsk_list_push_front_data(self->routes, (void**)&hdr); /* Copy reversed. */
}
}
/* cseq + tags + ... */
if(self->state == tsip_established && tsk_striequals(self->tag_remote, tag)){
return 0;
}
else
{
// FIXME: copy routes (reversed)
if(!isRegister)
{
else{
if(!isRegister){
}
@ -601,6 +658,8 @@ int tsip_dialog_init(tsip_dialog_t *self, tsip_dialog_type_t type, tsip_stack_ha
{
if(self)
{
const tsk_param_t* param;
if(self->initialized)
{
TSK_DEBUG_WARN("Dialog already initialized.");
@ -609,6 +668,7 @@ int tsip_dialog_init(tsip_dialog_t *self, tsip_dialog_type_t type, tsip_stack_ha
tsk_safeobj_init(self);
self->state = tsip_initial;
self->type = type;
self->stack = tsk_object_ref(stack);
if(!self->routes){
@ -640,6 +700,14 @@ int tsip_dialog_init(tsip_dialog_t *self, tsip_dialog_type_t type, tsip_stack_ha
/* CSeq */
self->cseq_value = rand();
/* Expires */
if((param = tsip_operation_get_param(TSIP_DIALOG(self)->operation, "expires"))){
TSIP_DIALOG(self)->expires = atoi(param->value);
}
else{
TSIP_DIALOG(self)->expires = TSIP_DIALOG_EXPIRES_DEFAULT;
}
self->initialized = 1;
return 0;
}

View File

@ -30,7 +30,10 @@
#include "tinysip/dialogs/tsip_dialog_register.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tinysip/headers/tsip_header_Path.h"
#include "tinysip/headers/tsip_header_P_Associated_URI.h"
#include "tinysip/headers/tsip_header_Min_Expires.h"
#include "tinysip/headers/tsip_header_Service_Route.h"
#include "tinysip/api/tsip_register.h"
@ -76,6 +79,9 @@ int tsip_dialog_register_event_callback(const tsip_dialog_register_t *self, tsip
{
if(msg && TSIP_MESSAGE_IS_RESPONSE(msg))
{
//
// RESPONSE
//
if(TSIP_RESPONSE_IS_1XX(msg))
{
tsip_dialog_registerContext_sm_1xx(&TSIP_DIALOG_REGISTER(self)->_fsm, msg);
@ -99,6 +105,12 @@ int tsip_dialog_register_event_callback(const tsip_dialog_register_t *self, tsip
TSK_DEBUG_WARN("Not supported status code: %d", TSIP_RESPONSE_CODE(msg));
}
}
else
{
//
// REQUEST
//
}
break;
}
@ -178,7 +190,6 @@ void tsip_dialog_register_init(tsip_dialog_register_t *self)
*/
tsip_dialog_registerContext_Init(&self->_fsm, self);
TSIP_DIALOG(self)->expires = 30;
TSIP_DIALOG(self)->callback = TSIP_DIALOG_EVENT_CALLBACK(tsip_dialog_register_event_callback);
TSIP_DIALOG(self)->uri_local = tsk_object_ref((void*)TSIP_DIALOG_GET_STACK(self)->public_identity);
@ -255,32 +266,42 @@ void tsip_dialog_register_Trying_2_Connected_X_2xx(tsip_dialog_register_t *self,
if(TSIP_DIALOG(self)->state != tsip_established) /* Must be called before "tsip_dialog_update" update the state. */
{
size_t index;
tsip_header_t* hdr;
const tsip_header_Path_t *hdr_Path;
const tsip_header_Service_Route_t *hdr_Service_Route;
const tsip_header_P_Associated_URI_t *hdr_P_Associated_URI_t;
tsip_uri_t *uri;
/* To avoid memory leaks ==> delete all concerned objects (it worth nothing) */
//TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->associated_uri);
TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->associated_uris);
TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->service_routes);
TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->paths);
/* Associated URIs */
for(index = 0; (hdr_P_Associated_URI_t = (const tsip_header_P_Associated_URI_t*)tsip_message_get_headerAt(msg, tsip_htype_P_Associated_URI, index)); index++){
if(!TSIP_DIALOG_GET_STACK(self)->associated_uris){
TSIP_DIALOG_GET_STACK(self)->associated_uris = TSK_LIST_CREATE();
}
uri = tsk_object_ref(hdr_P_Associated_URI_t->uri);
tsk_list_push_back_data(TSIP_DIALOG_GET_STACK(self)->associated_uris, (void**)&uri);
}
/* Service-Route */
for(index = 0; (hdr = (tsip_header_t*)tsip_message_get_headerAt(msg, tsip_htype_Service_Route, index)); index++){
if(index == 0){
for(index = 0; (hdr_Service_Route = (const tsip_header_Service_Route_t*)tsip_message_get_headerAt(msg, tsip_htype_Service_Route, index)); index++){
if(!TSIP_DIALOG_GET_STACK(self)->service_routes){
TSIP_DIALOG_GET_STACK(self)->service_routes = TSK_LIST_CREATE();
}
hdr = tsk_object_ref(hdr);
tsk_list_push_back_data(TSIP_DIALOG_GET_STACK(self)->service_routes, (void**)&hdr);
uri = tsk_object_ref(hdr_Service_Route->uri);
tsk_list_push_back_data(TSIP_DIALOG_GET_STACK(self)->service_routes, (void**)&uri);
}
/* Paths */
for(index = 0; (hdr = (tsip_header_t*)tsip_message_get_headerAt(msg, tsip_htype_Path, index)); index++){
if(index == 0){
for(index = 0; (hdr_Path = (const tsip_header_Path_t*)tsip_message_get_headerAt(msg, tsip_htype_Path, index)); index++){
if(TSIP_DIALOG_GET_STACK(self)->paths == 0){
TSIP_DIALOG_GET_STACK(self)->paths = TSK_LIST_CREATE();
}
hdr = tsk_object_ref(hdr);
tsk_list_push_back_data(TSIP_DIALOG_GET_STACK(self)->paths, (void**)&hdr);
uri = tsk_object_ref(hdr_Path->uri);
tsk_list_push_back_data(TSIP_DIALOG_GET_STACK(self)->paths, (void**)&uri);
}
/* Associated Uris */
// FIXME
}
/* Update the dialog state. */

View File

@ -1 +1,429 @@
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_subscribe.client.c
* @brief SIP dialog subscribe (Client side).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/dialogs/tsip_dialog_subscribe.h"
#include "tinysip/headers/tsip_header_Event.h"
#include "tsk_debug.h"
#define DEBUG_STATE_MACHINE 1
#define TSIP_DIALOG_SUBSCRIBE_TIMER_SCHEDULE(TX) TSIP_DIALOG_TIMER_SCHEDULE(subscribe, TX)
#define TSIP_DIALOG_SUBSCRIBE_SIGNAL_ERROR(self) \
TSIP_DIALOG_SYNC_BEGIN(self); \
tsip_dialog_subscribeContext_sm_error(&TSIP_DIALOG_SUBSCRIBE(self)->_fsm); \
TSIP_DIALOG_SYNC_END(self);
#define TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, type, code, phrase, incoming) \
tsip_subscribe_event_signal(type, TSIP_DIALOG_GET_STACK(self),/*tsip_operation_get_id(TSIP_DIALOG(self)->operation)*/0, code, phrase, incoming)
#define TSIP_DIALOG_SUBSCRIBE_SIGNAL_INCOMING(self, type, code, phrase) TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, type, code, phrase, 1)
#define TSIP_DIALOG_SUBSCRIBE_SIGNAL_OUTGOING(self, type, code, phrase) TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, type, code, phrase, 0)
int send_subscribe(tsip_dialog_subscribe_t *self);
/**
* @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
*
* @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_subscribe_event_callback(const tsip_dialog_subscribe_t *self, tsip_dialog_event_type_t type, const tsip_message_t *msg)
{
TSIP_DIALOG_SYNC_BEGIN(self);
switch(type)
{
case tsip_dialog_msg:
{
if(msg && TSIP_MESSAGE_IS_RESPONSE(msg))
{
//
// RESPONSE
//
if(TSIP_RESPONSE_IS_1XX(msg))
{
tsip_dialog_subscribeContext_sm_1xx(&TSIP_DIALOG_SUBSCRIBE(self)->_fsm, msg);
}
else if(TSIP_RESPONSE_IS_2XX(msg))
{
tsip_dialog_subscribeContext_sm_2xx(&TSIP_DIALOG_SUBSCRIBE(self)->_fsm, TSIP_DIALOG_SUBSCRIBE(self)->unsubscribeing, msg);
}
else if(TSIP_RESPONSE_IS(msg,401) || TSIP_RESPONSE_IS(msg,407) || TSIP_RESPONSE_IS(msg,421) || TSIP_RESPONSE_IS(msg,494))
{
tsip_dialog_subscribeContext_sm_401_407_421_494(&TSIP_DIALOG_SUBSCRIBE(self)->_fsm, msg);
}
else if(TSIP_RESPONSE_IS(msg,423))
{
tsip_dialog_subscribeContext_sm_423(&TSIP_DIALOG_SUBSCRIBE(self)->_fsm, msg);
}
else
{
// Alert User
TSIP_DIALOG_SUBSCRIBE_SIGNAL_ERROR(self);
TSK_DEBUG_WARN("Not supported status code: %d", TSIP_RESPONSE_CODE(msg));
}
}
else
{
//
// REQUEST
//
}
break;
}
case tsip_dialog_hang_up:
{
tsip_dialog_subscribeContext_sm_hangup(&TSIP_DIALOG_SUBSCRIBE(self)->_fsm);
break;
}
case tsip_dialog_canceled:
{
tsip_dialog_subscribeContext_sm_cancel(&TSIP_DIALOG_SUBSCRIBE(self)->_fsm);
break;
}
case tsip_dialog_terminated:
case tsip_dialog_timedout:
case tsip_dialog_error:
case tsip_dialog_transport_error:
{
tsip_dialog_subscribeContext_sm_transportError(&TSIP_DIALOG_SUBSCRIBE(self)->_fsm);
break;
}
}
TSIP_DIALOG_SYNC_END(self);
return 0;
}
/**
* @fn int tsip_dialog_subscribe_timer_callback(const tsip_dialog_subscribe_t* self,
* tsk_timer_id_t timer_id)
*
* @brief Timer manager callback.
*
* @author Mamadou
* @date 1/5/2010
*
* @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_subscribe_timer_callback(const tsip_dialog_subscribe_t* self, tsk_timer_id_t timer_id)
{
int ret = -1;
if(self)
{
TSIP_DIALOG_SYNC_BEGIN(self);
if(timer_id == self->timerrefresh.id)
{
tsip_dialog_subscribeContext_sm_refresh(&TSIP_DIALOG_SUBSCRIBE(self)->_fsm);
ret = 0;
}
TSIP_DIALOG_SYNC_END(self);
}
return ret;
}
/**
* @fn void tsip_dialog_subscribe_init(tsip_dialog_subscribe_t *self)
*
* @brief Initializes the dialog.
*
* @param [in,out] self The dialog to initialize.
**/
void tsip_dialog_subscribe_init(tsip_dialog_subscribe_t *self)
{
const tsk_param_t* param;
/* Initialize the state machine.
*/
tsip_dialog_subscribeContext_Init(&self->_fsm, self);
/* Package. */
if((param = tsip_operation_get_param(TSIP_DIALOG(self)->operation, "package"))){
self->package = tsk_strdup(param->value);
}
TSIP_DIALOG(self)->expires = 30;
TSIP_DIALOG(self)->callback = TSIP_DIALOG_EVENT_CALLBACK(tsip_dialog_subscribe_event_callback);
TSIP_DIALOG(self)->uri_local = tsk_object_ref((void*)TSIP_DIALOG_GET_STACK(self)->public_identity);
TSIP_DIALOG(self)->uri_remote = tsk_object_ref((void*)TSIP_DIALOG_GET_STACK(self)->public_identity);
TSIP_DIALOG(self)->uri_remote_target = tsk_object_ref((void*)TSIP_DIALOG_GET_STACK(self)->realm);
self->timerrefresh.id = TSK_INVALID_TIMER_ID;
self->timerrefresh.timeout = TSIP_DIALOG(self)->expires;
#if defined(_DEBUG) || defined(DEBUG)
setDebugFlag(&(self->_fsm), DEBUG_STATE_MACHINE);
#endif
}
int tsip_dialog_subscribe_start(tsip_dialog_subscribe_t *self)
{
int ret = -1;
if(self && !TSIP_DIALOG(self)->running)
{
/* Set state machine state to started */
setState(&self->_fsm, &tsip_dialog_subscribe_Started);
/* Send request */
tsip_dialog_subscribeContext_sm_send(&self->_fsm);
ret = 0;
}
return ret;
}
//--------------------------------------------------------
// == STATE MACHINE BEGIN ==
//--------------------------------------------------------
/* Started -> (send) -> Trying
*/
void tsip_dialog_subscribe_Started_2_Trying_X_send(tsip_dialog_subscribe_t *self)
{
send_subscribe(self);
}
/* Trying -> (1xx) -> Trying
*/
void tsip_dialog_subscribe_Trying_2_Trying_X_1xx(tsip_dialog_subscribe_t *self, const tsip_response_t* response)
{
}
/* Trying -> (2xx) -> Terminated
*/
void tsip_dialog_subscribe_Trying_2_Terminated_X_2xx(tsip_dialog_subscribe_t *self, const tsip_response_t* response)
{
}
/* Trying -> (2xx) -> Connected
*/
void tsip_dialog_subscribe_Trying_2_Connected_X_2xx(tsip_dialog_subscribe_t *self, const tsip_response_t* response)
{
}
/* Trying -> (401/407/421/494) -> Trying
*/
void tsip_dialog_subscribe_Trying_2_Trying_X_401_407_421_494(tsip_dialog_subscribe_t *self, const tsip_response_t* response)
{
}
/* Trying -> (423) -> Trying
*/
void tsip_dialog_subscribe_Trying_2_Trying_X_423(tsip_dialog_subscribe_t *self, const tsip_response_t* response)
{
}
/* Trying -> (300-699) -> Terminated
*/
void tsip_dialog_subscribe_Trying_2_Terminated_X_300_to_699(tsip_dialog_subscribe_t *self, const tsip_response_t* response)
{
}
/* Trying -> (cancel) -> Terminated
*/
void tsip_dialog_subscribe_Trying_2_Terminated_X_cancel(tsip_dialog_subscribe_t *self)
{
}
/* Trying -> (NOTIFY) -> Trying
*/
void tsip_dialog_subscribe_Trying_2_Trying_X_NOTIFY(tsip_dialog_subscribe_t *self, const tsip_request_t* request)
{
}
/* Connected -> (unsubscribe) -> Trying
*/
void tsip_dialog_subscribe_Connected_2_Trying_X_unsubscribe(tsip_dialog_subscribe_t *self)
{
}
/* Connected -> (refresh) -> Trying
*/
void tsip_dialog_subscribe_Connected_2_Trying_X_refresh(tsip_dialog_subscribe_t *self)
{
}
/* Connected -> (NOTIFY) -> Connected
*/
void tsip_dialog_subscribe_Connected_2_Connected_X_NOTIFY(tsip_dialog_subscribe_t *self, const tsip_request_t* request)
{
}
/* Connected -> (NOTIFY) -> Terminated
*/
void tsip_dialog_subscribe_Connected_2_Terminated_X_NOTIFY(tsip_dialog_subscribe_t *self, const tsip_request_t* request)
{
}
/* Any -> (hangup) -> Trying
*/
void tsip_dialog_subscribe_Any_2_Trying_X_hangup(tsip_dialog_subscribe_t *self)
{
}
/* Any -> (transport error) -> Terminated
*/
void tsip_dialog_subscribe_Any_2_Terminated_X_transportError(tsip_dialog_subscribe_t *self)
{
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// == STATE MACHINE END ==
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/**
* @fn int send_subscribe(tsip_dialog_subscribe_t *self)
*
* @brief Sends a SUBSCRIBE request.
*
* @author Mamadou
* @date 1/4/2010
*
* @param [in,out] self The caller.
*
* @return Zero if succeed and non-zero error code otherwise.
**/
int send_subscribe(tsip_dialog_subscribe_t *self)
{
tsip_request_t *request;
//const tsk_param_t* param;
int ret = -1;
if(self->unsubscribeing)
{
TSIP_DIALOG(self)->expires = 0;
}
request = tsip_dialog_request_new(TSIP_DIALOG(self), "SUBSCRIBE");
if(request)
{
/* Event package. */
if(self->package){
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_EVENT_VA_ARGS(self->package));
}
ret = tsip_dialog_request_send(TSIP_DIALOG(self), request);
TSK_OBJECT_SAFE_FREE(request);
}
return ret;
}
/**
* @fn void 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
*
* @param [in,out] self The state machine owner.
**/
void tsip_dialog_subscribe_OnTerminated(tsip_dialog_subscribe_t *self)
{
TSK_DEBUG_INFO("=== Dialog terminated ===");
/* Cancel all timers */
DIALOG_TIMER_CANCEL(refresh);
/* Alert user */
TSIP_DIALOG_SUBSCRIBE_SIGNAL_INCOMING(self, tsip_subscribe_terminated, 700, "Dialog terminated.");
/* Destroy asynchronously */
DIALOG_REMOVE_SCHEDULE();
}
//========================================================
// SIP dialog SUBSCRIBE object definition
//
static void* tsip_dialog_subscribe_create(void * self, va_list * app)
{
tsip_dialog_subscribe_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 *);
/* Initialize base class */
tsip_dialog_init(TSIP_DIALOG(self), tsip_dialog_subscribe, stack, 0, operation);
/* Initialize the class itself */
tsip_dialog_subscribe_init(self);
}
return self;
}
static void* tsip_dialog_subscribe_destroy(void * self)
{
tsip_dialog_subscribe_t *dialog = self;
if(dialog)
{
/* DeInitialize base class */
tsip_dialog_deinit(TSIP_DIALOG(self));
TSK_FREE(dialog->package);
}
return self;
}
static int tsip_dialog_subscribe_cmp(const void *dialog1, const void *dialog2)
{
return tsip_dialog_cmp(dialog1, dialog2);
}
static const tsk_object_def_t tsip_dialog_subscribe_def_s =
{
sizeof(tsip_dialog_subscribe_t),
tsip_dialog_subscribe_create,
tsip_dialog_subscribe_destroy,
tsip_dialog_subscribe_cmp,
};
const void *tsip_dialog_subscribe_def_t = &tsip_dialog_subscribe_def_s;

View File

@ -1 +1,468 @@
/* #line 1 "tsip_parser_header_Event.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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_Event.c
* @brief SIP Event/o header as per RFC 3265..
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_Event.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include <string.h>
/**@defgroup tsip_header_Event_group SIP Event header as per RFC 3265.
*/
/***********************************
* Ragel state machine.
*/
/* #line 80 "tsip_parser_header_Event.rl" */
int tsip_header_Event_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_Event_t *Event = header;
if(Event->package)
{
tsk_buffer_append(output, Event->package, strlen(Event->package));
}
return 0;
}
return -1;
}
tsip_header_Event_t *tsip_header_Event_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_Event_t *hdr_event = TSIP_HEADER_EVENT_CREATE(0);
const char *tag_start;
/* #line 78 "../src/headers/tsip_header_Event.c" */
static const char _tsip_machine_parser_header_Event_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3
};
static const short _tsip_machine_parser_header_Event_key_offsets[] = {
0, 0, 4, 6, 8, 10, 12, 15,
31, 32, 34, 49, 67, 71, 72, 74,
77, 94, 95, 97, 113, 132, 137, 138,
140, 144, 163, 164, 166, 185, 186, 188,
191, 207, 209, 211, 213, 215, 217, 218,
220, 224, 225, 231, 249, 256, 264, 272,
280, 282, 289, 298, 300, 303, 305, 308,
310, 313, 316, 317, 320, 321, 324, 325,
334, 343, 351, 359, 367, 375, 377, 383,
392, 401, 410, 412, 415, 418, 419, 420,
433
};
static const char _tsip_machine_parser_header_Event_trans_keys[] = {
69, 79, 101, 111, 86, 118, 69, 101,
78, 110, 84, 116, 9, 32, 58, 9,
13, 32, 33, 37, 39, 45, 126, 42,
43, 48, 57, 65, 90, 95, 122, 10,
9, 32, 9, 32, 33, 37, 39, 45,
126, 42, 43, 48, 57, 65, 90, 95,
122, 9, 13, 32, 33, 37, 39, 45,
46, 59, 126, 42, 43, 48, 57, 65,
90, 95, 122, 9, 13, 32, 59, 10,
9, 32, 9, 32, 59, 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, 9, 13, 32, 33, 37, 39, 59,
61, 126, 42, 43, 45, 46, 48, 57,
65, 90, 95, 122, 9, 13, 32, 59,
61, 10, 9, 32, 9, 32, 59, 61,
9, 13, 32, 33, 34, 37, 39, 91,
126, 42, 43, 45, 46, 48, 57, 65,
90, 95, 122, 10, 9, 32, 9, 13,
32, 33, 34, 37, 39, 91, 126, 42,
43, 45, 46, 48, 57, 65, 90, 95,
122, 10, 9, 32, 9, 32, 34, 9,
13, 34, 92, -64, -33, -32, -17, -16,
-9, -8, -5, -4, -3, 32, 126, -128,
-65, -128, -65, -128, -65, -128, -65, -128,
-65, 10, 9, 32, 9, 13, 32, 59,
10, 0, 9, 11, 12, 14, 127, 9,
13, 32, 33, 37, 39, 59, 126, 42,
43, 45, 46, 48, 57, 65, 90, 95,
122, 58, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 58, 48, 57, 65, 70, 97,
102, 46, 58, 93, 48, 57, 65, 70,
97, 102, 48, 57, 46, 48, 57, 48,
57, 46, 48, 57, 48, 57, 93, 48,
57, 93, 48, 57, 93, 46, 48, 57,
46, 46, 48, 57, 46, 46, 58, 93,
48, 57, 65, 70, 97, 102, 46, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 46,
58, 93, 48, 57, 65, 70, 97, 102,
46, 58, 93, 48, 57, 65, 70, 97,
102, 46, 58, 93, 48, 57, 65, 70,
97, 102, 48, 57, 46, 48, 57, 46,
48, 57, 46, 58, 33, 37, 39, 45,
126, 42, 43, 48, 57, 65, 90, 95,
122, 0
};
static const char _tsip_machine_parser_header_Event_single_lengths[] = {
0, 4, 2, 2, 2, 2, 3, 8,
1, 2, 7, 10, 4, 1, 2, 3,
7, 1, 2, 6, 9, 5, 1, 2,
4, 9, 1, 2, 9, 1, 2, 3,
4, 0, 0, 0, 0, 0, 1, 2,
4, 1, 0, 8, 1, 2, 2, 2,
2, 1, 3, 0, 1, 0, 1, 0,
1, 1, 1, 1, 1, 1, 1, 3,
3, 2, 2, 2, 2, 2, 0, 3,
3, 3, 0, 1, 1, 1, 1, 5,
0
};
static const char _tsip_machine_parser_header_Event_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 4,
0, 0, 4, 4, 0, 0, 0, 0,
5, 0, 0, 5, 5, 0, 0, 0,
0, 5, 0, 0, 5, 0, 0, 0,
6, 1, 1, 1, 1, 1, 0, 0,
0, 0, 3, 5, 3, 3, 3, 3,
0, 3, 3, 1, 1, 1, 1, 1,
1, 1, 0, 1, 0, 1, 0, 3,
3, 3, 3, 3, 3, 0, 3, 3,
3, 3, 1, 1, 1, 0, 0, 4,
0
};
static const short _tsip_machine_parser_header_Event_index_offsets[] = {
0, 0, 5, 8, 11, 14, 17, 21,
34, 36, 39, 51, 66, 71, 73, 76,
80, 93, 95, 98, 110, 125, 131, 133,
136, 141, 156, 158, 161, 176, 178, 181,
185, 196, 198, 200, 202, 204, 206, 208,
211, 216, 218, 222, 236, 241, 247, 253,
259, 262, 267, 274, 276, 279, 281, 284,
286, 289, 292, 294, 297, 299, 302, 304,
311, 318, 324, 330, 336, 342, 345, 349,
356, 363, 370, 372, 375, 378, 380, 382,
392
};
static const char _tsip_machine_parser_header_Event_indicies[] = {
0, 2, 0, 2, 1, 3, 3, 1,
4, 4, 1, 5, 5, 1, 2, 2,
1, 2, 2, 6, 1, 6, 7, 6,
8, 8, 8, 8, 8, 8, 8, 8,
8, 1, 9, 1, 10, 10, 1, 10,
10, 8, 8, 8, 8, 8, 8, 8,
8, 8, 1, 11, 12, 11, 13, 13,
13, 13, 14, 15, 13, 13, 13, 13,
13, 1, 16, 17, 16, 18, 1, 19,
1, 20, 20, 1, 20, 20, 18, 1,
18, 21, 18, 22, 22, 22, 22, 22,
22, 22, 22, 22, 1, 23, 1, 24,
24, 1, 24, 24, 22, 22, 22, 22,
22, 22, 22, 22, 22, 1, 25, 26,
25, 27, 27, 27, 28, 29, 27, 27,
27, 27, 27, 27, 1, 30, 31, 30,
18, 29, 1, 32, 1, 33, 33, 1,
33, 33, 18, 29, 1, 29, 34, 29,
35, 36, 35, 35, 37, 35, 35, 35,
35, 35, 35, 1, 38, 1, 39, 39,
1, 39, 40, 39, 35, 36, 35, 35,
37, 35, 35, 35, 35, 35, 35, 1,
41, 1, 42, 42, 1, 42, 42, 36,
1, 36, 48, 49, 50, 43, 44, 45,
46, 47, 36, 1, 36, 1, 43, 1,
44, 1, 45, 1, 46, 1, 51, 1,
36, 36, 1, 52, 26, 52, 28, 1,
53, 1, 36, 36, 36, 1, 52, 26,
52, 35, 35, 35, 28, 35, 35, 35,
35, 35, 35, 1, 55, 54, 54, 54,
1, 57, 49, 56, 56, 56, 1, 57,
49, 58, 58, 58, 1, 57, 49, 59,
59, 59, 1, 57, 49, 1, 61, 60,
54, 54, 1, 62, 57, 49, 63, 56,
56, 1, 64, 1, 65, 66, 1, 67,
1, 68, 69, 1, 70, 1, 49, 71,
1, 49, 72, 1, 49, 1, 68, 73,
1, 68, 1, 65, 74, 1, 65, 1,
62, 57, 49, 75, 58, 58, 1, 62,
57, 49, 59, 59, 59, 1, 77, 49,
76, 76, 76, 1, 79, 49, 78, 78,
78, 1, 79, 49, 80, 80, 80, 1,
79, 49, 81, 81, 81, 1, 79, 49,
1, 82, 76, 76, 1, 62, 79, 49,
83, 78, 78, 1, 62, 79, 49, 84,
80, 80, 1, 62, 79, 49, 81, 81,
81, 1, 85, 1, 62, 86, 1, 62,
87, 1, 62, 1, 61, 1, 13, 13,
13, 13, 13, 13, 13, 13, 13, 1,
1, 0
};
static const char _tsip_machine_parser_header_Event_trans_targs[] = {
2, 0, 6, 3, 4, 5, 7, 8,
11, 9, 10, 12, 41, 11, 79, 16,
12, 13, 16, 14, 15, 17, 20, 18,
19, 21, 41, 20, 16, 25, 21, 22,
23, 24, 26, 43, 32, 44, 27, 28,
29, 30, 31, 33, 34, 35, 36, 37,
38, 40, 42, 39, 12, 80, 45, 78,
46, 49, 47, 48, 50, 65, 51, 63,
52, 53, 61, 54, 55, 59, 56, 57,
58, 60, 62, 64, 66, 74, 67, 70,
68, 69, 71, 72, 73, 75, 76, 77
};
static const char _tsip_machine_parser_header_Event_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 3, 3, 0, 0, 3,
0, 0, 0, 0, 0, 0, 1, 0,
0, 5, 5, 0, 5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 5, 7, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
static const int tsip_machine_parser_header_Event_start = 1;
static const int tsip_machine_parser_header_Event_first_final = 80;
static const int tsip_machine_parser_header_Event_error = 0;
static const int tsip_machine_parser_header_Event_en_main = 1;
/* #line 108 "tsip_parser_header_Event.rl" */
/* #line 288 "../src/headers/tsip_header_Event.c" */
{
cs = tsip_machine_parser_header_Event_start;
}
/* #line 109 "tsip_parser_header_Event.rl" */
/* #line 295 "../src/headers/tsip_header_Event.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_Event_trans_keys + _tsip_machine_parser_header_Event_key_offsets[cs];
_trans = _tsip_machine_parser_header_Event_index_offsets[cs];
_klen = _tsip_machine_parser_header_Event_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_Event_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_Event_indicies[_trans];
cs = _tsip_machine_parser_header_Event_trans_targs[_trans];
if ( _tsip_machine_parser_header_Event_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Event_actions + _tsip_machine_parser_header_Event_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 52 "tsip_parser_header_Event.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 57 "tsip_parser_header_Event.rl" */
{
TSK_PARSER_SET_STRING(hdr_event->package);
}
break;
case 2:
/* #line 62 "tsip_parser_header_Event.rl" */
{
TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_event));
}
break;
case 3:
/* #line 67 "tsip_parser_header_Event.rl" */
{
}
break;
/* #line 392 "../src/headers/tsip_header_Event.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 110 "tsip_parser_header_Event.rl" */
if( cs <
/* #line 408 "../src/headers/tsip_header_Event.c" */
80
/* #line 111 "tsip_parser_header_Event.rl" */
)
{
TSK_OBJECT_SAFE_FREE(hdr_event);
}
return hdr_event;
}
//========================================================
// 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;
if(Event)
{
TSIP_HEADER(Event)->type = tsip_htype_Event;
TSIP_HEADER(Event)->tostring = tsip_header_Event_tostring;
Event->package = tsk_strdup(va_arg(*app, const char*));
}
else
{
TSK_DEBUG_ERROR("Failed to create new Event header.");
}
return self;
}
/**@ingroup tsip_header_Event_group
*/
static void* tsip_header_Event_destroy(void *self)
{
tsip_header_Event_t *Event = self;
if(Event)
{
TSK_FREE(Event->package);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Event));
}
else TSK_DEBUG_ERROR("Null Event header.");
return self;
}
static const tsk_object_def_t tsip_header_Event_def_s =
{
sizeof(tsip_header_Event_t),
tsip_header_Event_create,
tsip_header_Event_destroy,
0
};
const void *tsip_header_Event_def_t = &tsip_header_Event_def_s;

File diff suppressed because it is too large Load Diff

View File

@ -1 +1,572 @@
/* #line 1 "tsip_parser_header_P_Associated_URI.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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_P_Associated_URI.c
* @brief SIP P-Associated-URI header as per RFC 3455.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_P_Associated_URI.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_time.h"
#include <string.h>
/**@defgroup tsip_header_P_Associated_URI_group SIP P_Associated_URI header.
*/
/***********************************
* Ragel state machine.
*/
/* #line 114 "tsip_parser_header_P_Associated_URI.rl" */
int tsip_header_P_Associated_URI_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_P_Associated_URI_t *P_Associated_URI = header;
int ret = 0;
if(P_Associated_URI->display_name){ /* Display Name */
tsk_buffer_appendEx(output, "\"%s\"", P_Associated_URI->display_name);
}
if(ret=tsip_uri_serialize(P_Associated_URI->uri, 1, 1, output)){ /* P_Associated_URI */
return ret;
}
return ret;
}
return -1;
}
tsip_header_P_Associated_URIs_L_t *tsip_header_P_Associated_URI_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_P_Associated_URIs_L_t *hdr_p_associated_uris = TSK_LIST_CREATE();
const char *tag_start;
tsip_header_P_Associated_URI_t *curr_p_associated_uri = 0;
/* #line 86 "../src/headers/tsip_header_P_Associated_URI.c" */
static const char _tsip_machine_parser_header_P_Associated_URI_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3, 1, 4, 1, 5, 1, 6, 2,
1, 0, 2, 4, 5
};
static const short _tsip_machine_parser_header_P_Associated_URI_key_offsets[] = {
0, 0, 2, 3, 5, 7, 9, 11,
13, 15, 17, 19, 21, 23, 24, 26,
28, 30, 33, 52, 53, 55, 74, 75,
77, 80, 84, 96, 99, 99, 100, 105,
106, 123, 124, 126, 142, 160, 166, 167,
169, 174, 193, 194, 196, 215, 216, 218,
221, 237, 239, 241, 243, 245, 247, 248,
250, 255, 260, 261, 263, 267, 273, 290,
297, 305, 313, 321, 323, 330, 339, 341,
344, 346, 349, 351, 354, 357, 358, 361,
362, 365, 366, 375, 384, 392, 400, 408,
416, 418, 424, 433, 442, 451, 453, 456,
459, 460, 461, 478, 496, 500, 501, 503,
519, 521, 523, 525, 527, 529, 530, 532,
536, 542
};
static const char _tsip_machine_parser_header_P_Associated_URI_trans_keys[] = {
80, 112, 45, 65, 97, 83, 115, 83,
115, 79, 111, 67, 99, 73, 105, 65,
97, 84, 116, 69, 101, 68, 100, 45,
85, 117, 82, 114, 73, 105, 9, 32,
58, 9, 13, 32, 33, 34, 37, 39,
60, 126, 42, 43, 45, 46, 48, 57,
65, 90, 95, 122, 10, 9, 32, 9,
13, 32, 33, 34, 37, 39, 60, 126,
42, 43, 45, 46, 48, 57, 65, 90,
95, 122, 10, 9, 32, 9, 32, 60,
65, 90, 97, 122, 9, 32, 43, 58,
45, 46, 48, 57, 65, 90, 97, 122,
9, 32, 58, 62, 9, 13, 32, 44,
59, 10, 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, 9, 13,
32, 33, 37, 39, 44, 59, 61, 126,
42, 46, 48, 57, 65, 90, 95, 122,
9, 13, 32, 44, 59, 61, 10, 9,
32, 9, 32, 44, 59, 61, 9, 13,
32, 33, 34, 37, 39, 91, 126, 42,
43, 45, 46, 48, 57, 65, 90, 95,
122, 10, 9, 32, 9, 13, 32, 33,
34, 37, 39, 91, 126, 42, 43, 45,
46, 48, 57, 65, 90, 95, 122, 10,
9, 32, 9, 32, 34, 9, 13, 34,
92, -64, -33, -32, -17, -16, -9, -8,
-5, -4, -3, 32, 126, -128, -65, -128,
-65, -128, -65, -128, -65, -128, -65, 10,
9, 32, 9, 13, 32, 44, 59, 9,
13, 32, 44, 59, 10, 9, 32, 9,
32, 44, 59, 0, 9, 11, 12, 14,
127, 9, 13, 32, 33, 37, 39, 44,
59, 126, 42, 46, 48, 57, 65, 90,
95, 122, 58, 48, 57, 65, 70, 97,
102, 58, 93, 48, 57, 65, 70, 97,
102, 58, 93, 48, 57, 65, 70, 97,
102, 58, 93, 48, 57, 65, 70, 97,
102, 58, 93, 58, 48, 57, 65, 70,
97, 102, 46, 58, 93, 48, 57, 65,
70, 97, 102, 48, 57, 46, 48, 57,
48, 57, 46, 48, 57, 48, 57, 93,
48, 57, 93, 48, 57, 93, 46, 48,
57, 46, 46, 48, 57, 46, 46, 58,
93, 48, 57, 65, 70, 97, 102, 46,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
46, 58, 93, 48, 57, 65, 70, 97,
102, 46, 58, 93, 48, 57, 65, 70,
97, 102, 46, 58, 93, 48, 57, 65,
70, 97, 102, 48, 57, 46, 48, 57,
46, 48, 57, 46, 58, 9, 13, 32,
33, 37, 39, 126, 42, 43, 45, 46,
48, 57, 65, 90, 95, 122, 9, 13,
32, 33, 37, 39, 60, 126, 42, 43,
45, 46, 48, 57, 65, 90, 95, 122,
9, 13, 32, 60, 10, 9, 32, 9,
13, 34, 92, -64, -33, -32, -17, -16,
-9, -8, -5, -4, -3, 32, 126, -128,
-65, -128, -65, -128, -65, -128, -65, -128,
-65, 10, 9, 32, 9, 13, 32, 60,
0, 9, 11, 12, 14, 127, 0
};
static const char _tsip_machine_parser_header_P_Associated_URI_single_lengths[] = {
0, 2, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 2,
2, 3, 9, 1, 2, 9, 1, 2,
3, 0, 4, 3, 0, 1, 5, 1,
7, 1, 2, 6, 10, 6, 1, 2,
5, 9, 1, 2, 9, 1, 2, 3,
4, 0, 0, 0, 0, 0, 1, 2,
5, 5, 1, 2, 4, 0, 9, 1,
2, 2, 2, 2, 1, 3, 0, 1,
0, 1, 0, 1, 1, 1, 1, 1,
1, 1, 3, 3, 2, 2, 2, 2,
2, 0, 3, 3, 3, 0, 1, 1,
1, 1, 7, 8, 4, 1, 2, 4,
0, 0, 0, 0, 0, 1, 2, 4,
0, 0
};
static const char _tsip_machine_parser_header_P_Associated_URI_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 5, 0, 0, 5, 0, 0,
0, 2, 4, 0, 0, 0, 0, 0,
5, 0, 0, 5, 4, 0, 0, 0,
0, 5, 0, 0, 5, 0, 0, 0,
6, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 3, 4, 3,
3, 3, 3, 0, 3, 3, 1, 1,
1, 1, 1, 1, 1, 0, 1, 0,
1, 0, 3, 3, 3, 3, 3, 3,
0, 3, 3, 3, 3, 1, 1, 1,
0, 0, 5, 5, 0, 0, 0, 6,
1, 1, 1, 1, 1, 0, 0, 0,
3, 0
};
static const short _tsip_machine_parser_header_P_Associated_URI_index_offsets[] = {
0, 0, 3, 5, 8, 11, 14, 17,
20, 23, 26, 29, 32, 35, 37, 40,
43, 46, 50, 65, 67, 70, 85, 87,
90, 94, 97, 106, 110, 111, 113, 119,
121, 134, 136, 139, 151, 166, 173, 175,
178, 184, 199, 201, 204, 219, 221, 224,
228, 239, 241, 243, 245, 247, 249, 251,
254, 260, 266, 268, 271, 276, 280, 294,
299, 305, 311, 317, 320, 325, 332, 334,
337, 339, 342, 344, 347, 350, 352, 355,
357, 360, 362, 369, 376, 382, 388, 394,
400, 403, 407, 414, 421, 428, 430, 433,
436, 438, 440, 453, 467, 472, 474, 477,
488, 490, 492, 494, 496, 498, 500, 503,
508, 512
};
static const unsigned char _tsip_machine_parser_header_P_Associated_URI_indicies[] = {
0, 0, 1, 2, 1, 3, 3, 1,
4, 4, 1, 5, 5, 1, 6, 6,
1, 7, 7, 1, 8, 8, 1, 9,
9, 1, 10, 10, 1, 11, 11, 1,
12, 12, 1, 13, 1, 14, 14, 1,
15, 15, 1, 16, 16, 1, 16, 16,
17, 1, 18, 19, 18, 20, 21, 20,
20, 22, 20, 20, 20, 20, 20, 20,
1, 23, 1, 24, 24, 1, 25, 26,
25, 20, 21, 20, 20, 22, 20, 20,
20, 20, 20, 20, 1, 27, 1, 28,
28, 1, 28, 28, 29, 1, 30, 30,
1, 31, 31, 32, 33, 32, 32, 32,
32, 1, 31, 31, 33, 1, 34, 35,
34, 36, 37, 36, 38, 39, 1, 40,
1, 39, 41, 39, 42, 42, 42, 42,
42, 42, 42, 42, 42, 1, 43, 1,
44, 44, 1, 44, 44, 42, 42, 42,
42, 42, 42, 42, 42, 42, 1, 45,
46, 45, 47, 47, 47, 48, 49, 50,
47, 47, 47, 47, 47, 1, 51, 52,
51, 17, 39, 50, 1, 53, 1, 54,
54, 1, 54, 54, 17, 39, 50, 1,
50, 55, 50, 56, 57, 56, 56, 58,
56, 56, 56, 56, 56, 56, 1, 59,
1, 60, 60, 1, 60, 61, 60, 56,
57, 56, 56, 58, 56, 56, 56, 56,
56, 56, 1, 62, 1, 63, 63, 1,
63, 63, 57, 1, 57, 69, 70, 71,
64, 65, 66, 67, 68, 57, 1, 57,
1, 64, 1, 65, 1, 66, 1, 67,
1, 72, 1, 57, 57, 1, 73, 46,
73, 48, 49, 1, 74, 75, 74, 17,
39, 1, 76, 1, 77, 77, 1, 77,
77, 17, 39, 1, 57, 57, 57, 1,
73, 46, 73, 56, 56, 56, 48, 49,
56, 56, 56, 56, 56, 1, 79, 78,
78, 78, 1, 81, 70, 80, 80, 80,
1, 81, 70, 82, 82, 82, 1, 81,
70, 83, 83, 83, 1, 81, 70, 1,
85, 84, 78, 78, 1, 86, 81, 70,
87, 80, 80, 1, 88, 1, 89, 90,
1, 91, 1, 92, 93, 1, 94, 1,
70, 95, 1, 70, 96, 1, 70, 1,
92, 97, 1, 92, 1, 89, 98, 1,
89, 1, 86, 81, 70, 99, 82, 82,
1, 86, 81, 70, 83, 83, 83, 1,
101, 70, 100, 100, 100, 1, 103, 70,
102, 102, 102, 1, 103, 70, 104, 104,
104, 1, 103, 70, 105, 105, 105, 1,
103, 70, 1, 106, 100, 100, 1, 86,
103, 70, 107, 102, 102, 1, 86, 103,
70, 108, 104, 104, 1, 86, 103, 70,
105, 105, 105, 1, 109, 1, 86, 110,
1, 86, 111, 1, 86, 1, 85, 1,
112, 113, 112, 114, 114, 114, 114, 114,
114, 114, 114, 114, 1, 115, 116, 115,
114, 114, 114, 117, 114, 114, 114, 114,
114, 114, 1, 118, 119, 118, 29, 1,
120, 1, 112, 112, 1, 126, 127, 128,
129, 121, 122, 123, 124, 125, 126, 1,
126, 1, 121, 1, 122, 1, 123, 1,
124, 1, 130, 1, 126, 126, 1, 115,
116, 115, 117, 1, 126, 126, 126, 1,
1, 0
};
static const char _tsip_machine_parser_header_P_Associated_URI_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 18, 19, 98, 103, 25, 20,
21, 21, 22, 23, 24, 25, 26, 27,
26, 28, 29, 30, 30, 31, 18, 32,
113, 33, 36, 34, 35, 37, 31, 36,
18, 32, 41, 37, 38, 39, 40, 42,
62, 48, 63, 43, 44, 45, 46, 47,
49, 50, 51, 52, 53, 54, 56, 61,
55, 57, 57, 58, 59, 60, 64, 97,
65, 68, 66, 67, 69, 84, 70, 82,
71, 72, 80, 73, 74, 78, 75, 76,
77, 79, 81, 83, 85, 93, 86, 89,
87, 88, 90, 91, 92, 94, 95, 96,
99, 101, 98, 100, 22, 25, 100, 22,
102, 104, 105, 106, 107, 108, 103, 109,
111, 112, 110
};
static const char _tsip_machine_parser_header_P_Associated_URI_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 3, 3, 15, 15, 3, 0,
0, 3, 3, 0, 0, 0, 1, 0,
0, 0, 0, 7, 11, 11, 11, 0,
13, 0, 1, 0, 0, 18, 18, 0,
18, 9, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 18, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 5, 5, 5, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0
};
static const int tsip_machine_parser_header_P_Associated_URI_start = 1;
static const int tsip_machine_parser_header_P_Associated_URI_first_final = 113;
static const int tsip_machine_parser_header_P_Associated_URI_error = 0;
static const int tsip_machine_parser_header_P_Associated_URI_en_main = 1;
/* #line 149 "tsip_parser_header_P_Associated_URI.rl" */
/* #line 353 "../src/headers/tsip_header_P_Associated_URI.c" */
{
cs = tsip_machine_parser_header_P_Associated_URI_start;
}
/* #line 150 "tsip_parser_header_P_Associated_URI.rl" */
/* #line 360 "../src/headers/tsip_header_P_Associated_URI.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_P_Associated_URI_trans_keys + _tsip_machine_parser_header_P_Associated_URI_key_offsets[cs];
_trans = _tsip_machine_parser_header_P_Associated_URI_index_offsets[cs];
_klen = _tsip_machine_parser_header_P_Associated_URI_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_P_Associated_URI_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_P_Associated_URI_indicies[_trans];
cs = _tsip_machine_parser_header_P_Associated_URI_trans_targs[_trans];
if ( _tsip_machine_parser_header_P_Associated_URI_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_P_Associated_URI_actions + _tsip_machine_parser_header_P_Associated_URI_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 53 "tsip_parser_header_P_Associated_URI.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 58 "tsip_parser_header_P_Associated_URI.rl" */
{
if(!curr_p_associated_uri)
{
curr_p_associated_uri = TSIP_HEADER_P_ASSOCIATED_URI_CREATE_NULL();
}
}
break;
case 2:
/* #line 66 "tsip_parser_header_P_Associated_URI.rl" */
{
if(curr_p_associated_uri)
{
TSK_PARSER_SET_STRING(curr_p_associated_uri->display_name);
}
}
break;
case 3:
/* #line 74 "tsip_parser_header_P_Associated_URI.rl" */
{
if(curr_p_associated_uri && !curr_p_associated_uri->uri)
{
int len = (int)(p - tag_start);
curr_p_associated_uri->uri = tsip_uri_parse(tag_start, (size_t)len);
}
}
break;
case 4:
/* #line 83 "tsip_parser_header_P_Associated_URI.rl" */
{
if(curr_p_associated_uri)
{
TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_p_associated_uri));
}
}
break;
case 5:
/* #line 91 "tsip_parser_header_P_Associated_URI.rl" */
{
if(curr_p_associated_uri)
{
tsk_list_push_back_data(hdr_p_associated_uris, ((void**) &curr_p_associated_uri));
}
}
break;
case 6:
/* #line 99 "tsip_parser_header_P_Associated_URI.rl" */
{
}
break;
/* #line 491 "../src/headers/tsip_header_P_Associated_URI.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 151 "tsip_parser_header_P_Associated_URI.rl" */
if( cs <
/* #line 507 "../src/headers/tsip_header_P_Associated_URI.c" */
113
/* #line 152 "tsip_parser_header_P_Associated_URI.rl" */
)
{
TSK_OBJECT_SAFE_FREE(curr_p_associated_uri);
TSK_OBJECT_SAFE_FREE(hdr_p_associated_uris);
}
return hdr_p_associated_uris;
}
//========================================================
// 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;
if(P_Associated_URI)
{
const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*);
TSIP_HEADER(P_Associated_URI)->type = tsip_htype_P_Associated_URI;
TSIP_HEADER(P_Associated_URI)->tostring = tsip_header_P_Associated_URI_tostring;
if(uri){
P_Associated_URI->uri = tsk_object_ref((void*)uri);
}
}
else
{
TSK_DEBUG_ERROR("Failed to create new P_Associated_URI header.");
}
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;
if(P_Associated_URI)
{
TSK_FREE(P_Associated_URI->display_name);
TSK_OBJECT_SAFE_FREE(P_Associated_URI->uri);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(P_Associated_URI));
}
else TSK_DEBUG_ERROR("Null P_Associated_URI header.");
return self;
}
static const tsk_object_def_t tsip_header_P_Associated_URI_def_s =
{
sizeof(tsip_header_P_Associated_URI_t),
tsip_header_P_Associated_URI_create,
tsip_header_P_Associated_URI_destroy,
0
};
const void *tsip_header_P_Associated_URI_def_t = &tsip_header_P_Associated_URI_def_s;

View File

@ -1 +1,775 @@
/* #line 1 "tsip_parser_header_P_Charging_Function_Addresses.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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_P_Charging_Function_Addresses.c
* @brief SIP P-Charging-Function-Addresses header as per RFC 3455.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_P_Charging_Function_Addresses.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_time.h"
#include <string.h>
/**@defgroup tsip_header_P_Charging_Function_Addresses_group SIP P_Charging_Function_Addresses header.
*/
/***********************************
* Ragel state machine.
*/
/* #line 110 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
int tsip_header_P_Charging_Function_Addresses_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_P_Charging_Function_Addresses_t *P_Charging_Function_Addresses = header;
return tsk_buffer_appendEx(output, "%s%s%s%s%s",
P_Charging_Function_Addresses->ecf ? "ecf=" : "",
P_Charging_Function_Addresses->ecf ? P_Charging_Function_Addresses->ecf : "",
(P_Charging_Function_Addresses->ecf && P_Charging_Function_Addresses->ccf) ? ";" : "",
P_Charging_Function_Addresses->ccf ? "ccf=" : "",
P_Charging_Function_Addresses->ccf ? P_Charging_Function_Addresses->ccf : ""
);
}
return -1;
}
tsip_header_P_Charging_Function_Addressess_L_t *tsip_header_P_Charging_Function_Addresses_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_P_Charging_Function_Addressess_L_t *hdr_p_charging_function_addressess = TSK_LIST_CREATE();
const char *tag_start;
tsip_header_P_Charging_Function_Addresses_t *curr_p_charging_function_addresses = 0;
/* #line 84 "../src/headers/tsip_header_P_Charging_Function_Addresses.c" */
static const char _tsip_machine_parser_header_P_Charging_Function_Addresses_actions[] = {
0, 1, 6, 2, 1, 0, 2, 4,
5, 3, 2, 4, 5, 3, 3, 4,
5
};
static const short _tsip_machine_parser_header_P_Charging_Function_Addresses_key_offsets[] = {
0, 0, 2, 3, 5, 7, 9, 11,
13, 15, 17, 19, 20, 22, 24, 26,
28, 30, 32, 34, 36, 37, 39, 41,
43, 45, 47, 49, 51, 53, 55, 58,
79, 80, 82, 102, 121, 126, 127, 129,
133, 152, 153, 155, 174, 175, 177, 180,
196, 198, 200, 202, 204, 206, 207, 209,
213, 217, 218, 220, 223, 224, 230, 248,
255, 263, 271, 279, 281, 288, 297, 299,
302, 304, 307, 309, 312, 315, 316, 319,
320, 323, 324, 333, 342, 350, 358, 366,
374, 376, 382, 391, 400, 409, 411, 414,
417, 418, 419, 440, 461, 480, 485, 486,
488, 492, 511, 512, 514, 533, 534, 536,
539, 555, 557, 559, 561, 563, 565, 566,
568, 572, 578, 596, 603, 611, 619, 627,
629, 636, 645, 647, 650, 652, 655, 657,
660, 663, 664, 667, 668, 671, 672, 681,
690, 698, 706, 714, 722, 724, 730, 739,
748, 757, 759, 762, 765, 766, 767, 788,
809, 828, 833, 834, 836, 840, 859, 860,
862, 881, 882, 884, 887, 903, 905, 907,
909, 911, 913, 914, 916, 920, 926, 944,
951, 959, 967, 975, 977, 984, 993, 995,
998, 1000, 1003, 1005, 1008, 1011, 1012, 1015,
1016, 1019, 1020, 1029, 1038, 1046, 1054, 1062,
1070, 1072, 1078, 1087, 1096, 1105, 1107, 1110,
1113, 1114, 1115
};
static const char _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_keys[] = {
80, 112, 45, 67, 99, 72, 104, 65,
97, 82, 114, 71, 103, 73, 105, 78,
110, 71, 103, 45, 70, 102, 85, 117,
78, 110, 67, 99, 84, 116, 73, 105,
79, 111, 78, 110, 45, 65, 97, 68,
100, 68, 100, 82, 114, 69, 101, 83,
115, 83, 115, 69, 101, 83, 115, 9,
32, 58, 9, 13, 32, 33, 37, 39,
67, 69, 99, 101, 126, 42, 43, 45,
46, 48, 57, 65, 90, 95, 122, 10,
9, 32, 9, 32, 33, 37, 39, 67,
69, 99, 101, 126, 42, 43, 45, 46,
48, 57, 65, 90, 95, 122, 9, 13,
32, 33, 37, 39, 59, 61, 126, 42,
43, 45, 46, 48, 57, 65, 90, 95,
122, 9, 13, 32, 59, 61, 10, 9,
32, 9, 32, 59, 61, 9, 13, 32,
33, 34, 37, 39, 91, 126, 42, 43,
45, 46, 48, 57, 65, 90, 95, 122,
10, 9, 32, 9, 13, 32, 33, 34,
37, 39, 91, 126, 42, 43, 45, 46,
48, 57, 65, 90, 95, 122, 10, 9,
32, 9, 32, 34, 9, 13, 34, 92,
-64, -33, -32, -17, -16, -9, -8, -5,
-4, -3, 32, 126, -128, -65, -128, -65,
-128, -65, -128, -65, -128, -65, 10, 9,
32, 9, 13, 32, 59, 9, 13, 32,
59, 10, 9, 32, 9, 32, 59, 10,
0, 9, 11, 12, 14, 127, 9, 13,
32, 33, 37, 39, 59, 126, 42, 43,
45, 46, 48, 57, 65, 90, 95, 122,
58, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 58, 48, 57, 65, 70, 97, 102,
46, 58, 93, 48, 57, 65, 70, 97,
102, 48, 57, 46, 48, 57, 48, 57,
46, 48, 57, 48, 57, 93, 48, 57,
93, 48, 57, 93, 46, 48, 57, 46,
46, 48, 57, 46, 46, 58, 93, 48,
57, 65, 70, 97, 102, 46, 58, 93,
48, 57, 65, 70, 97, 102, 58, 93,
48, 57, 65, 70, 97, 102, 58, 93,
48, 57, 65, 70, 97, 102, 58, 93,
48, 57, 65, 70, 97, 102, 58, 93,
48, 57, 65, 70, 97, 102, 58, 93,
48, 57, 65, 70, 97, 102, 46, 58,
93, 48, 57, 65, 70, 97, 102, 46,
58, 93, 48, 57, 65, 70, 97, 102,
46, 58, 93, 48, 57, 65, 70, 97,
102, 48, 57, 46, 48, 57, 46, 48,
57, 46, 58, 9, 13, 32, 33, 37,
39, 59, 61, 67, 99, 126, 42, 43,
45, 46, 48, 57, 65, 90, 95, 122,
9, 13, 32, 33, 37, 39, 59, 61,
70, 102, 126, 42, 43, 45, 46, 48,
57, 65, 90, 95, 122, 9, 13, 32,
33, 37, 39, 59, 61, 126, 42, 43,
45, 46, 48, 57, 65, 90, 95, 122,
9, 13, 32, 59, 61, 10, 9, 32,
9, 32, 59, 61, 9, 13, 32, 33,
34, 37, 39, 91, 126, 42, 43, 45,
46, 48, 57, 65, 90, 95, 122, 10,
9, 32, 9, 13, 32, 33, 34, 37,
39, 91, 126, 42, 43, 45, 46, 48,
57, 65, 90, 95, 122, 10, 9, 32,
9, 32, 34, 9, 13, 34, 92, -64,
-33, -32, -17, -16, -9, -8, -5, -4,
-3, 32, 126, -128, -65, -128, -65, -128,
-65, -128, -65, -128, -65, 10, 9, 32,
9, 13, 32, 59, 0, 9, 11, 12,
14, 127, 9, 13, 32, 33, 37, 39,
59, 126, 42, 43, 45, 46, 48, 57,
65, 90, 95, 122, 58, 48, 57, 65,
70, 97, 102, 58, 93, 48, 57, 65,
70, 97, 102, 58, 93, 48, 57, 65,
70, 97, 102, 58, 93, 48, 57, 65,
70, 97, 102, 58, 93, 58, 48, 57,
65, 70, 97, 102, 46, 58, 93, 48,
57, 65, 70, 97, 102, 48, 57, 46,
48, 57, 48, 57, 46, 48, 57, 48,
57, 93, 48, 57, 93, 48, 57, 93,
46, 48, 57, 46, 46, 48, 57, 46,
46, 58, 93, 48, 57, 65, 70, 97,
102, 46, 58, 93, 48, 57, 65, 70,
97, 102, 58, 93, 48, 57, 65, 70,
97, 102, 58, 93, 48, 57, 65, 70,
97, 102, 58, 93, 48, 57, 65, 70,
97, 102, 58, 93, 48, 57, 65, 70,
97, 102, 58, 93, 48, 57, 65, 70,
97, 102, 46, 58, 93, 48, 57, 65,
70, 97, 102, 46, 58, 93, 48, 57,
65, 70, 97, 102, 46, 58, 93, 48,
57, 65, 70, 97, 102, 48, 57, 46,
48, 57, 46, 48, 57, 46, 58, 9,
13, 32, 33, 37, 39, 59, 61, 67,
99, 126, 42, 43, 45, 46, 48, 57,
65, 90, 95, 122, 9, 13, 32, 33,
37, 39, 59, 61, 70, 102, 126, 42,
43, 45, 46, 48, 57, 65, 90, 95,
122, 9, 13, 32, 33, 37, 39, 59,
61, 126, 42, 43, 45, 46, 48, 57,
65, 90, 95, 122, 9, 13, 32, 59,
61, 10, 9, 32, 9, 32, 59, 61,
9, 13, 32, 33, 34, 37, 39, 91,
126, 42, 43, 45, 46, 48, 57, 65,
90, 95, 122, 10, 9, 32, 9, 13,
32, 33, 34, 37, 39, 91, 126, 42,
43, 45, 46, 48, 57, 65, 90, 95,
122, 10, 9, 32, 9, 32, 34, 9,
13, 34, 92, -64, -33, -32, -17, -16,
-9, -8, -5, -4, -3, 32, 126, -128,
-65, -128, -65, -128, -65, -128, -65, -128,
-65, 10, 9, 32, 9, 13, 32, 59,
0, 9, 11, 12, 14, 127, 9, 13,
32, 33, 37, 39, 59, 126, 42, 43,
45, 46, 48, 57, 65, 90, 95, 122,
58, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 48, 57, 65, 70, 97, 102, 58,
93, 58, 48, 57, 65, 70, 97, 102,
46, 58, 93, 48, 57, 65, 70, 97,
102, 48, 57, 46, 48, 57, 48, 57,
46, 48, 57, 48, 57, 93, 48, 57,
93, 48, 57, 93, 46, 48, 57, 46,
46, 48, 57, 46, 46, 58, 93, 48,
57, 65, 70, 97, 102, 46, 58, 93,
48, 57, 65, 70, 97, 102, 58, 93,
48, 57, 65, 70, 97, 102, 58, 93,
48, 57, 65, 70, 97, 102, 58, 93,
48, 57, 65, 70, 97, 102, 58, 93,
48, 57, 65, 70, 97, 102, 58, 93,
48, 57, 65, 70, 97, 102, 46, 58,
93, 48, 57, 65, 70, 97, 102, 46,
58, 93, 48, 57, 65, 70, 97, 102,
46, 58, 93, 48, 57, 65, 70, 97,
102, 48, 57, 46, 48, 57, 46, 48,
57, 46, 58, 0
};
static const char _tsip_machine_parser_header_P_Charging_Function_Addresses_single_lengths[] = {
0, 2, 1, 2, 2, 2, 2, 2,
2, 2, 2, 1, 2, 2, 2, 2,
2, 2, 2, 2, 1, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 11,
1, 2, 10, 9, 5, 1, 2, 4,
9, 1, 2, 9, 1, 2, 3, 4,
0, 0, 0, 0, 0, 1, 2, 4,
4, 1, 2, 3, 1, 0, 8, 1,
2, 2, 2, 2, 1, 3, 0, 1,
0, 1, 0, 1, 1, 1, 1, 1,
1, 1, 3, 3, 2, 2, 2, 2,
2, 0, 3, 3, 3, 0, 1, 1,
1, 1, 11, 11, 9, 5, 1, 2,
4, 9, 1, 2, 9, 1, 2, 3,
4, 0, 0, 0, 0, 0, 1, 2,
4, 0, 8, 1, 2, 2, 2, 2,
1, 3, 0, 1, 0, 1, 0, 1,
1, 1, 1, 1, 1, 1, 3, 3,
2, 2, 2, 2, 2, 0, 3, 3,
3, 0, 1, 1, 1, 1, 11, 11,
9, 5, 1, 2, 4, 9, 1, 2,
9, 1, 2, 3, 4, 0, 0, 0,
0, 0, 1, 2, 4, 0, 8, 1,
2, 2, 2, 2, 1, 3, 0, 1,
0, 1, 0, 1, 1, 1, 1, 1,
1, 1, 3, 3, 2, 2, 2, 2,
2, 0, 3, 3, 3, 0, 1, 1,
1, 1, 0
};
static const char _tsip_machine_parser_header_P_Charging_Function_Addresses_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 5,
0, 0, 5, 5, 0, 0, 0, 0,
5, 0, 0, 5, 0, 0, 0, 6,
1, 1, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 3, 5, 3,
3, 3, 3, 0, 3, 3, 1, 1,
1, 1, 1, 1, 1, 0, 1, 0,
1, 0, 3, 3, 3, 3, 3, 3,
0, 3, 3, 3, 3, 1, 1, 1,
0, 0, 5, 5, 5, 0, 0, 0,
0, 5, 0, 0, 5, 0, 0, 0,
6, 1, 1, 1, 1, 1, 0, 0,
0, 3, 5, 3, 3, 3, 3, 0,
3, 3, 1, 1, 1, 1, 1, 1,
1, 0, 1, 0, 1, 0, 3, 3,
3, 3, 3, 3, 0, 3, 3, 3,
3, 1, 1, 1, 0, 0, 5, 5,
5, 0, 0, 0, 0, 5, 0, 0,
5, 0, 0, 0, 6, 1, 1, 1,
1, 1, 0, 0, 0, 3, 5, 3,
3, 3, 3, 0, 3, 3, 1, 1,
1, 1, 1, 1, 1, 0, 1, 0,
1, 0, 3, 3, 3, 3, 3, 3,
0, 3, 3, 3, 3, 1, 1, 1,
0, 0, 0
};
static const short _tsip_machine_parser_header_P_Charging_Function_Addresses_index_offsets[] = {
0, 0, 3, 5, 8, 11, 14, 17,
20, 23, 26, 29, 31, 34, 37, 40,
43, 46, 49, 52, 55, 57, 60, 63,
66, 69, 72, 75, 78, 81, 84, 88,
105, 107, 110, 126, 141, 147, 149, 152,
157, 172, 174, 177, 192, 194, 197, 201,
212, 214, 216, 218, 220, 222, 224, 227,
232, 237, 239, 242, 246, 248, 252, 266,
271, 277, 283, 289, 292, 297, 304, 306,
309, 311, 314, 316, 319, 322, 324, 327,
329, 332, 334, 341, 348, 354, 360, 366,
372, 375, 379, 386, 393, 400, 402, 405,
408, 410, 412, 429, 446, 461, 467, 469,
472, 477, 492, 494, 497, 512, 514, 517,
521, 532, 534, 536, 538, 540, 542, 544,
547, 552, 556, 570, 575, 581, 587, 593,
596, 601, 608, 610, 613, 615, 618, 620,
623, 626, 628, 631, 633, 636, 638, 645,
652, 658, 664, 670, 676, 679, 683, 690,
697, 704, 706, 709, 712, 714, 716, 733,
750, 765, 771, 773, 776, 781, 796, 798,
801, 816, 818, 821, 825, 836, 838, 840,
842, 844, 846, 848, 851, 856, 860, 874,
879, 885, 891, 897, 900, 905, 912, 914,
917, 919, 922, 924, 927, 930, 932, 935,
937, 940, 942, 949, 956, 962, 968, 974,
980, 983, 987, 994, 1001, 1008, 1010, 1013,
1016, 1018, 1020
};
static const unsigned char _tsip_machine_parser_header_P_Charging_Function_Addresses_indicies[] = {
0, 0, 1, 2, 1, 3, 3, 1,
4, 4, 1, 5, 5, 1, 6, 6,
1, 7, 7, 1, 8, 8, 1, 9,
9, 1, 10, 10, 1, 11, 1, 12,
12, 1, 13, 13, 1, 14, 14, 1,
15, 15, 1, 16, 16, 1, 17, 17,
1, 18, 18, 1, 19, 19, 1, 20,
1, 21, 21, 1, 22, 22, 1, 23,
23, 1, 24, 24, 1, 25, 25, 1,
26, 26, 1, 27, 27, 1, 28, 28,
1, 29, 29, 1, 29, 29, 30, 1,
30, 31, 30, 32, 32, 32, 33, 34,
33, 34, 32, 32, 32, 32, 32, 32,
1, 35, 1, 36, 36, 1, 36, 36,
32, 32, 32, 33, 34, 33, 34, 32,
32, 32, 32, 32, 32, 1, 37, 38,
37, 39, 39, 39, 40, 41, 39, 39,
39, 39, 39, 39, 1, 42, 43, 42,
30, 41, 1, 44, 1, 45, 45, 1,
45, 45, 30, 41, 1, 41, 46, 41,
47, 48, 47, 47, 49, 47, 47, 47,
47, 47, 47, 1, 50, 1, 51, 51,
1, 51, 52, 51, 47, 48, 47, 47,
49, 47, 47, 47, 47, 47, 47, 1,
53, 1, 54, 54, 1, 54, 54, 48,
1, 48, 60, 61, 62, 55, 56, 57,
58, 59, 48, 1, 48, 1, 55, 1,
56, 1, 57, 1, 58, 1, 63, 1,
48, 48, 1, 64, 38, 64, 40, 1,
65, 66, 65, 30, 1, 67, 1, 68,
68, 1, 68, 68, 30, 1, 69, 1,
48, 48, 48, 1, 64, 38, 64, 47,
47, 47, 40, 47, 47, 47, 47, 47,
47, 1, 71, 70, 70, 70, 1, 73,
61, 72, 72, 72, 1, 73, 61, 74,
74, 74, 1, 73, 61, 75, 75, 75,
1, 73, 61, 1, 77, 76, 70, 70,
1, 78, 73, 61, 79, 72, 72, 1,
80, 1, 81, 82, 1, 83, 1, 84,
85, 1, 86, 1, 61, 87, 1, 61,
88, 1, 61, 1, 84, 89, 1, 84,
1, 81, 90, 1, 81, 1, 78, 73,
61, 91, 74, 74, 1, 78, 73, 61,
75, 75, 75, 1, 93, 61, 92, 92,
92, 1, 95, 61, 94, 94, 94, 1,
95, 61, 96, 96, 96, 1, 95, 61,
97, 97, 97, 1, 95, 61, 1, 98,
92, 92, 1, 78, 95, 61, 99, 94,
94, 1, 78, 95, 61, 100, 96, 96,
1, 78, 95, 61, 97, 97, 97, 1,
101, 1, 78, 102, 1, 78, 103, 1,
78, 1, 77, 1, 37, 38, 37, 39,
39, 39, 40, 41, 104, 104, 39, 39,
39, 39, 39, 39, 1, 37, 38, 37,
39, 39, 39, 40, 41, 105, 105, 39,
39, 39, 39, 39, 39, 1, 106, 38,
106, 39, 39, 39, 40, 107, 39, 39,
39, 39, 39, 39, 1, 108, 109, 108,
30, 107, 1, 110, 1, 111, 111, 1,
111, 111, 30, 107, 1, 107, 112, 107,
113, 114, 113, 113, 115, 113, 113, 113,
113, 113, 113, 1, 116, 1, 117, 117,
1, 117, 118, 117, 113, 114, 113, 113,
115, 113, 113, 113, 113, 113, 113, 1,
119, 1, 120, 120, 1, 120, 120, 114,
1, 114, 126, 127, 128, 121, 122, 123,
124, 125, 114, 1, 114, 1, 121, 1,
122, 1, 123, 1, 124, 1, 129, 1,
114, 114, 1, 130, 131, 130, 132, 1,
114, 114, 114, 1, 130, 131, 130, 113,
113, 113, 132, 113, 113, 113, 113, 113,
113, 1, 134, 133, 133, 133, 1, 136,
127, 135, 135, 135, 1, 136, 127, 137,
137, 137, 1, 136, 127, 138, 138, 138,
1, 136, 127, 1, 140, 139, 133, 133,
1, 141, 136, 127, 142, 135, 135, 1,
143, 1, 144, 145, 1, 146, 1, 147,
148, 1, 149, 1, 127, 150, 1, 127,
151, 1, 127, 1, 147, 152, 1, 147,
1, 144, 153, 1, 144, 1, 141, 136,
127, 154, 137, 137, 1, 141, 136, 127,
138, 138, 138, 1, 156, 127, 155, 155,
155, 1, 158, 127, 157, 157, 157, 1,
158, 127, 159, 159, 159, 1, 158, 127,
160, 160, 160, 1, 158, 127, 1, 161,
155, 155, 1, 141, 158, 127, 162, 157,
157, 1, 141, 158, 127, 163, 159, 159,
1, 141, 158, 127, 160, 160, 160, 1,
164, 1, 141, 165, 1, 141, 166, 1,
141, 1, 140, 1, 37, 38, 37, 39,
39, 39, 40, 41, 167, 167, 39, 39,
39, 39, 39, 39, 1, 37, 38, 37,
39, 39, 39, 40, 41, 168, 168, 39,
39, 39, 39, 39, 39, 1, 169, 38,
169, 39, 39, 39, 40, 170, 39, 39,
39, 39, 39, 39, 1, 171, 172, 171,
30, 170, 1, 173, 1, 174, 174, 1,
174, 174, 30, 170, 1, 170, 175, 170,
176, 177, 176, 176, 178, 176, 176, 176,
176, 176, 176, 1, 179, 1, 180, 180,
1, 180, 181, 180, 176, 177, 176, 176,
178, 176, 176, 176, 176, 176, 176, 1,
182, 1, 183, 183, 1, 183, 183, 177,
1, 177, 189, 190, 191, 184, 185, 186,
187, 188, 177, 1, 177, 1, 184, 1,
185, 1, 186, 1, 187, 1, 192, 1,
177, 177, 1, 193, 194, 193, 195, 1,
177, 177, 177, 1, 193, 194, 193, 176,
176, 176, 195, 176, 176, 176, 176, 176,
176, 1, 197, 196, 196, 196, 1, 199,
190, 198, 198, 198, 1, 199, 190, 200,
200, 200, 1, 199, 190, 201, 201, 201,
1, 199, 190, 1, 203, 202, 196, 196,
1, 204, 199, 190, 205, 198, 198, 1,
206, 1, 207, 208, 1, 209, 1, 210,
211, 1, 212, 1, 190, 213, 1, 190,
214, 1, 190, 1, 210, 215, 1, 210,
1, 207, 216, 1, 207, 1, 204, 199,
190, 217, 200, 200, 1, 204, 199, 190,
201, 201, 201, 1, 219, 190, 218, 218,
218, 1, 221, 190, 220, 220, 220, 1,
221, 190, 222, 222, 222, 1, 221, 190,
223, 223, 223, 1, 221, 190, 1, 224,
218, 218, 1, 204, 221, 190, 225, 220,
220, 1, 204, 221, 190, 226, 222, 222,
1, 204, 221, 190, 223, 223, 223, 1,
227, 1, 204, 228, 1, 204, 229, 1,
204, 1, 203, 1, 1, 0
};
static const unsigned char _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32,
35, 98, 158, 33, 34, 36, 60, 35,
31, 40, 36, 37, 38, 39, 41, 62,
47, 63, 42, 43, 44, 45, 46, 48,
49, 50, 51, 52, 53, 55, 61, 54,
56, 56, 57, 58, 59, 218, 64, 97,
65, 68, 66, 67, 69, 84, 70, 82,
71, 72, 80, 73, 74, 78, 75, 76,
77, 79, 81, 83, 85, 93, 86, 89,
87, 88, 90, 91, 92, 94, 95, 96,
99, 100, 101, 105, 101, 102, 103, 104,
106, 122, 112, 123, 107, 108, 109, 110,
111, 113, 114, 115, 116, 117, 118, 120,
121, 119, 56, 60, 31, 124, 157, 125,
128, 126, 127, 129, 144, 130, 142, 131,
132, 140, 133, 134, 138, 135, 136, 137,
139, 141, 143, 145, 153, 146, 149, 147,
148, 150, 151, 152, 154, 155, 156, 159,
160, 161, 165, 161, 162, 163, 164, 166,
182, 172, 183, 167, 168, 169, 170, 171,
173, 174, 175, 176, 177, 178, 180, 181,
179, 56, 60, 31, 184, 217, 185, 188,
186, 187, 189, 204, 190, 202, 191, 192,
200, 193, 194, 198, 195, 196, 197, 199,
201, 203, 205, 213, 206, 209, 207, 208,
210, 211, 212, 214, 215, 216
};
static const char _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
3, 3, 3, 0, 0, 6, 6, 0,
6, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
6, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 6, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 9, 9, 9, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 6, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 13, 13, 13, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0
};
static const int tsip_machine_parser_header_P_Charging_Function_Addresses_start = 1;
static const int tsip_machine_parser_header_P_Charging_Function_Addresses_first_final = 218;
static const int tsip_machine_parser_header_P_Charging_Function_Addresses_error = 0;
static const int tsip_machine_parser_header_P_Charging_Function_Addresses_en_main = 1;
/* #line 143 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
/* #line 562 "../src/headers/tsip_header_P_Charging_Function_Addresses.c" */
{
cs = tsip_machine_parser_header_P_Charging_Function_Addresses_start;
}
/* #line 144 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
/* #line 569 "../src/headers/tsip_header_P_Charging_Function_Addresses.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_P_Charging_Function_Addresses_trans_keys + _tsip_machine_parser_header_P_Charging_Function_Addresses_key_offsets[cs];
_trans = _tsip_machine_parser_header_P_Charging_Function_Addresses_index_offsets[cs];
_klen = _tsip_machine_parser_header_P_Charging_Function_Addresses_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_P_Charging_Function_Addresses_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_P_Charging_Function_Addresses_indicies[_trans];
cs = _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_targs[_trans];
if ( _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_P_Charging_Function_Addresses_actions + _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 53 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 58 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
{
if(!curr_p_charging_function_addresses)
{
curr_p_charging_function_addresses = TSIP_HEADER_P_CHARGING_FUNCTION_ADDRESSES_CREATE();
}
}
break;
case 2:
/* #line 66 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
{
if(!curr_p_charging_function_addresses->ccf)
{
TSK_PARSER_SET_STRING(curr_p_charging_function_addresses->ccf);
}
}
break;
case 3:
/* #line 74 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
{
if(!curr_p_charging_function_addresses->ecf)
{
TSK_PARSER_SET_STRING(curr_p_charging_function_addresses->ecf);
}
}
break;
case 4:
/* #line 82 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
{
if(curr_p_charging_function_addresses)
{
TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_p_charging_function_addresses));
}
}
break;
case 5:
/* #line 90 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
{
if(curr_p_charging_function_addresses)
{
tsk_list_push_back_data(hdr_p_charging_function_addressess, ((void**) &curr_p_charging_function_addresses));
}
}
break;
case 6:
/* #line 98 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
{
}
break;
/* #line 699 "../src/headers/tsip_header_P_Charging_Function_Addresses.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 145 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
if( cs <
/* #line 715 "../src/headers/tsip_header_P_Charging_Function_Addresses.c" */
218
/* #line 146 "tsip_parser_header_P_Charging_Function_Addresses.rl" */
)
{
TSK_OBJECT_SAFE_FREE(curr_p_charging_function_addresses);
TSK_OBJECT_SAFE_FREE(hdr_p_charging_function_addressess);
}
return hdr_p_charging_function_addressess;
}
//========================================================
// 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;
if(P_Charging_Function_Addresses)
{
TSIP_HEADER(P_Charging_Function_Addresses)->type = tsip_htype_P_Charging_Function_Addresses;
TSIP_HEADER(P_Charging_Function_Addresses)->tostring = tsip_header_P_Charging_Function_Addresses_tostring;
}
else
{
TSK_DEBUG_ERROR("Failed to create new P_Charging_Function_Addresses header.");
}
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;
if(P_Charging_Function_Addresses)
{
TSK_FREE(P_Charging_Function_Addresses->ecf);
TSK_FREE(P_Charging_Function_Addresses->ccf);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(P_Charging_Function_Addresses));
}
else TSK_DEBUG_ERROR("Null P_Charging_Function_Addresses header.");
return self;
}
static const tsk_object_def_t tsip_header_P_Charging_Function_Addresses_def_s =
{
sizeof(tsip_header_P_Charging_Function_Addresses_t),
tsip_header_P_Charging_Function_Addresses_create,
tsip_header_P_Charging_Function_Addresses_destroy,
0
};
const void *tsip_header_P_Charging_Function_Addresses_def_t = &tsip_header_P_Charging_Function_Addresses_def_s;

File diff suppressed because it is too large Load Diff

View File

@ -421,7 +421,7 @@ _match:
{
if(!curr_path)
{
curr_path = TSIP_HEADER_PATH_CREATE();
curr_path = TSIP_HEADER_PATH_CREATE_NULL();
}
}
break;
@ -510,8 +510,13 @@ static void* tsip_header_Path_create(void *self, va_list * app)
tsip_header_Path_t *Path = self;
if(Path)
{
const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*);
TSIP_HEADER(Path)->type = tsip_htype_Path;
TSIP_HEADER(Path)->tostring = tsip_header_Path_tostring;
if(uri){
Path->uri = tsk_object_ref((void*)uri);
}
}
else
{

View File

@ -23,7 +23,7 @@
*/
/**@file tsip_header_Route.c
* @brief SIP Service-Route header as per RFC 3608.
* @brief SIP Route header.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
@ -39,7 +39,7 @@
#include <string.h>
/**@defgroup tsip_header_Route_group SIP Service-Route header.
/**@defgroup tsip_header_Route_group SIP Route header.
*/
/***********************************
@ -421,7 +421,7 @@ _match:
{
if(!curr_route)
{
curr_route = TSIP_HEADER_ROUTE_CREATE();
curr_route = TSIP_HEADER_ROUTE_CREATE_NULL();
}
}
break;
@ -510,8 +510,14 @@ static void* tsip_header_Route_create(void *self, va_list * app)
tsip_header_Route_t *Route = self;
if(Route)
{
const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*);
TSIP_HEADER(Route)->type = tsip_htype_Route;
TSIP_HEADER(Route)->tostring = tsip_header_Route_tostring;
if(uri){
Route->uri = tsk_object_ref((void*)uri);
}
}
else
{

View File

@ -1 +1,310 @@
/* #line 1 "tsip_parser_header_Server.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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_Server.c
* @brief SIP Server header.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_Server.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include <string.h>
/**@defgroup tsip_header_Server_group SIP Server header.
*/
/***********************************
* Ragel state machine.
*/
/* #line 75 "tsip_parser_header_Server.rl" */
int tsip_header_Server_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_Server_t *Server = header;
if(Server->value)
{
return tsk_buffer_append(output, Server->value, strlen(Server->value));
}
return 0;
}
return -1;
}
tsip_header_Server_t *tsip_header_Server_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_Server_t *hdr_server = TSIP_HEADER_SERVER_CREATE(0);
const char *tag_start;
/* #line 78 "../src/headers/tsip_header_Server.c" */
static const char _tsip_machine_parser_header_Server_actions[] = {
0, 1, 0, 1, 1, 1, 2, 2,
0, 1
};
static const char _tsip_machine_parser_header_Server_key_offsets[] = {
0, 0, 2, 4, 6, 8, 10, 12,
15, 18, 19, 20
};
static const char _tsip_machine_parser_header_Server_trans_keys[] = {
83, 115, 69, 101, 82, 114, 86, 118,
69, 101, 82, 114, 9, 32, 58, 9,
13, 32, 13, 10, 0
};
static const char _tsip_machine_parser_header_Server_single_lengths[] = {
0, 2, 2, 2, 2, 2, 2, 3,
3, 1, 1, 0
};
static const char _tsip_machine_parser_header_Server_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0
};
static const char _tsip_machine_parser_header_Server_index_offsets[] = {
0, 0, 3, 6, 9, 12, 15, 18,
22, 26, 28, 30
};
static const char _tsip_machine_parser_header_Server_indicies[] = {
0, 0, 1, 2, 2, 1, 3, 3,
1, 4, 4, 1, 5, 5, 1, 6,
6, 1, 6, 6, 7, 1, 9, 10,
9, 8, 12, 11, 13, 1, 1, 0
};
static const char _tsip_machine_parser_header_Server_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 8, 10, 9, 10, 11
};
static const char _tsip_machine_parser_header_Server_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 7, 0, 3, 5
};
static const int tsip_machine_parser_header_Server_start = 1;
static const int tsip_machine_parser_header_Server_first_final = 11;
static const int tsip_machine_parser_header_Server_error = 0;
static const int tsip_machine_parser_header_Server_en_main = 1;
/* #line 103 "tsip_parser_header_Server.rl" */
/* #line 136 "../src/headers/tsip_header_Server.c" */
{
cs = tsip_machine_parser_header_Server_start;
}
/* #line 104 "tsip_parser_header_Server.rl" */
/* #line 143 "../src/headers/tsip_header_Server.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_Server_trans_keys + _tsip_machine_parser_header_Server_key_offsets[cs];
_trans = _tsip_machine_parser_header_Server_index_offsets[cs];
_klen = _tsip_machine_parser_header_Server_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_Server_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_Server_indicies[_trans];
cs = _tsip_machine_parser_header_Server_trans_targs[_trans];
if ( _tsip_machine_parser_header_Server_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Server_actions + _tsip_machine_parser_header_Server_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 52 "tsip_parser_header_Server.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 57 "tsip_parser_header_Server.rl" */
{
TSK_PARSER_SET_STRING(hdr_server->value);
}
break;
case 2:
/* #line 62 "tsip_parser_header_Server.rl" */
{
}
break;
/* #line 234 "../src/headers/tsip_header_Server.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 105 "tsip_parser_header_Server.rl" */
if( cs <
/* #line 250 "../src/headers/tsip_header_Server.c" */
11
/* #line 106 "tsip_parser_header_Server.rl" */
)
{
TSK_OBJECT_SAFE_FREE(hdr_server);
}
return hdr_server;
}
//========================================================
// 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;
if(Server)
{
TSIP_HEADER(Server)->type = tsip_htype_Server;
TSIP_HEADER(Server)->tostring = tsip_header_Server_tostring;
Server->value = tsk_strdup(va_arg(*app, const char*));
}
else
{
TSK_DEBUG_ERROR("Failed to create new Server header.");
}
return self;
}
/**@ingroup tsip_header_Server_group
*/
static void* tsip_header_Server_destroy(void *self)
{
tsip_header_Server_t *Server = self;
if(Server)
{
TSK_FREE(Server->value);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Server));
}
else TSK_DEBUG_ERROR("Null Server header.");
return self;
}
static const tsk_object_def_t tsip_header_Server_def_s =
{
sizeof(tsip_header_Server_t),
tsip_header_Server_create,
tsip_header_Server_destroy,
0
};
const void *tsip_header_Server_def_t = &tsip_header_Server_def_s;

View File

@ -430,7 +430,7 @@ _match:
{
if(!curr_service)
{
curr_service = TSIP_HEADER_SERVICE_ROUTE_CREATE();
curr_service = TSIP_HEADER_SERVICE_ROUTE_CREATE_NULL();
}
}
break;
@ -519,8 +519,13 @@ static void* tsip_header_Service_Route_create(void *self, va_list * app)
tsip_header_Service_Route_t *Service_Route = self;
if(Service_Route)
{
const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*);
TSIP_HEADER(Service_Route)->type = tsip_htype_Service_Route;
TSIP_HEADER(Service_Route)->tostring = tsip_header_Service_Route_tostring;
if(uri){
Service_Route->uri = tsk_object_ref((void*)uri);
}
}
else
{

View File

@ -298,6 +298,7 @@ static void* tsip_header_User_Agent_destroy(void *self)
if(User_Agent)
{
TSK_FREE(User_Agent->value);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(User_Agent));
}
else TSK_DEBUG_ERROR("Null User_Agent header.");

View File

@ -1 +1,564 @@
/* #line 1 "tsip_parser_header_Warning.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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_Warning.c
* @brief SIP Warning header.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_Warning.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_time.h"
#include <string.h>
/**@defgroup tsip_header_Warning_group SIP Warning header.
*/
/***********************************
* Ragel state machine.
*/
/* #line 111 "tsip_parser_header_Warning.rl" */
int tsip_header_Warning_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_Warning_t *Warning = header;
return tsk_buffer_appendEx(output, "%d %s %s",
Warning->code, Warning->agent, Warning->text); /* warn-code SP warn-agent SP warn-text */
}
return -1;
}
tsip_header_Warnings_L_t *tsip_header_Warning_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_Warnings_L_t *hdr_warnings = TSK_LIST_CREATE();
const char *tag_start;
tsip_header_Warning_t *curr_warning = 0;
/* #line 77 "../src/headers/tsip_header_Warning.c" */
static const char _tsip_machine_parser_header_Warning_actions[] = {
0, 1, 0, 1, 2, 1, 4, 1,
6, 2, 1, 0, 2, 3, 5
};
static const short _tsip_machine_parser_header_Warning_key_offsets[] = {
0, 0, 2, 4, 6, 8, 10, 12,
14, 17, 22, 23, 25, 29, 31, 33,
34, 51, 66, 70, 74, 75, 77, 80,
96, 98, 100, 102, 104, 106, 107, 109,
113, 117, 118, 120, 123, 124, 130, 147,
164, 181, 198, 216, 233, 251, 253, 256,
273, 290, 307, 324, 341, 359, 377, 395,
412, 429, 446, 463, 480, 497, 504, 512,
520, 528, 530, 537, 546, 548, 551, 553,
556, 558, 561, 564, 565, 567, 570, 571,
574, 575, 584, 593, 601, 609, 617, 625,
627, 633, 642, 651, 660, 662, 665, 668,
669, 670
};
static const char _tsip_machine_parser_header_Warning_trans_keys[] = {
87, 119, 65, 97, 82, 114, 78, 110,
73, 105, 78, 110, 71, 103, 9, 32,
58, 9, 13, 32, 48, 57, 10, 9,
32, 9, 32, 48, 57, 48, 57, 48,
57, 32, 33, 37, 39, 91, 126, 42,
43, 45, 46, 48, 57, 65, 90, 95,
96, 97, 122, 32, 33, 37, 39, 126,
42, 43, 45, 46, 48, 57, 65, 90,
95, 122, 9, 13, 32, 34, 9, 13,
32, 34, 10, 9, 32, 9, 32, 34,
9, 13, 34, 92, -64, -33, -32, -17,
-16, -9, -8, -5, -4, -3, 32, 126,
-128, -65, -128, -65, -128, -65, -128, -65,
-128, -65, 10, 9, 32, 9, 13, 32,
44, 9, 13, 32, 44, 10, 9, 32,
9, 32, 44, 10, 0, 9, 11, 12,
14, 127, 32, 33, 37, 39, 45, 46,
126, 42, 43, 48, 57, 65, 90, 95,
96, 97, 122, 32, 33, 37, 39, 45,
46, 126, 42, 43, 48, 57, 65, 90,
95, 96, 97, 122, 32, 33, 37, 39,
45, 46, 126, 42, 43, 48, 57, 65,
90, 95, 96, 97, 122, 32, 33, 37,
39, 126, 42, 43, 45, 46, 48, 57,
65, 90, 95, 96, 97, 122, 32, 33,
37, 39, 45, 46, 58, 126, 42, 43,
48, 57, 65, 90, 95, 96, 97, 122,
32, 33, 37, 39, 45, 46, 126, 42,
43, 48, 57, 65, 90, 95, 96, 97,
122, 32, 33, 37, 39, 58, 126, 42,
43, 45, 46, 48, 57, 65, 90, 95,
96, 97, 122, 48, 57, 32, 48, 57,
32, 33, 37, 39, 126, 42, 43, 45,
46, 48, 57, 65, 90, 95, 96, 97,
122, 32, 33, 37, 39, 45, 46, 126,
42, 43, 48, 57, 65, 90, 95, 96,
97, 122, 32, 33, 37, 39, 126, 42,
43, 45, 46, 48, 57, 65, 90, 95,
96, 97, 122, 32, 33, 37, 39, 45,
46, 126, 42, 43, 48, 57, 65, 90,
95, 96, 97, 122, 32, 33, 37, 39,
126, 42, 43, 45, 46, 48, 57, 65,
90, 95, 96, 97, 122, 32, 33, 37,
39, 45, 46, 58, 126, 42, 43, 48,
57, 65, 90, 95, 96, 97, 122, 32,
33, 37, 39, 45, 46, 58, 126, 42,
43, 48, 57, 65, 90, 95, 96, 97,
122, 32, 33, 37, 39, 45, 46, 58,
126, 42, 43, 48, 57, 65, 90, 95,
96, 97, 122, 32, 33, 37, 39, 45,
46, 126, 42, 43, 48, 57, 65, 90,
95, 96, 97, 122, 32, 33, 37, 39,
45, 46, 126, 42, 43, 48, 57, 65,
90, 95, 96, 97, 122, 32, 33, 37,
39, 45, 46, 126, 42, 43, 48, 57,
65, 90, 95, 96, 97, 122, 32, 33,
37, 39, 45, 46, 126, 42, 43, 48,
57, 65, 90, 95, 96, 97, 122, 32,
33, 37, 39, 45, 46, 126, 42, 43,
48, 57, 65, 90, 95, 96, 97, 122,
32, 33, 37, 39, 45, 46, 126, 42,
43, 48, 57, 65, 90, 95, 96, 97,
122, 58, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 48, 57, 65, 70, 97, 102,
58, 93, 58, 48, 57, 65, 70, 97,
102, 46, 58, 93, 48, 57, 65, 70,
97, 102, 48, 57, 46, 48, 57, 48,
57, 46, 48, 57, 48, 57, 93, 48,
57, 93, 48, 57, 93, 32, 58, 46,
48, 57, 46, 46, 48, 57, 46, 46,
58, 93, 48, 57, 65, 70, 97, 102,
46, 58, 93, 48, 57, 65, 70, 97,
102, 58, 93, 48, 57, 65, 70, 97,
102, 58, 93, 48, 57, 65, 70, 97,
102, 58, 93, 48, 57, 65, 70, 97,
102, 58, 93, 48, 57, 65, 70, 97,
102, 58, 93, 48, 57, 65, 70, 97,
102, 46, 58, 93, 48, 57, 65, 70,
97, 102, 46, 58, 93, 48, 57, 65,
70, 97, 102, 46, 58, 93, 48, 57,
65, 70, 97, 102, 48, 57, 46, 48,
57, 46, 48, 57, 46, 58, 0
};
static const char _tsip_machine_parser_header_Warning_single_lengths[] = {
0, 2, 2, 2, 2, 2, 2, 2,
3, 3, 1, 2, 2, 0, 0, 1,
5, 5, 4, 4, 1, 2, 3, 4,
0, 0, 0, 0, 0, 1, 2, 4,
4, 1, 2, 3, 1, 0, 7, 7,
7, 5, 8, 7, 6, 0, 1, 5,
7, 5, 7, 5, 8, 8, 8, 7,
7, 7, 7, 7, 7, 1, 2, 2,
2, 2, 1, 3, 0, 1, 0, 1,
0, 1, 1, 1, 2, 1, 1, 1,
1, 3, 3, 2, 2, 2, 2, 2,
0, 3, 3, 3, 0, 1, 1, 1,
1, 0
};
static const char _tsip_machine_parser_header_Warning_range_lengths[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 1, 1, 1, 0,
6, 5, 0, 0, 0, 0, 0, 6,
1, 1, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 3, 5, 5,
5, 6, 5, 5, 6, 1, 1, 6,
5, 6, 5, 6, 5, 5, 5, 5,
5, 5, 5, 5, 5, 3, 3, 3,
3, 0, 3, 3, 1, 1, 1, 1,
1, 1, 1, 0, 0, 1, 0, 1,
0, 3, 3, 3, 3, 3, 3, 0,
3, 3, 3, 3, 1, 1, 1, 0,
0, 0
};
static const short _tsip_machine_parser_header_Warning_index_offsets[] = {
0, 0, 3, 6, 9, 12, 15, 18,
21, 25, 30, 32, 35, 39, 41, 43,
45, 57, 68, 73, 78, 80, 83, 87,
98, 100, 102, 104, 106, 108, 110, 113,
118, 123, 125, 128, 132, 134, 138, 151,
164, 177, 189, 203, 216, 229, 231, 234,
246, 259, 271, 284, 296, 310, 324, 338,
351, 364, 377, 390, 403, 416, 421, 427,
433, 439, 442, 447, 454, 456, 459, 461,
464, 466, 469, 472, 474, 477, 480, 482,
485, 487, 494, 501, 507, 513, 519, 525,
528, 532, 539, 546, 553, 555, 558, 561,
563, 565
};
static const char _tsip_machine_parser_header_Warning_indicies[] = {
0, 0, 1, 2, 2, 1, 3, 3,
1, 4, 4, 1, 5, 5, 1, 6,
6, 1, 7, 7, 1, 7, 7, 8,
1, 8, 9, 8, 10, 1, 11, 1,
12, 12, 1, 12, 12, 10, 1, 13,
1, 14, 1, 15, 1, 16, 16, 16,
19, 16, 16, 16, 17, 18, 16, 18,
1, 20, 21, 21, 21, 21, 21, 21,
21, 21, 21, 1, 22, 23, 22, 24,
1, 25, 26, 25, 27, 1, 28, 1,
29, 29, 1, 29, 29, 27, 1, 27,
35, 36, 37, 30, 31, 32, 33, 34,
27, 1, 27, 1, 30, 1, 31, 1,
32, 1, 33, 1, 38, 1, 27, 27,
1, 39, 40, 39, 41, 1, 42, 43,
42, 8, 1, 44, 1, 45, 45, 1,
45, 45, 8, 1, 46, 1, 27, 27,
27, 1, 20, 21, 21, 21, 47, 48,
21, 21, 49, 50, 21, 50, 1, 20,
21, 21, 21, 47, 21, 21, 21, 50,
50, 21, 50, 1, 20, 21, 21, 21,
47, 51, 21, 21, 50, 50, 21, 50,
1, 20, 21, 21, 21, 21, 21, 21,
50, 52, 21, 52, 1, 20, 21, 21,
21, 53, 54, 55, 21, 21, 52, 52,
21, 52, 1, 20, 21, 21, 21, 53,
21, 21, 21, 52, 52, 21, 52, 1,
20, 21, 21, 21, 55, 21, 21, 21,
50, 52, 21, 52, 1, 56, 1, 20,
56, 1, 20, 21, 21, 21, 21, 21,
21, 57, 52, 21, 52, 1, 20, 21,
21, 21, 47, 58, 21, 21, 59, 50,
21, 50, 1, 20, 21, 21, 21, 21,
21, 21, 60, 52, 21, 52, 1, 20,
21, 21, 21, 47, 61, 21, 21, 62,
50, 21, 50, 1, 20, 21, 21, 21,
21, 21, 21, 63, 52, 21, 52, 1,
20, 21, 21, 21, 47, 51, 55, 21,
21, 64, 50, 21, 50, 1, 20, 21,
21, 21, 47, 51, 55, 21, 21, 65,
50, 21, 50, 1, 20, 21, 21, 21,
47, 51, 55, 21, 21, 50, 50, 21,
50, 1, 20, 21, 21, 21, 47, 61,
21, 21, 66, 50, 21, 50, 1, 20,
21, 21, 21, 47, 61, 21, 21, 50,
50, 21, 50, 1, 20, 21, 21, 21,
47, 58, 21, 21, 67, 50, 21, 50,
1, 20, 21, 21, 21, 47, 58, 21,
21, 50, 50, 21, 50, 1, 20, 21,
21, 21, 47, 48, 21, 21, 68, 50,
21, 50, 1, 20, 21, 21, 21, 47,
48, 21, 21, 50, 50, 21, 50, 1,
70, 69, 69, 69, 1, 72, 73, 71,
71, 71, 1, 72, 73, 74, 74, 74,
1, 72, 73, 75, 75, 75, 1, 72,
73, 1, 77, 76, 69, 69, 1, 78,
72, 73, 79, 71, 71, 1, 80, 1,
81, 82, 1, 83, 1, 84, 85, 1,
86, 1, 73, 87, 1, 73, 88, 1,
73, 1, 20, 55, 1, 84, 89, 1,
84, 1, 81, 90, 1, 81, 1, 78,
72, 73, 91, 74, 74, 1, 78, 72,
73, 75, 75, 75, 1, 93, 73, 92,
92, 92, 1, 95, 73, 94, 94, 94,
1, 95, 73, 96, 96, 96, 1, 95,
73, 97, 97, 97, 1, 95, 73, 1,
98, 92, 92, 1, 78, 95, 73, 99,
94, 94, 1, 78, 95, 73, 100, 96,
96, 1, 78, 95, 73, 97, 97, 97,
1, 101, 1, 78, 102, 1, 78, 103,
1, 78, 1, 77, 1, 1, 0
};
static const char _tsip_machine_parser_header_Warning_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 13, 11, 12, 14, 15, 16,
17, 38, 42, 61, 18, 17, 19, 20,
23, 19, 20, 23, 21, 22, 24, 25,
26, 27, 28, 29, 31, 37, 30, 32,
36, 9, 32, 33, 34, 35, 97, 39,
47, 59, 40, 41, 42, 43, 44, 45,
46, 48, 49, 57, 50, 51, 55, 52,
53, 54, 56, 58, 60, 62, 96, 63,
66, 76, 64, 65, 67, 83, 68, 81,
69, 70, 79, 71, 72, 77, 73, 74,
75, 78, 80, 82, 84, 92, 85, 88,
86, 87, 89, 90, 91, 93, 94, 95
};
static const char _tsip_machine_parser_header_Warning_trans_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 9, 0, 0, 0, 0, 5,
1, 1, 1, 1, 3, 0, 1, 1,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 12,
12, 12, 0, 0, 0, 0, 7, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
static const int tsip_machine_parser_header_Warning_start = 1;
static const int tsip_machine_parser_header_Warning_first_final = 97;
static const int tsip_machine_parser_header_Warning_error = 0;
static const int tsip_machine_parser_header_Warning_en_main = 1;
/* #line 137 "tsip_parser_header_Warning.rl" */
/* #line 349 "../src/headers/tsip_header_Warning.c" */
{
cs = tsip_machine_parser_header_Warning_start;
}
/* #line 138 "tsip_parser_header_Warning.rl" */
/* #line 356 "../src/headers/tsip_header_Warning.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_Warning_trans_keys + _tsip_machine_parser_header_Warning_key_offsets[cs];
_trans = _tsip_machine_parser_header_Warning_index_offsets[cs];
_klen = _tsip_machine_parser_header_Warning_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_Warning_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_Warning_indicies[_trans];
cs = _tsip_machine_parser_header_Warning_trans_targs[_trans];
if ( _tsip_machine_parser_header_Warning_trans_actions[_trans] == 0 )
goto _again;
_acts = _tsip_machine_parser_header_Warning_actions + _tsip_machine_parser_header_Warning_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 0:
/* #line 53 "tsip_parser_header_Warning.rl" */
{
tag_start = p;
}
break;
case 1:
/* #line 58 "tsip_parser_header_Warning.rl" */
{
if(!curr_warning)
{
curr_warning = TSIP_HEADER_WARNING_CREATE();
}
}
break;
case 2:
/* #line 66 "tsip_parser_header_Warning.rl" */
{
if(curr_warning)
{
TSK_PARSER_SET_STRING(curr_warning->agent);
}
}
break;
case 3:
/* #line 74 "tsip_parser_header_Warning.rl" */
{
if(curr_warning)
{
TSK_PARSER_SET_STRING(curr_warning->text);
}
}
break;
case 4:
/* #line 82 "tsip_parser_header_Warning.rl" */
{
if(curr_warning)
{
TSK_PARSER_SET_INTEGER(curr_warning->code);
}
}
break;
case 5:
/* #line 90 "tsip_parser_header_Warning.rl" */
{
if(curr_warning)
{
tsk_list_push_back_data(hdr_warnings, ((void**) &curr_warning));
}
}
break;
case 6:
/* #line 98 "tsip_parser_header_Warning.rl" */
{
}
break;
/* #line 486 "../src/headers/tsip_header_Warning.c" */
}
}
_again:
if ( cs == 0 )
goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
/* #line 139 "tsip_parser_header_Warning.rl" */
if( cs <
/* #line 502 "../src/headers/tsip_header_Warning.c" */
97
/* #line 140 "tsip_parser_header_Warning.rl" */
)
{
TSK_OBJECT_SAFE_FREE(curr_warning);
TSK_OBJECT_SAFE_FREE(hdr_warnings);
}
return hdr_warnings;
}
//========================================================
// 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;
if(Warning)
{
TSIP_HEADER(Warning)->type = tsip_htype_Warning;
TSIP_HEADER(Warning)->tostring = tsip_header_Warning_tostring;
Warning->code = -1;
}
else
{
TSK_DEBUG_ERROR("Failed to create new Warning header.");
}
return self;
}
/**@ingroup tsip_header_Warning_group
*/
static void* tsip_header_Warning_destroy(void *self)
{
tsip_header_Warning_t *Warning = self;
if(Warning)
{
TSK_FREE(Warning->agent);
TSK_FREE(Warning->text);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Warning));
}
else TSK_DEBUG_ERROR("Null Warning header.");
return self;
}
static const tsk_object_def_t tsip_header_Warning_def_s =
{
sizeof(tsip_header_Warning_t),
tsip_header_Warning_create,
tsip_header_Warning_destroy,
0
};
const void *tsip_header_Warning_def_t = &tsip_header_Warning_def_s;

View File

@ -37,12 +37,16 @@
#include "tinysip/headers/tsip_header_Call_ID.h"
#include "tinysip/headers/tsip_header_Contact.h"
#include "tinysip/headers/tsip_header_CSeq.h"
#include "tinysip/headers/tsip_header_Event.h"
#include "tinysip/headers/tsip_header_Expires.h"
#include "tinysip/headers/tsip_header_From.h"
#include "tinysip/headers/tsip_header_Max_Forwards.h"
#include "tinysip/headers/tsip_header_Min_Expires.h"
#include "tinysip/headers/tsip_header_Path.h"
#include "tinysip/headers/tsip_header_P_Access_Network_Info.h"
#include "tinysip/headers/tsip_header_P_Asserted_Identity.h"
#include "tinysip/headers/tsip_header_P_Associated_URI.h"
#include "tinysip/headers/tsip_header_P_Charging_Function_Addresses.h"
#include "tinysip/headers/tsip_header_P_Preferred_Identity.h"
#include "tinysip/headers/tsip_header_Privacy.h"
#include "tinysip/headers/tsip_header_Proxy_Authenticate.h"
@ -50,20 +54,44 @@
#include "tinysip/headers/tsip_header_Record_Route.h"
#include "tinysip/headers/tsip_header_Require.h"
#include "tinysip/headers/tsip_header_Route.h"
#include "tinysip/headers/tsip_header_Server.h"
#include "tinysip/headers/tsip_header_Service_Route.h"
#include "tinysip/headers/tsip_header_Supported.h"
#include "tinysip/headers/tsip_header_To.h"
#include "tinysip/headers/tsip_header_User_Agent.h"
#include "tinysip/headers/tsip_header_Via.h"
#include "tinysip/headers/tsip_header_Warning.h"
#include "tinysip/headers/tsip_header_WWW_Authenticate.h"
#include "tsk_debug.h"
#undef ADD_HEADERS
#undef ADD_HEADER
#define ADD_HEADERS(headers)\
if(headers)\
{\
tsk_list_item_t *item;\
tsk_list_foreach(item, headers)\
{\
tsip_header_t *hdr = tsk_object_ref(item->data);\
tsk_list_push_back_data(message->headers, ((void**) &hdr));\
}\
\
TSK_OBJECT_SAFE_FREE(headers);\
}
#define ADD_HEADER(header)\
if(header)\
{\
tsk_list_push_back_data(message->headers, ((void**) &header));\
}
/***********************************
* Ragel state machine.
*/
/* #line 775 "tsip_parser_header.rl" */
/* #line 720 "tsip_parser_header.rl" */
TSIP_BOOLEAN tsip_header_parse(tsk_ragel_state_t *state, tsip_message_t *message)
@ -74,7 +102,7 @@ TSIP_BOOLEAN tsip_header_parse(tsk_ragel_state_t *state, tsip_message_t *message
const char *eof = pe;
/* #line 78 "../src/parsers/tsip_parser_header.c" */
/* #line 106 "../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,
@ -2135,16 +2163,16 @@ static const int tsip_machine_parser_headers_error = 0;
static const int tsip_machine_parser_headers_en_main = 1;
/* #line 785 "tsip_parser_header.rl" */
/* #line 730 "tsip_parser_header.rl" */
/* #line 2141 "../src/parsers/tsip_parser_header.c" */
/* #line 2169 "../src/parsers/tsip_parser_header.c" */
{
cs = tsip_machine_parser_headers_start;
}
/* #line 786 "tsip_parser_header.rl" */
/* #line 731 "tsip_parser_header.rl" */
/* #line 2148 "../src/parsers/tsip_parser_header.c" */
/* #line 2176 "../src/parsers/tsip_parser_header.c" */
{
int _klen;
unsigned int _trans;
@ -2218,79 +2246,70 @@ _match:
switch ( *_acts++ )
{
case 0:
/* #line 69 "tsip_parser_header.rl" */
/* #line 97 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Accept NOT IMPLEMENTED");
}
break;
case 1:
/* #line 75 "tsip_parser_header.rl" */
/* #line 103 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Accept_Contact NOT IMPLEMENTED");
}
break;
case 2:
/* #line 81 "tsip_parser_header.rl" */
/* #line 109 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Accept_Encoding NOT IMPLEMENTED");
}
break;
case 3:
/* #line 87 "tsip_parser_header.rl" */
/* #line 115 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Accept_Language NOT IMPLEMENTED");
}
break;
case 4:
/* #line 93 "tsip_parser_header.rl" */
/* #line 121 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Accept_Resource_Priority NOT IMPLEMENTED");
}
break;
case 5:
/* #line 99 "tsip_parser_header.rl" */
/* #line 127 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Alert_Info NOT IMPLEMENTED");
}
break;
case 6:
/* #line 105 "tsip_parser_header.rl" */
/* #line 133 "tsip_parser_header.rl" */
{
tsip_header_Allow_t *header = tsip_header_Allow_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 7:
/* #line 115 "tsip_parser_header.rl" */
/* #line 140 "tsip_parser_header.rl" */
{
tsip_header_Allow_Events_t *header = tsip_header_Allow_Events_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 8:
/* #line 125 "tsip_parser_header.rl" */
/* #line 147 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Authentication_Info NOT IMPLEMENTED");
}
break;
case 9:
/* #line 131 "tsip_parser_header.rl" */
/* #line 153 "tsip_parser_header.rl" */
{
tsip_header_Authorization_t *header = tsip_header_Authorization_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 10:
/* #line 141 "tsip_parser_header.rl" */
/* #line 160 "tsip_parser_header.rl" */
{
if(!message->Call_ID)
{
@ -2299,55 +2318,38 @@ _match:
}
break;
case 11:
/* #line 150 "tsip_parser_header.rl" */
/* #line 169 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Call_Info NOT IMPLEMENTED");
}
break;
case 12:
/* #line 156 "tsip_parser_header.rl" */
/* #line 175 "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)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Contact_t *hdr = tsk_object_ref(item->data);
if(!message->Contact)
{
message->Contact = hdr;
}
else
{
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
}
TSK_OBJECT_SAFE_FREE(headers);
}
ADD_HEADERS(headers);
}
break;
case 13:
/* #line 180 "tsip_parser_header.rl" */
/* #line 182 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Content_Disposition NOT IMPLEMENTED");
}
break;
case 14:
/* #line 186 "tsip_parser_header.rl" */
/* #line 188 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("PARSE_HEADER_ACCEPT NOT IMPLEMENTED");
}
break;
case 15:
/* #line 192 "tsip_parser_header.rl" */
/* #line 194 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Content_Language NOT IMPLEMENTED");
}
break;
case 16:
/* #line 198 "tsip_parser_header.rl" */
/* #line 200 "tsip_parser_header.rl" */
{
if(!message->Content_Length)
{
@ -2356,7 +2358,7 @@ _match:
}
break;
case 17:
/* #line 207 "tsip_parser_header.rl" */
/* #line 209 "tsip_parser_header.rl" */
{
if(!message->Content_Type)
{
@ -2365,7 +2367,7 @@ _match:
}
break;
case 18:
/* #line 216 "tsip_parser_header.rl" */
/* #line 218 "tsip_parser_header.rl" */
{
if(!message->CSeq)
{
@ -2374,25 +2376,26 @@ _match:
}
break;
case 19:
/* #line 225 "tsip_parser_header.rl" */
/* #line 227 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Date NOT IMPLEMENTED");
}
break;
case 20:
/* #line 231 "tsip_parser_header.rl" */
/* #line 233 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Error_Info NOT IMPLEMENTED");
}
break;
case 21:
/* #line 237 "tsip_parser_header.rl" */
/* #line 239 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Event NOT IMPLEMENTED");
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 243 "tsip_parser_header.rl" */
/* #line 246 "tsip_parser_header.rl" */
{
if(!message->Expires)
{
@ -2401,7 +2404,7 @@ _match:
}
break;
case 23:
/* #line 252 "tsip_parser_header.rl" */
/* #line 255 "tsip_parser_header.rl" */
{
if(!message->From)
{
@ -2410,43 +2413,40 @@ _match:
}
break;
case 24:
/* #line 261 "tsip_parser_header.rl" */
/* #line 264 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_History_Info NOT IMPLEMENTED");
}
break;
case 25:
/* #line 267 "tsip_parser_header.rl" */
/* #line 270 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Identity NOT IMPLEMENTED");
}
break;
case 26:
/* #line 273 "tsip_parser_header.rl" */
/* #line 276 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Identity_Info NOT IMPLEMENTED");
}
break;
case 27:
/* #line 279 "tsip_parser_header.rl" */
/* #line 282 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_In_Reply_To NOT IMPLEMENTED");
}
break;
case 28:
/* #line 285 "tsip_parser_header.rl" */
/* #line 288 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Join NOT IMPLEMENTED");
}
break;
case 29:
/* #line 291 "tsip_parser_header.rl" */
/* #line 294 "tsip_parser_header.rl" */
{
tsip_header_Max_Forwards_t *header = tsip_header_Max_Forwards_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 30:
@ -2459,265 +2459,237 @@ _match:
/* #line 307 "tsip_parser_header.rl" */
{
tsip_header_Min_Expires_t *header = tsip_header_Min_Expires_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 32:
/* #line 317 "tsip_parser_header.rl" */
/* #line 314 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Min_SE NOT IMPLEMENTED");
}
break;
case 33:
/* #line 323 "tsip_parser_header.rl" */
/* #line 320 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Organization NOT IMPLEMENTED");
}
break;
case 34:
/* #line 329 "tsip_parser_header.rl" */
/* #line 326 "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));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 35:
/* #line 339 "tsip_parser_header.rl" */
/* #line 333 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Answer_State NOT IMPLEMENTED");
}
break;
case 36:
/* #line 345 "tsip_parser_header.rl" */
/* #line 339 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Asserted_Identity NOT IMPLEMENTED");
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 351 "tsip_parser_header.rl" */
/* #line 346 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Associated_URI NOT IMPLEMENTED");
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 357 "tsip_parser_header.rl" */
/* #line 353 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Called_Party_ID NOT IMPLEMENTED");
}
break;
case 39:
/* #line 363 "tsip_parser_header.rl" */
/* #line 359 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Charging_Function_Addresses NOT IMPLEMENTED");
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 369 "tsip_parser_header.rl" */
/* #line 366 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Charging_Vector NOT IMPLEMENTED");
}
break;
case 41:
/* #line 375 "tsip_parser_header.rl" */
/* #line 372 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_DCS_Billing_Info NOT IMPLEMENTED");
}
break;
case 42:
/* #line 381 "tsip_parser_header.rl" */
/* #line 378 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_DCS_LAES NOT IMPLEMENTED");
}
break;
case 43:
/* #line 387 "tsip_parser_header.rl" */
/* #line 384 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_DCS_OSPS NOT IMPLEMENTED");
}
break;
case 44:
/* #line 393 "tsip_parser_header.rl" */
/* #line 390 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_DCS_Redirect NOT IMPLEMENTED");
}
break;
case 45:
/* #line 399 "tsip_parser_header.rl" */
/* #line 396 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_DCS_Trace_Party_ID NOT IMPLEMENTED");
}
break;
case 46:
/* #line 405 "tsip_parser_header.rl" */
/* #line 402 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Early_Media NOT IMPLEMENTED");
}
break;
case 47:
/* #line 411 "tsip_parser_header.rl" */
/* #line 408 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Media_Authorization NOT IMPLEMENTED");
}
break;
case 48:
/* #line 417 "tsip_parser_header.rl" */
/* #line 414 "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));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 49:
/* #line 427 "tsip_parser_header.rl" */
/* #line 421 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Profile_Key NOT IMPLEMENTED");
}
break;
case 50:
/* #line 433 "tsip_parser_header.rl" */
/* #line 427 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_User_Database NOT IMPLEMENTED");
}
break;
case 51:
/* #line 439 "tsip_parser_header.rl" */
/* #line 433 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Visited_Network_ID NOT IMPLEMENTED");
}
break;
case 52:
/* #line 445 "tsip_parser_header.rl" */
/* #line 439 "tsip_parser_header.rl" */
{
tsip_header_Paths_L_t* headers = tsip_header_Path_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
ADD_HEADERS(headers);
}
break;
case 53:
/* #line 462 "tsip_parser_header.rl" */
/* #line 446 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Priority NOT IMPLEMENTED");
}
break;
case 54:
/* #line 468 "tsip_parser_header.rl" */
/* #line 452 "tsip_parser_header.rl" */
{
tsip_header_Privacy_t *header = tsip_header_Privacy_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 55:
/* #line 478 "tsip_parser_header.rl" */
/* #line 459 "tsip_parser_header.rl" */
{
tsip_header_Proxy_Authenticate_t *header = tsip_header_Proxy_Authenticate_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 56:
/* #line 488 "tsip_parser_header.rl" */
/* #line 466 "tsip_parser_header.rl" */
{
tsip_header_Proxy_Authorization_t *header = tsip_header_Proxy_Authorization_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 57:
/* #line 498 "tsip_parser_header.rl" */
/* #line 473 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Proxy_Require NOT IMPLEMENTED");
}
break;
case 58:
/* #line 504 "tsip_parser_header.rl" */
/* #line 479 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_RAck NOT IMPLEMENTED");
}
break;
case 59:
/* #line 510 "tsip_parser_header.rl" */
/* #line 485 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Reason NOT IMPLEMENTED");
}
break;
case 60:
/* #line 516 "tsip_parser_header.rl" */
/* #line 491 "tsip_parser_header.rl" */
{
tsip_header_Record_Route_t *header = tsip_header_Record_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 61:
/* #line 526 "tsip_parser_header.rl" */
/* #line 498 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Refer_Sub NOT IMPLEMENTED");
}
break;
case 62:
/* #line 532 "tsip_parser_header.rl" */
/* #line 504 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Refer_To NOT IMPLEMENTED");
}
break;
case 63:
/* #line 538 "tsip_parser_header.rl" */
/* #line 510 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Referred_By NOT IMPLEMENTED");
}
break;
case 64:
/* #line 544 "tsip_parser_header.rl" */
/* #line 516 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Reject_Contact NOT IMPLEMENTED");
}
break;
case 65:
/* #line 550 "tsip_parser_header.rl" */
/* #line 522 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Replaces NOT IMPLEMENTED");
}
break;
case 66:
/* #line 556 "tsip_parser_header.rl" */
/* #line 528 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Reply_To NOT IMPLEMENTED");
}
break;
case 67:
/* #line 562 "tsip_parser_header.rl" */
/* #line 534 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Request_Disposition NOT IMPLEMENTED");
}
break;
case 68:
/* #line 568 "tsip_parser_header.rl" */
/* #line 540 "tsip_parser_header.rl" */
{
tsip_header_Require_t *header = tsip_header_Require_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -2727,135 +2699,113 @@ _match:
}
break;
case 69:
/* #line 578 "tsip_parser_header.rl" */
/* #line 550 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Resource_Priority NOT IMPLEMENTED");
}
break;
case 70:
/* #line 584 "tsip_parser_header.rl" */
/* #line 556 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Retry_After NOT IMPLEMENTED");
}
break;
case 71:
/* #line 590 "tsip_parser_header.rl" */
/* #line 562 "tsip_parser_header.rl" */
{
tsip_header_Routes_L_t* headers = tsip_header_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
ADD_HEADERS(headers);
}
break;
case 72:
/* #line 607 "tsip_parser_header.rl" */
/* #line 569 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_RSeq NOT IMPLEMENTED");
}
break;
case 73:
/* #line 613 "tsip_parser_header.rl" */
/* #line 575 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Security_Client NOT IMPLEMENTED");
}
break;
case 74:
/* #line 619 "tsip_parser_header.rl" */
/* #line 581 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Security_Server NOT IMPLEMENTED");
}
break;
case 75:
/* #line 625 "tsip_parser_header.rl" */
/* #line 587 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Security_Verify NOT IMPLEMENTED");
}
break;
case 76:
/* #line 631 "tsip_parser_header.rl" */
/* #line 593 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Server NOT IMPLEMENTED");
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 637 "tsip_parser_header.rl" */
/* #line 600 "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));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Service_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
ADD_HEADERS(headers);
}
break;
case 78:
/* #line 654 "tsip_parser_header.rl" */
/* #line 607 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Session_Expires NOT IMPLEMENTED");
}
break;
case 79:
/* #line 660 "tsip_parser_header.rl" */
/* #line 613 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_SIP_ETag NOT IMPLEMENTED");
}
break;
case 80:
/* #line 666 "tsip_parser_header.rl" */
/* #line 619 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_SIP_If_Match NOT IMPLEMENTED");
}
break;
case 81:
/* #line 672 "tsip_parser_header.rl" */
/* #line 625 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Subject NOT IMPLEMENTED");
}
break;
case 82:
/* #line 678 "tsip_parser_header.rl" */
/* #line 631 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("PARSE_HEADER_ACCEPT NOT IMPLEMENTED");
}
break;
case 83:
/* #line 684 "tsip_parser_header.rl" */
/* #line 637 "tsip_parser_header.rl" */
{
tsip_header_Supported_t *header = tsip_header_Supported_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 84:
/* #line 694 "tsip_parser_header.rl" */
/* #line 644 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Target_Dialog NOT IMPLEMENTED");
}
break;
case 85:
/* #line 700 "tsip_parser_header.rl" */
/* #line 650 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Timestamp NOT IMPLEMENTED");
}
break;
case 86:
/* #line 706 "tsip_parser_header.rl" */
/* #line 656 "tsip_parser_header.rl" */
{
if(!message->To)
{
@ -2864,23 +2814,20 @@ _match:
}
break;
case 87:
/* #line 715 "tsip_parser_header.rl" */
/* #line 665 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Unsupported NOT IMPLEMENTED");
}
break;
case 88:
/* #line 721 "tsip_parser_header.rl" */
/* #line 671 "tsip_parser_header.rl" */
{
tsip_header_User_Agent_t *header = tsip_header_User_Agent_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
case 89:
/* #line 731 "tsip_parser_header.rl" */
/* #line 678 "tsip_parser_header.rl" */
{
if(!message->firstVia)
{
@ -2897,22 +2844,20 @@ _match:
}
break;
case 90:
/* #line 748 "tsip_parser_header.rl" */
/* #line 695 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Warning NOT IMPLEMENTED");
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 754 "tsip_parser_header.rl" */
/* #line 702 "tsip_parser_header.rl" */
{
tsip_header_WWW_Authenticate_t *header = tsip_header_WWW_Authenticate_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
{
tsk_list_push_back_data(message->headers, ((void**) &header));
}
ADD_HEADER(header);
}
break;
/* #line 2916 "../src/parsers/tsip_parser_header.c" */
/* #line 2861 "../src/parsers/tsip_parser_header.c" */
}
}
@ -2925,12 +2870,12 @@ _again:
_out: {}
}
/* #line 787 "tsip_parser_header.rl" */
/* #line 732 "tsip_parser_header.rl" */
return ( cs >=
/* #line 2932 "../src/parsers/tsip_parser_header.c" */
/* #line 2877 "../src/parsers/tsip_parser_header.c" */
1306
/* #line 788 "tsip_parser_header.rl" */
/* #line 733 "tsip_parser_header.rl" */
);
//return (cs == tsip_machine_parser_headers_first_final);
}

View File

@ -0,0 +1,627 @@
/*
* ex: set ro:
* DO NOT EDIT.
* generated by smc (http://smc.sourceforge.net/)
* from file : tsip_dialog_subscribe.sm
*/
/*
* 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_subscribe.sm.
* @brief SIP dialog SUBSCRIBE (RFC 2543).
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include <assert.h>
#include "tinysip/dialogs/tsip_dialog_subscribe.h"
#include "tsk_debug.h"
#include "tinySIP/smc/tsip_dialog_subscribe_sm.h"
#define getOwner(fsm) \
(fsm)->_owner
#define POPULATE_STATE(state) \
state##_Entry, \
state##_sm_1xx, \
state##_sm_2xx, \
state##_sm_300_to_699, \
state##_sm_401_407_421_494, \
state##_sm_423, \
state##_sm_NOTIFY, \
state##_sm_cancel, \
state##_sm_error, \
state##_sm_hangup, \
state##_sm_refresh, \
state##_sm_send, \
state##_sm_transportError, \
state##_sm_unsubscribe, \
state##_Default
#define ENTRY_STATE(state) \
if ((state)->Entry != NULL) { \
(state)->Entry(fsm); \
}
#define EXIT_STATE(state)
static void tsip_dialog_subscribeState_sm_1xx(struct tsip_dialog_subscribeContext *fsm, const tsip_message_t* msg)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_2xx(struct tsip_dialog_subscribeContext *fsm, int unsubscribeing, const tsip_response_t* response)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_300_to_699(struct tsip_dialog_subscribeContext *fsm, const tsip_response_t* response)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_401_407_421_494(struct tsip_dialog_subscribeContext *fsm, const tsip_response_t* response)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_423(struct tsip_dialog_subscribeContext *fsm, const tsip_response_t* response)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_NOTIFY(struct tsip_dialog_subscribeContext *fsm, int sterminated, const tsip_request_t* request)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_cancel(struct tsip_dialog_subscribeContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_error(struct tsip_dialog_subscribeContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_hangup(struct tsip_dialog_subscribeContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_refresh(struct tsip_dialog_subscribeContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_send(struct tsip_dialog_subscribeContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_transportError(struct tsip_dialog_subscribeContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_sm_unsubscribe(struct tsip_dialog_subscribeContext *fsm)
{
getState(fsm)->Default(fsm);
}
static void tsip_dialog_subscribeState_Default(struct tsip_dialog_subscribeContext *fsm)
{
State_Default(fsm);
}
#define tsip_dialog_subscribe_Started_sm_1xx tsip_dialog_subscribeState_sm_1xx
#define tsip_dialog_subscribe_Started_sm_2xx tsip_dialog_subscribeState_sm_2xx
#define tsip_dialog_subscribe_Started_sm_300_to_699 tsip_dialog_subscribeState_sm_300_to_699
#define tsip_dialog_subscribe_Started_sm_401_407_421_494 tsip_dialog_subscribeState_sm_401_407_421_494
#define tsip_dialog_subscribe_Started_sm_423 tsip_dialog_subscribeState_sm_423
#define tsip_dialog_subscribe_Started_sm_NOTIFY tsip_dialog_subscribeState_sm_NOTIFY
#define tsip_dialog_subscribe_Started_sm_cancel tsip_dialog_subscribeState_sm_cancel
#define tsip_dialog_subscribe_Started_sm_error tsip_dialog_subscribeState_sm_error
#define tsip_dialog_subscribe_Started_sm_hangup tsip_dialog_subscribeState_sm_hangup
#define tsip_dialog_subscribe_Started_sm_refresh tsip_dialog_subscribeState_sm_refresh
#define tsip_dialog_subscribe_Started_sm_send tsip_dialog_subscribeState_sm_send
#define tsip_dialog_subscribe_Started_sm_transportError tsip_dialog_subscribeState_sm_transportError
#define tsip_dialog_subscribe_Started_sm_unsubscribe tsip_dialog_subscribeState_sm_unsubscribe
#define tsip_dialog_subscribe_Started_Default tsip_dialog_subscribeState_Default
#define tsip_dialog_subscribe_Started_Entry NULL
#define tsip_dialog_subscribe_Started_Exit NULL
#define tsip_dialog_subscribe_Trying_sm_1xx tsip_dialog_subscribeState_sm_1xx
#define tsip_dialog_subscribe_Trying_sm_2xx tsip_dialog_subscribeState_sm_2xx
#define tsip_dialog_subscribe_Trying_sm_300_to_699 tsip_dialog_subscribeState_sm_300_to_699
#define tsip_dialog_subscribe_Trying_sm_401_407_421_494 tsip_dialog_subscribeState_sm_401_407_421_494
#define tsip_dialog_subscribe_Trying_sm_423 tsip_dialog_subscribeState_sm_423
#define tsip_dialog_subscribe_Trying_sm_NOTIFY tsip_dialog_subscribeState_sm_NOTIFY
#define tsip_dialog_subscribe_Trying_sm_cancel tsip_dialog_subscribeState_sm_cancel
#define tsip_dialog_subscribe_Trying_sm_error tsip_dialog_subscribeState_sm_error
#define tsip_dialog_subscribe_Trying_sm_hangup tsip_dialog_subscribeState_sm_hangup
#define tsip_dialog_subscribe_Trying_sm_refresh tsip_dialog_subscribeState_sm_refresh
#define tsip_dialog_subscribe_Trying_sm_send tsip_dialog_subscribeState_sm_send
#define tsip_dialog_subscribe_Trying_sm_transportError tsip_dialog_subscribeState_sm_transportError
#define tsip_dialog_subscribe_Trying_sm_unsubscribe tsip_dialog_subscribeState_sm_unsubscribe
#define tsip_dialog_subscribe_Trying_Default tsip_dialog_subscribeState_Default
#define tsip_dialog_subscribe_Trying_Entry NULL
#define tsip_dialog_subscribe_Trying_Exit NULL
#define tsip_dialog_subscribe_Connected_sm_1xx tsip_dialog_subscribeState_sm_1xx
#define tsip_dialog_subscribe_Connected_sm_2xx tsip_dialog_subscribeState_sm_2xx
#define tsip_dialog_subscribe_Connected_sm_300_to_699 tsip_dialog_subscribeState_sm_300_to_699
#define tsip_dialog_subscribe_Connected_sm_401_407_421_494 tsip_dialog_subscribeState_sm_401_407_421_494
#define tsip_dialog_subscribe_Connected_sm_423 tsip_dialog_subscribeState_sm_423
#define tsip_dialog_subscribe_Connected_sm_NOTIFY tsip_dialog_subscribeState_sm_NOTIFY
#define tsip_dialog_subscribe_Connected_sm_cancel tsip_dialog_subscribeState_sm_cancel
#define tsip_dialog_subscribe_Connected_sm_error tsip_dialog_subscribeState_sm_error
#define tsip_dialog_subscribe_Connected_sm_hangup tsip_dialog_subscribeState_sm_hangup
#define tsip_dialog_subscribe_Connected_sm_refresh tsip_dialog_subscribeState_sm_refresh
#define tsip_dialog_subscribe_Connected_sm_send tsip_dialog_subscribeState_sm_send
#define tsip_dialog_subscribe_Connected_sm_transportError tsip_dialog_subscribeState_sm_transportError
#define tsip_dialog_subscribe_Connected_sm_unsubscribe tsip_dialog_subscribeState_sm_unsubscribe
#define tsip_dialog_subscribe_Connected_Default tsip_dialog_subscribeState_Default
#define tsip_dialog_subscribe_Connected_Entry NULL
#define tsip_dialog_subscribe_Connected_Exit NULL
#define tsip_dialog_subscribe_Terminated_sm_1xx tsip_dialog_subscribeState_sm_1xx
#define tsip_dialog_subscribe_Terminated_sm_2xx tsip_dialog_subscribeState_sm_2xx
#define tsip_dialog_subscribe_Terminated_sm_300_to_699 tsip_dialog_subscribeState_sm_300_to_699
#define tsip_dialog_subscribe_Terminated_sm_401_407_421_494 tsip_dialog_subscribeState_sm_401_407_421_494
#define tsip_dialog_subscribe_Terminated_sm_423 tsip_dialog_subscribeState_sm_423
#define tsip_dialog_subscribe_Terminated_sm_NOTIFY tsip_dialog_subscribeState_sm_NOTIFY
#define tsip_dialog_subscribe_Terminated_sm_cancel tsip_dialog_subscribeState_sm_cancel
#define tsip_dialog_subscribe_Terminated_sm_error tsip_dialog_subscribeState_sm_error
#define tsip_dialog_subscribe_Terminated_sm_hangup tsip_dialog_subscribeState_sm_hangup
#define tsip_dialog_subscribe_Terminated_sm_refresh tsip_dialog_subscribeState_sm_refresh
#define tsip_dialog_subscribe_Terminated_sm_send tsip_dialog_subscribeState_sm_send
#define tsip_dialog_subscribe_Terminated_sm_transportError tsip_dialog_subscribeState_sm_transportError
#define tsip_dialog_subscribe_Terminated_sm_unsubscribe tsip_dialog_subscribeState_sm_unsubscribe
#define tsip_dialog_subscribe_Terminated_Default tsip_dialog_subscribeState_Default
#define tsip_dialog_subscribe_Terminated_Entry NULL
#define tsip_dialog_subscribe_Terminated_Exit NULL
#define tsip_dialog_subscribe_DefaultState_sm_1xx tsip_dialog_subscribeState_sm_1xx
#define tsip_dialog_subscribe_DefaultState_sm_2xx tsip_dialog_subscribeState_sm_2xx
#define tsip_dialog_subscribe_DefaultState_sm_300_to_699 tsip_dialog_subscribeState_sm_300_to_699
#define tsip_dialog_subscribe_DefaultState_sm_401_407_421_494 tsip_dialog_subscribeState_sm_401_407_421_494
#define tsip_dialog_subscribe_DefaultState_sm_423 tsip_dialog_subscribeState_sm_423
#define tsip_dialog_subscribe_DefaultState_sm_NOTIFY tsip_dialog_subscribeState_sm_NOTIFY
#define tsip_dialog_subscribe_DefaultState_sm_cancel tsip_dialog_subscribeState_sm_cancel
#define tsip_dialog_subscribe_DefaultState_sm_error tsip_dialog_subscribeState_sm_error
#define tsip_dialog_subscribe_DefaultState_sm_hangup tsip_dialog_subscribeState_sm_hangup
#define tsip_dialog_subscribe_DefaultState_sm_refresh tsip_dialog_subscribeState_sm_refresh
#define tsip_dialog_subscribe_DefaultState_sm_send tsip_dialog_subscribeState_sm_send
#define tsip_dialog_subscribe_DefaultState_sm_transportError tsip_dialog_subscribeState_sm_transportError
#define tsip_dialog_subscribe_DefaultState_sm_unsubscribe tsip_dialog_subscribeState_sm_unsubscribe
#undef tsip_dialog_subscribe_Started_sm_hangup
#define tsip_dialog_subscribe_Started_sm_hangup tsip_dialog_subscribe_DefaultState_sm_hangup
#undef tsip_dialog_subscribe_Trying_sm_hangup
#define tsip_dialog_subscribe_Trying_sm_hangup tsip_dialog_subscribe_DefaultState_sm_hangup
#undef tsip_dialog_subscribe_Connected_sm_hangup
#define tsip_dialog_subscribe_Connected_sm_hangup tsip_dialog_subscribe_DefaultState_sm_hangup
#undef tsip_dialog_subscribe_Terminated_sm_hangup
#define tsip_dialog_subscribe_Terminated_sm_hangup tsip_dialog_subscribe_DefaultState_sm_hangup
#undef tsip_dialog_subscribe_DefaultState_sm_hangup
static void tsip_dialog_subscribe_DefaultState_sm_hangup(struct tsip_dialog_subscribeContext *fsm)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_subscribe_Any_2_Trying_X_hangup(ctxt);
setState(fsm, &tsip_dialog_subscribe_Trying);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_subscribe_Started_sm_transportError
#define tsip_dialog_subscribe_Started_sm_transportError tsip_dialog_subscribe_DefaultState_sm_transportError
#undef tsip_dialog_subscribe_Trying_sm_transportError
#define tsip_dialog_subscribe_Trying_sm_transportError tsip_dialog_subscribe_DefaultState_sm_transportError
#undef tsip_dialog_subscribe_Connected_sm_transportError
#define tsip_dialog_subscribe_Connected_sm_transportError tsip_dialog_subscribe_DefaultState_sm_transportError
#undef tsip_dialog_subscribe_Terminated_sm_transportError
#define tsip_dialog_subscribe_Terminated_sm_transportError tsip_dialog_subscribe_DefaultState_sm_transportError
#undef tsip_dialog_subscribe_DefaultState_sm_transportError
static void tsip_dialog_subscribe_DefaultState_sm_transportError(struct tsip_dialog_subscribeContext *fsm)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_subscribe_Any_2_Terminated_X_transportError(ctxt);
setState(fsm, &tsip_dialog_subscribe_Terminated);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_subscribe_Started_sm_error
#define tsip_dialog_subscribe_Started_sm_error tsip_dialog_subscribe_DefaultState_sm_error
#undef tsip_dialog_subscribe_Trying_sm_error
#define tsip_dialog_subscribe_Trying_sm_error tsip_dialog_subscribe_DefaultState_sm_error
#undef tsip_dialog_subscribe_Connected_sm_error
#define tsip_dialog_subscribe_Connected_sm_error tsip_dialog_subscribe_DefaultState_sm_error
#undef tsip_dialog_subscribe_Terminated_sm_error
#define tsip_dialog_subscribe_Terminated_sm_error tsip_dialog_subscribe_DefaultState_sm_error
#undef tsip_dialog_subscribe_DefaultState_sm_error
static void tsip_dialog_subscribe_DefaultState_sm_error(struct tsip_dialog_subscribeContext *fsm)
{
EXIT_STATE(getState(fsm));
setState(fsm, &tsip_dialog_subscribe_Terminated);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_subscribe_Started_Default
#define tsip_dialog_subscribe_Started_Default tsip_dialog_subscribe_DefaultState_Default
#undef tsip_dialog_subscribe_Trying_Default
#define tsip_dialog_subscribe_Trying_Default tsip_dialog_subscribe_DefaultState_Default
#undef tsip_dialog_subscribe_Connected_Default
#define tsip_dialog_subscribe_Connected_Default tsip_dialog_subscribe_DefaultState_Default
#undef tsip_dialog_subscribe_Terminated_Default
#define tsip_dialog_subscribe_Terminated_Default tsip_dialog_subscribe_DefaultState_Default
#undef tsip_dialog_subscribe_DefaultState_Default
static void tsip_dialog_subscribe_DefaultState_Default(struct tsip_dialog_subscribeContext *fsm)
{
}
#undef tsip_dialog_subscribe_Started_Default
static void tsip_dialog_subscribe_Started_Default(struct tsip_dialog_subscribeContext *fsm)
{
}
#undef tsip_dialog_subscribe_Started_sm_send
static void tsip_dialog_subscribe_Started_sm_send(struct tsip_dialog_subscribeContext *fsm)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_subscribe_Started_2_Trying_X_send(ctxt);
setState(fsm, &tsip_dialog_subscribe_Trying);
ENTRY_STATE(getState(fsm));
}
const struct tsip_dialog_subscribeState tsip_dialog_subscribe_Started = { POPULATE_STATE(tsip_dialog_subscribe_Started), "tsip_dialog_subscribe_Started", 0 };
#undef tsip_dialog_subscribe_Trying_Default
static void tsip_dialog_subscribe_Trying_Default(struct tsip_dialog_subscribeContext *fsm)
{
}
#undef tsip_dialog_subscribe_Trying_sm_1xx
static void tsip_dialog_subscribe_Trying_sm_1xx(struct tsip_dialog_subscribeContext *fsm, const tsip_message_t* msg)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
const struct tsip_dialog_subscribeState* EndStateName = getState(fsm);
clearState(fsm);
tsip_dialog_subscribe_Trying_2_Trying_X_1xx(ctxt, msg);
setState(fsm, EndStateName);
}
#undef tsip_dialog_subscribe_Trying_sm_2xx
static void tsip_dialog_subscribe_Trying_sm_2xx(struct tsip_dialog_subscribeContext *fsm, int unsubscribeing, const tsip_response_t* response)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
if (unsubscribeing) {
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_subscribe_Trying_2_Terminated_X_2xx(ctxt, response);
setState(fsm, &tsip_dialog_subscribe_Terminated);
ENTRY_STATE(getState(fsm));
}
else if (!unsubscribeing) {
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_subscribe_Trying_2_Connected_X_2xx(ctxt, response);
setState(fsm, &tsip_dialog_subscribe_Connected);
ENTRY_STATE(getState(fsm));
} else {
tsip_dialog_subscribe_DefaultState_sm_2xx(fsm, unsubscribeing, response);
}
}
#undef tsip_dialog_subscribe_Trying_sm_300_to_699
static void tsip_dialog_subscribe_Trying_sm_300_to_699(struct tsip_dialog_subscribeContext *fsm, const tsip_response_t* response)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_subscribe_Trying_2_Terminated_X_300_to_699(ctxt, response);
setState(fsm, &tsip_dialog_subscribe_Terminated);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_subscribe_Trying_sm_401_407_421_494
static void tsip_dialog_subscribe_Trying_sm_401_407_421_494(struct tsip_dialog_subscribeContext *fsm, const tsip_response_t* response)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
const struct tsip_dialog_subscribeState* EndStateName = getState(fsm);
clearState(fsm);
tsip_dialog_subscribe_Trying_2_Trying_X_401_407_421_494(ctxt, response);
setState(fsm, EndStateName);
}
#undef tsip_dialog_subscribe_Trying_sm_423
static void tsip_dialog_subscribe_Trying_sm_423(struct tsip_dialog_subscribeContext *fsm, const tsip_response_t* response)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
const struct tsip_dialog_subscribeState* EndStateName = getState(fsm);
clearState(fsm);
tsip_dialog_subscribe_Trying_2_Trying_X_423(ctxt, response);
setState(fsm, EndStateName);
}
#undef tsip_dialog_subscribe_Trying_sm_NOTIFY
static void tsip_dialog_subscribe_Trying_sm_NOTIFY(struct tsip_dialog_subscribeContext *fsm, int sterminated, const tsip_request_t* request)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
const struct tsip_dialog_subscribeState* EndStateName = getState(fsm);
clearState(fsm);
tsip_dialog_subscribe_Trying_2_Trying_X_NOTIFY(ctxt, request);
setState(fsm, EndStateName);
}
#undef tsip_dialog_subscribe_Trying_sm_cancel
static void tsip_dialog_subscribe_Trying_sm_cancel(struct tsip_dialog_subscribeContext *fsm)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_subscribe_Trying_2_Terminated_X_cancel(ctxt);
setState(fsm, &tsip_dialog_subscribe_Terminated);
ENTRY_STATE(getState(fsm));
}
const struct tsip_dialog_subscribeState tsip_dialog_subscribe_Trying = { POPULATE_STATE(tsip_dialog_subscribe_Trying), "tsip_dialog_subscribe_Trying", 1 };
#undef tsip_dialog_subscribe_Connected_Default
static void tsip_dialog_subscribe_Connected_Default(struct tsip_dialog_subscribeContext *fsm)
{
}
#undef tsip_dialog_subscribe_Connected_sm_NOTIFY
static void tsip_dialog_subscribe_Connected_sm_NOTIFY(struct tsip_dialog_subscribeContext *fsm, int sterminated, const tsip_request_t* request)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
if (!sterminated) {
const struct tsip_dialog_subscribeState* EndStateName = getState(fsm);
clearState(fsm);
tsip_dialog_subscribe_Connected_2_Connected_X_NOTIFY(ctxt, request);
setState(fsm, EndStateName);
}
else if (sterminated) {
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_subscribe_Connected_2_Terminated_X_NOTIFY(ctxt, request);
setState(fsm, &tsip_dialog_subscribe_Terminated);
ENTRY_STATE(getState(fsm));
} else {
tsip_dialog_subscribe_DefaultState_sm_NOTIFY(fsm, sterminated, request);
}
}
#undef tsip_dialog_subscribe_Connected_sm_refresh
static void tsip_dialog_subscribe_Connected_sm_refresh(struct tsip_dialog_subscribeContext *fsm)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_subscribe_Connected_2_Trying_X_refresh(ctxt);
setState(fsm, &tsip_dialog_subscribe_Trying);
ENTRY_STATE(getState(fsm));
}
#undef tsip_dialog_subscribe_Connected_sm_unsubscribe
static void tsip_dialog_subscribe_Connected_sm_unsubscribe(struct tsip_dialog_subscribeContext *fsm)
{
struct tsip_dialog_subscribe* ctxt = getOwner(fsm);
EXIT_STATE(getState(fsm));
clearState(fsm);
tsip_dialog_subscribe_Connected_2_Trying_X_unsubscribe(ctxt);
setState(fsm, &tsip_dialog_subscribe_Trying);
ENTRY_STATE(getState(fsm));
}
const struct tsip_dialog_subscribeState tsip_dialog_subscribe_Connected = { POPULATE_STATE(tsip_dialog_subscribe_Connected), "tsip_dialog_subscribe_Connected", 2 };
#undef tsip_dialog_subscribe_Terminated_Entry
void tsip_dialog_subscribe_Terminated_Entry(struct tsip_dialog_subscribeContext *fsm)
{
struct tsip_dialog_subscribe *ctxt = getOwner(fsm);
tsip_dialog_subscribe_OnTerminated(ctxt);
}
#undef tsip_dialog_subscribe_Terminated_Default
static void tsip_dialog_subscribe_Terminated_Default(struct tsip_dialog_subscribeContext *fsm)
{
}
const struct tsip_dialog_subscribeState tsip_dialog_subscribe_Terminated = { POPULATE_STATE(tsip_dialog_subscribe_Terminated), "tsip_dialog_subscribe_Terminated", 3 };
void tsip_dialog_subscribeContext_Init(struct tsip_dialog_subscribeContext* fsm, struct tsip_dialog_subscribe* owner)
{
FSM_INIT(fsm, &tsip_dialog_subscribe_Started);
fsm->_owner = owner;
}
void tsip_dialog_subscribeContext_EnterStartState(struct tsip_dialog_subscribeContext* fsm)
{
ENTRY_STATE(getState(fsm));
}
void tsip_dialog_subscribeContext_sm_1xx(struct tsip_dialog_subscribeContext* fsm, const tsip_message_t* msg)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_1xx");
state->sm_1xx(fsm, msg);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_2xx(struct tsip_dialog_subscribeContext* fsm, int unsubscribeing, const tsip_response_t* response)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_2xx");
state->sm_2xx(fsm, unsubscribeing, response);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_300_to_699(struct tsip_dialog_subscribeContext* fsm, const tsip_response_t* response)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_300_to_699");
state->sm_300_to_699(fsm, response);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_401_407_421_494(struct tsip_dialog_subscribeContext* fsm, const tsip_response_t* response)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_401_407_421_494");
state->sm_401_407_421_494(fsm, response);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_423(struct tsip_dialog_subscribeContext* fsm, const tsip_response_t* response)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_423");
state->sm_423(fsm, response);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_NOTIFY(struct tsip_dialog_subscribeContext* fsm, int sterminated, const tsip_request_t* request)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_NOTIFY");
state->sm_NOTIFY(fsm, sterminated, request);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_cancel(struct tsip_dialog_subscribeContext* fsm)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_cancel");
state->sm_cancel(fsm);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_error(struct tsip_dialog_subscribeContext* fsm)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_error");
state->sm_error(fsm);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_hangup(struct tsip_dialog_subscribeContext* fsm)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_hangup");
state->sm_hangup(fsm);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_refresh(struct tsip_dialog_subscribeContext* fsm)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_refresh");
state->sm_refresh(fsm);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_send(struct tsip_dialog_subscribeContext* fsm)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_send");
state->sm_send(fsm);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_transportError(struct tsip_dialog_subscribeContext* fsm)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_transportError");
state->sm_transportError(fsm);
setTransition(fsm, NULL);
}
void tsip_dialog_subscribeContext_sm_unsubscribe(struct tsip_dialog_subscribeContext* fsm)
{
const struct tsip_dialog_subscribeState* state = getState(fsm);
assert(state != NULL);
setTransition(fsm, "sm_unsubscribe");
state->sm_unsubscribe(fsm);
setTransition(fsm, NULL);
}
/*
* Local variables:
* buffer-read-only: t
* End:
*/

View File

@ -29,8 +29,6 @@
*/
#include "tsip.h"
#include "tinysip/tsip_uri.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tinysip/transactions/tsip_transac_layer.h"
@ -442,6 +440,19 @@ int tsip_stack_set_callback_register(tsip_stack_handle_t *self, tsip_register_ca
return -1;
}
int tsip_stack_set_callback_subscribe(tsip_stack_handle_t *self, tsip_subscribe_callback callback)
{
if(self)
{
tsip_stack_t *stack = self;
stack->callback_subscribe = callback;
return 0;
}
return -1;
}
int tsip_stack_alert(const tsip_stack_handle_t *self, tsip_operation_id_t opid, short status_code, char *reason_phrase, int incoming, tsip_event_type_t type)
{
if(self)
@ -504,6 +515,7 @@ int tsip_stack_destroy(tsip_stack_handle_t *self)
TSK_OBJECT_SAFE_FREE(stack->service_routes);
TSK_OBJECT_SAFE_FREE(stack->paths);
TSK_OBJECT_SAFE_FREE(stack->associated_uris);
TSK_OBJECT_SAFE_FREE(stack->layer_dialog);
TSK_OBJECT_SAFE_FREE(stack->layer_transac);
@ -519,6 +531,42 @@ int tsip_stack_destroy(tsip_stack_handle_t *self)
return -1;
}
tsip_uri_t* tsip_stack_get_contacturi(const tsip_stack_handle_t *self, const char* protocol)
{
if(self)
{
const tsip_stack_t *stack = self;
tsk_list_item_t *item;
if(stack->layer_transport && stack->layer_transport->transports)
{
tsk_list_foreach(item, stack->layer_transport->transports)
{
tsip_transport_t *transport = item->data;
if(transport)
{
if(tsk_strequals(transport->protocol, protocol))
{
tnet_ip_t ip;
tnet_port_t port;
if(!tsip_transport_get_ip_n_port(transport, &ip, &port))
{
tsip_uri_t* uri = TSIP_URI_CREATE(tsk_striequals(protocol, "tls") ? uri_sips : uri_sip);
uri->host = tsk_strdup(ip);
uri->port = port;
uri->host_type = host_ipv4; // FIXME
uri->user_name = tsk_strdup(stack->public_identity->user_name);
return uri;
}
}
}
}
}
}
return 0;
}
const tsk_timer_manager_handle_t* tsip_stack_get_timer_mgr(const tsip_stack_handle_t *self)
{
@ -588,17 +636,23 @@ void *run(void* self)
{
if(stack->callback_register){
stack->callback_register(TSIP_REGISTER_EVENT(sipevent));
break;
}
else if(stack->callback){
stack->callback(sipevent);
}
case tsip_event_subscribe:
{
if(stack->callback_subscribe){
stack->callback_subscribe(TSIP_SUBSCRIBE_EVENT(sipevent));
break;
}
break;
}
default:
{
if(stack->callback){
stack->callback(sipevent);
}
break;
}
}

View File

@ -125,21 +125,77 @@ int tsip_message_add_headers(tsip_message_t *self, const tsip_headers_L_t *heade
const tsip_header_t *tsip_message_get_headerAt(const tsip_message_t *self, tsip_header_type_t type, size_t index)
{
size_t pos = 0;
tsk_list_item_t *item = 0;
tsk_list_item_t *item;
const tsip_header_t* hdr = 0;
if(self)
{
{
switch(type)
{
case tsip_htype_Via:
if(index == 0){
hdr = (const tsip_header_t*)self->firstVia;
goto bail;
}
case tsip_htype_From:
if(index == 0){
hdr = (const tsip_header_t*)self->From;
goto bail;
}else pos++;
case tsip_htype_To:
if(index == 0){
hdr = (const tsip_header_t*)self->To;
goto bail;
}else pos++;
case tsip_htype_Contact:
if(index == 0){
hdr = (const tsip_header_t*)self->Contact;
goto bail;
}else pos++;
case tsip_htype_Call_ID:
if(index == 0){
hdr = (const tsip_header_t*)self->Call_ID;
goto bail;
}else pos++;
case tsip_htype_CSeq:
if(index == 0){
hdr = (const tsip_header_t*)self->CSeq;
goto bail;
}else pos++;
case tsip_htype_Expires:
if(index == 0){
hdr = (const tsip_header_t*)self->Expires;
goto bail;
}else pos++;
case tsip_htype_Content_Type:
if(index == 0){
hdr = (const tsip_header_t*)self->Content_Type;
goto bail;
}else pos++;
case tsip_htype_Content_Length:
if(index == 0){
hdr = (const tsip_header_t*)self->Content_Length;
goto bail;
}else pos++;
default:
break;
}
tsk_list_foreach(item, self->headers)
{
if(!pred_find_header_by_type(item, &type))
{
if(pos++ >= index)
{
hdr = item->data;
break;
}
}
}
}
return item ? item->data : 0;
bail:
return hdr;
}
const tsip_header_t *tsip_message_get_header(const tsip_message_t *self, tsip_header_type_t type)
@ -332,7 +388,7 @@ tsip_request_t *tsip_request_new(const char* method, const tsip_uri_t *request_u
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_CALL_ID_VA_ARGS(call_id));
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_CSEQ_VA_ARGS(cseq, method));
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_MAX_FORWARDS_VA_ARGS(TSIP_HEADER_MAX_FORWARDS_DEFAULT));
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_USER_AGENT_VA_ARGS(TSIP_HEADER_USER_AGENT_DEFAULT));
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_USER_AGENT_VA_ARGS(/*TSIP_HEADER_USER_AGENT_DEFAULT*/"IM-client/OMA1.0 Mercuro-Gold/v4.0.1610.0"));
/*request->From = TSIP_HEADER_FROM_CREATE(0, from, 0);

View File

@ -63,7 +63,15 @@ tsip_operation_id_t tsip_operation_get_id(const tsip_operation_handle_t *self)
return TSIP_OPERATION_INVALID_ID;
}
const tsk_param_t* tsip_operation_get_param(const tsip_operation_handle_t *self, const char* pname)
{
if(self)
{
const tsip_operation_t *operation = self;
return tsk_params_get_param_by_name(operation->params, pname);
}
return 0;
}

View File

@ -98,12 +98,19 @@
"Route: <sip:pcscf.open-ims.test:4060;lr;transport=udp>,<sip:orig@scscf.open-ims.test:6060;lr>\r\n" \
"P-Preferred-Identity: <sip:bob@open-ims.test\r\n" \
"Allow-Events: presence, presence.winfo\r\n" \
"Event: reg\r\n" \
"P-Associated-URI: <sip:bob@open-ims.test>, <sip:0600000001@open-ims.test>, <sip:0100000001@open-ims.test>\r\n" \
"P-Charging-Function-Addresses: ccf=pri_ccf_address\r\n" \
"Server: Sip EXpress router (2.0.0-dev1 OpenIMSCore (i386/linux))\r\n" \
"Warning: 392 192.168.0.15:6060 \"Noisy feedback tells: pid=4521 req_src_ip=192.168.0.15 req_src_port=5060 in_uri=sip:scscf.open-ims.test:6060 out_uri=sip:scscf.open-ims.test:6060 via_cnt==3\"\r\n" \
"P-Asserted-Identity: \"Cullen Jennings\" <sip:fluffy@cisco.com>\r\n" \
"P-Asserted-Identity: tel:+14085264000\r\n" \
"Content-Length: 11\r\n" \
"\r\n" \
"How are you"
#define SIP_MSG_2_TEST SIP_RESPONSE
#define SIP_MSG_2_TEST SIP_MESSAGE
void test_parser()
{

View File

@ -44,6 +44,15 @@ int test_stack_callback(const tsip_event_t *sipevent)
return 0;
}
int tsip_subscribtion_callback(const tsip_subscribe_event_t *sipevent)
{
/* common part */
TSK_DEBUG_INFO("\n====\nSUBSCRIBTION event: %d [%s]\n=====", TSIP_EVENT(sipevent)->code, TSIP_EVENT(sipevent)->phrase);
/* registration part */
return 0;
}
int tsip_registration_callback(const tsip_register_event_t *sipevent)
{
/* common part */
@ -77,6 +86,7 @@ int tsip_registration_callback(const tsip_register_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"),
@ -92,7 +102,7 @@ void test_stack()
TSIP_STACK_SET_MOBILITY("fixed"),
TSIP_STACK_SET_DEVICE_ID("DD1289FA-C3D7-47bd-A40D-F1F1B2CC5FFC"),
TSIP_STACK_SET_NETINFO("ADSL;utran-cell-id-3gpp=00000000"),
*/
/*
tsip_stack_handle_t *stack = tsip_stack_create(test_stack_callback,
TSIP_STACK_SET_DISPLAY_NAME("Mamadou"),
@ -110,11 +120,26 @@ void test_stack()
TSIP_STACK_SET_DEVICE_ID("DD1289FA-C3D7-47bd-A40D-F1F1B2CC5FFC"),
TSIP_STACK_SET_NETINFO("ADSL;utran-cell-id-3gpp=00000000"),
*/
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"),
TSIP_STACK_SET_PRIVATE_IDENTITY("mamadou@ims.inexbee.com"),
TSIP_STACK_SET_PASSWORD("mamadou"),
TSIP_STACK_SET_REALM("sip:ims.inexbee.com"), // FIXME: without sip:
TSIP_STACK_SET_LOCAL_IP(LOCAL_IP),
//TSIP_STACK_SET_DISCOVERY_NAPTR(1),
TSIP_STACK_SET_PROXY_CSCF("192.168.16.225", "udp", 0),
//TSIP_STACK_SET_PROXY_CSCF("192.168.0.15", "udp", 0),
TSIP_STACK_SET_PROXY_CSCF_PORT(4060),
TSIP_STACK_SET_SEC_AGREE_MECH("ipsec-3gpp"),
TSIP_STACK_SET_MOBILITY("fixed"),
TSIP_STACK_SET_DEVICE_ID("DD1289FA-C3D7-47bd-A40D-F1F1B2CC5FFC"),
TSIP_STACK_SET_NETINFO("ADSL;utran-cell-id-3gpp=00000000"),
TSIP_STACK_SET_NULL());
tsip_operation_handle_t *op = TSIP_OPERATION_CREATE(stack,
TSIP_OPERATION_SET_PARAM("expires", "600000"),
TSIP_OPERATION_SET_PARAM("expires", "30"),
TSIP_OPERATION_SET_NULL());
@ -122,11 +147,24 @@ void test_stack()
/* Callbacks */
tsip_stack_set_callback_register(stack, tsip_registration_callback);
tsip_stack_set_callback_subscribe(stack, tsip_subscribtion_callback);
tsip_stack_start(stack);
tsip_register(stack, op);
tsk_thread_sleep(2000);
{
tsip_operation_handle_t *op2 = TSIP_OPERATION_CREATE(stack,
TSIP_OPERATION_SET_PARAM("expires", "30"),
TSIP_OPERATION_SET_PARAM("package", "reg"),
TSIP_OPERATION_SET_PARAM("accept", "application/reginfo+xml"),
TSIP_OPERATION_SET_NULL());
tsip_subscribe(stack, op2);
}
//while(1);//tsk_thread_sleep(500);
//while(1)
//tsk_thread_sleep(50000);

View File

@ -6,12 +6,14 @@
ProjectGUID="{B3E45009-C7C3-4090-837C-2D30C9058443}"
RootNamespace="tinyHTTP"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
@ -42,7 +44,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(DOUBANGO_HOME)\thirdparties\win32\include&quot;;&quot;$(DOUBANGO_HOME)\tinyHTTP\include&quot;;&quot;$(DOUBANGO_HOME)\tinySAK\src&quot;;&quot;$(DOUBANGO_HOME)\tinyNET\src&quot;"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_WINDOWS;_USRDLL;TINYHTTP_EXPORTS;_WIN32_WINNT 0x0501"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;TINYHTTP_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -65,8 +67,8 @@
AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
SubSystem="0"
TargetMachine="0"
/>
<Tool
Name="VCALinkTool"
@ -86,6 +88,9 @@
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
@ -161,10 +166,172 @@
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
OutputDirectory="&quot;$(SolutionDir)$(ConfigurationName)\wce&quot;"
IntermediateDirectory="&quot;$(SolutionDir)$(ConfigurationName)&quot;"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="1"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(DOUBANGO_HOME)\thirdparties\wince\include&quot;;&quot;$(DOUBANGO_HOME)\tinyHTTP\include&quot;;&quot;$(DOUBANGO_HOME)\tinySAK\src&quot;;&quot;$(DOUBANGO_HOME)\tinyNET\src&quot;"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;_WIN32_WCE=$(CEVER);UNDER_CE;$(ARCHFAM);$(_ARCHFAM_);WINCE;_DEBUG;TINYHTTP_EXPORTS"
MinimalRebuild="true"
ExceptionHandling="0"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="true"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions=" /subsystem:windowsce,5.01 /machine:THUMB"
AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="0"
TargetMachine="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
OutputDirectory="$(SolutionDir)Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="1"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TINYHTTP_EXPORTS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
</Configurations>
<References>
</References>
@ -181,7 +348,7 @@
>
</File>
<File
RelativePath="..\..\tinyHTTP\src\thttp_utl.c"
RelativePath="..\..\tinyHTTP\src\thttp_url.c"
>
</File>
<Filter
@ -195,10 +362,42 @@
<Filter
Name="headers"
>
<File
RelativePath="..\..\tinyHTTP\src\headers\thttp_header_Authorization.c"
>
</File>
<File
RelativePath="..\..\tinyHTTP\src\headers\thttp_header_Content_Length.c"
>
</File>
<File
RelativePath="..\..\tinyHTTP\src\headers\thttp_header_Content_Type.c"
>
</File>
<File
RelativePath="..\..\tinyHTTP\src\headers\thttp_header_Proxy_Authenticate.c"
>
</File>
<File
RelativePath="..\..\tinyHTTP\src\headers\thttp_header_WWW_Authenticate.c"
>
</File>
</Filter>
<Filter
Name="parsers"
>
<File
RelativePath="..\..\tinyHTTP\src\parsers\thttp_parser_header.c"
>
</File>
<File
RelativePath="..\..\tinyHTTP\src\parsers\thttp_parser_message.c"
>
</File>
<File
RelativePath="..\..\tinyHTTP\src\parsers\thttp_parser_url.c"
>
</File>
</Filter>
</Filter>
<Filter
@ -231,10 +430,46 @@
<Filter
Name="headers"
>
<File
RelativePath="..\..\tinyHTTP\include\tinyHTTP\headers\thttp_header.h"
>
</File>
<File
RelativePath="..\..\tinyHTTP\include\tinyHTTP\headers\thttp_header_Authorization.h"
>
</File>
<File
RelativePath="..\..\tinyHTTP\include\tinyHTTP\headers\thttp_header_Content_Length.h"
>
</File>
<File
RelativePath="..\..\tinyHTTP\include\tinyHTTP\headers\thttp_header_Content_Type.h"
>
</File>
<File
RelativePath="..\..\tinyHTTP\include\tinyHTTP\headers\thttp_header_Proxy_Authenticate.h"
>
</File>
<File
RelativePath="..\..\tinyHTTP\include\tinyHTTP\headers\thttp_header_WWW_Authenticate.h"
>
</File>
</Filter>
<Filter
Name="parsers"
>
<File
RelativePath="..\..\tinyHTTP\include\tinyHTTP\parsers\thttp_parser_header.h"
>
</File>
<File
RelativePath="..\..\tinyHTTP\include\tinyHTTP\parsers\thttp_parser_message.h"
>
</File>
<File
RelativePath="..\..\tinyHTTP\include\tinyHTTP\parsers\thttp_parser_url.h"
>
</File>
</Filter>
</Filter>
<Filter
@ -256,6 +491,46 @@
<Filter
Name="ragel"
>
<File
RelativePath="..\..\tinyHTTP\ragel\thttp_machine_header.rl"
>
</File>
<File
RelativePath="..\..\tinyHTTP\ragel\thttp_machine_message.rl"
>
</File>
<File
RelativePath="..\..\tinyHTTP\ragel\thttp_machine_utils.rl"
>
</File>
<File
RelativePath="..\..\tinyHTTP\ragel\thttp_parser_header.rl"
>
</File>
<File
RelativePath="..\..\tinyHTTP\ragel\thttp_parser_header_Authorization.rl"
>
</File>
<File
RelativePath="..\..\tinyHTTP\ragel\thttp_parser_header_Content_Length.rl"
>
</File>
<File
RelativePath="..\..\tinyHTTP\ragel\thttp_parser_header_Content_Type.rl"
>
</File>
<File
RelativePath="..\..\tinyHTTP\ragel\thttp_parser_header_WWW_Authenticate.rl"
>
</File>
<File
RelativePath="..\..\tinyHTTP\ragel\thttp_parser_message.rl"
>
</File>
<File
RelativePath="..\..\tinyHTTP\ragel\thttp_parser_url.rl"
>
</File>
</Filter>
</Files>
<Globals>

View File

@ -122,9 +122,10 @@
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(DOUBANGO_HOME)\thirdparties\win32\include&quot;;&quot;$(DOUBANGO_HOME)\tinySAK\src&quot;"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;TINYNET_EXPORTS;_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_)"
AdditionalIncludeDirectories="&quot;$(DOUBANGO_HOME)\tinyNET\src&quot;;&quot;$(DOUBANGO_HOME)\thirdparties\wince\include&quot;;&quot;$(DOUBANGO_HOME)\tinySAK\src&quot;"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;TINYNET_EXPORTS;_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(ARCHFAM);$(_ARCHFAM_);WINCE;DEBUG;_WINDOWS;_USRDLL"
MinimalRebuild="true"
ExceptionHandling="0"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="false"
UsePrecompiledHeader="0"
@ -144,7 +145,8 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2.lib $(OutDir)\tinySAK.lib"
AdditionalOptions=" /subsystem:windowsce,5.01 /machine:THUMB"
AdditionalDependencies="ws2.lib Iphlpapi.lib $(OutDir)\tinySAK.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="8"

View File

@ -122,11 +122,12 @@
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories="$(DOUBANGO_HOME)\thirdparties\wince\include"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;TINYSAK_EXPORTS;_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_)"
MinimalRebuild="true"
ExceptionHandling="0"
RuntimeLibrary="0"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="true"
@ -148,8 +149,8 @@
AdditionalDependencies="ws2.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="8"
TargetMachine="0"
SubSystem="9"
TargetMachine="16"
/>
<Tool
Name="VCALinkTool"
@ -420,6 +421,10 @@
RelativePath="..\..\tinySAK\src\tsk_ppfcs32.h"
>
</File>
<File
RelativePath="..\..\tinySAK\src\tsk_ragel_state.h"
>
</File>
<File
RelativePath="..\..\tinySAK\src\tsk_runnable.h"
>
@ -534,6 +539,10 @@
RelativePath="..\..\tinySAK\src\tsk_ppfcs32.c"
>
</File>
<File
RelativePath="..\..\tinySAK\src\tsk_ragel_state.c"
>
</File>
<File
RelativePath="..\..\tinySAK\src\tsk_runnable.c"
>

View File

@ -51,7 +51,7 @@ Global
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
{B3E45009-C7C3-4090-837C-2D30C9058443}.Debug|Win32.ActiveCfg = Debug|Win32
{B3E45009-C7C3-4090-837C-2D30C9058443}.Debug|Win32.Build.0 = Debug|Win32
{B3E45009-C7C3-4090-837C-2D30C9058443}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
{B3E45009-C7C3-4090-837C-2D30C9058443}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
{B3E45009-C7C3-4090-837C-2D30C9058443}.Release|Win32.ActiveCfg = Release|Win32
{B3E45009-C7C3-4090-837C-2D30C9058443}.Release|Win32.Build.0 = Release|Win32
{B3E45009-C7C3-4090-837C-2D30C9058443}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32

View File

@ -123,9 +123,10 @@
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(DOUBANGO_HOME)\thirdparties\wince\include\smc&quot;;&quot;$(DOUBANGO_HOME)\thirdparties\wince\include&quot;;&quot;$(DOUBANGO_HOME)\tinySIP\include&quot;;&quot;$(DOUBANGO_HOME)\tinySAK\src&quot;;&quot;$(DOUBANGO_HOME)\tinyNET\src&quot;"
AdditionalIncludeDirectories="&quot;$(DOUBANGO_HOME)\thirdparties\wince\include\smc&quot;;&quot;$(DOUBANGO_HOME)\thirdparties\wince\include&quot;;&quot;$(DOUBANGO_HOME)\tinySIP\include&quot;;&quot;$(DOUBANGO_HOME)\tinySAK\src&quot;;&quot;$(DOUBANGO_HOME)\tinyNET\src&quot;;&quot;$(DOUBANGO_HOME)\tinyHTTP\include&quot;"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;TINYSIP_EXPORTS;_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_)"
MinimalRebuild="true"
ExceptionHandling="0"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
@ -144,7 +145,8 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib"
AdditionalOptions=" /subsystem:windowsce,5.01 /machine:THUMB"
AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib $(OutDir)\tinyHTTP.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="8"
@ -761,10 +763,6 @@
RelativePath="..\..\tinySIP\src\parsers\tsip_parser_uri.c"
>
</File>
<File
RelativePath="..\..\tinySIP\src\parsers\tsip_ragel_state.c"
>
</File>
</Filter>
<Filter
Name="transactions"
@ -805,6 +803,10 @@
RelativePath="..\..\tinySIP\src\smc\tsip_dialog_register_sm.c"
>
</File>
<File
RelativePath="..\..\tinySIP\src\smc\tsip_dialog_subscribe_sm.c"
>
</File>
<File
RelativePath="..\..\tinySIP\src\smc\tsip_transac_ict_sm.c"
>
@ -1377,10 +1379,6 @@
RelativePath="..\..\tinySIP\include\tinysip\parsers\tsip_parser_uri.h"
>
</File>
<File
RelativePath="..\..\tinySIP\include\tinysip\parsers\tsip_ragel_state.h"
>
</File>
</Filter>
<Filter
Name="transactions"
@ -1421,6 +1419,10 @@
RelativePath="..\..\tinySIP\include\tinysip\smc\tsip_dialog_register_sm.h"
>
</File>
<File
RelativePath="..\..\tinySIP\include\tinysip\smc\tsip_dialog_subscribe_sm.h"
>
</File>
<File
RelativePath="..\..\tinySIP\include\tinysip\smc\tsip_transac_ict_sm.h"
>
@ -1930,6 +1932,10 @@
RelativePath="..\..\tinySIP\smc\tsip_dialog_register.sm"
>
</File>
<File
RelativePath="..\..\tinySIP\smc\tsip_dialog_subscribe.sm"
>
</File>
<File
RelativePath="..\..\tinySIP\smc\tsip_transac_ict.sm"
>