diff --git a/trunk/tinyNET/src/tnet_transport_win32.c b/trunk/tinyNET/src/tnet_transport_win32.c index cfa88643..6291d2b1 100644 --- a/trunk/tinyNET/src/tnet_transport_win32.c +++ b/trunk/tinyNET/src/tnet_transport_win32.c @@ -544,10 +544,10 @@ void *tnet_transport_mainthread(void *param) TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(transport), buffer); } } - - - - + + + + /*================== FD_WRITE ==================*/ if(networkEvents.lNetworkEvents & FD_WRITE) { diff --git a/trunk/tinySAK/src/tsk_buffer.c b/trunk/tinySAK/src/tsk_buffer.c index f096fec3..ec9724eb 100644 --- a/trunk/tinySAK/src/tsk_buffer.c +++ b/trunk/tinySAK/src/tsk_buffer.c @@ -142,7 +142,10 @@ int tsk_buffer_remove(tsk_buffer_t* self, size_t position, size_t size) { if(self) { - if((position + size) > self->size) + if((position == 0) && ((position + size) == self->size)){ /* Very common case. */ + return tsk_buffer_cleanup(self); + } + else if((position + size) < self->size) { size = self->size - position; memcpy(((uint8_t*)self->data) + position, ((uint8_t*)self->data) + position + size, diff --git a/trunk/tinySAK/src/tsk_memory.c b/trunk/tinySAK/src/tsk_memory.c index 7145e2cb..46665518 100644 --- a/trunk/tinySAK/src/tsk_memory.c +++ b/trunk/tinySAK/src/tsk_memory.c @@ -137,8 +137,7 @@ void* tsk_realloc (void* ptr, size_t size) void *ret = 0; ret = realloc(ptr, size); - if(!ret) - { + if(!ret){ TSK_DEBUG_ERROR("Memory reallocation failed"); } @@ -175,8 +174,7 @@ void tsk_free(void** ptr) void* tsk_calloc(size_t num, size_t size) { void* ret = calloc(num, size); - if(!ret) - { + if(!ret){ TSK_DEBUG_ERROR("Memory allocation failed. num=%u and size=%u", num, size); } diff --git a/trunk/tinySAK/src/tsk_object.c b/trunk/tinySAK/src/tsk_object.c index 4646fba2..74308f50 100644 --- a/trunk/tinySAK/src/tsk_object.c +++ b/trunk/tinySAK/src/tsk_object.c @@ -64,13 +64,11 @@ void* tsk_object_new(const tsk_object_def_t *objdef, ...) TSK_DEBUG_INFO("N° objects:%d", ++tsk_objects_count); #endif } - else - { + else{ TSK_DEBUG_WARN("No constructor found."); } } - else - { + else{ TSK_DEBUG_ERROR("Failed to create new tsk_object."); } @@ -88,13 +86,11 @@ void* tsk_object_new2(const tsk_object_def_t *objdef, va_list* ap) { newobj = objdef->constructor(newobj, ap); } - else - { + else{ TSK_DEBUG_WARN("No constructor found."); } } - else - { + else{ TSK_DEBUG_ERROR("Failed to create new tsk_object."); } @@ -104,12 +100,10 @@ void* tsk_object_new2(const tsk_object_def_t *objdef, va_list* ap) size_t tsk_object_sizeof(const void *self) { const tsk_object_def_t **objdef = self; - if(objdef && *objdef) - { + if(objdef && *objdef){ return (*objdef)->size; } - else - { + else{ TSK_DEBUG_ERROR("NULL tsk obkect."); return 0; } @@ -118,8 +112,8 @@ size_t tsk_object_sizeof(const void *self) int tsk_object_cmp(const void *self, const void *object) { const tsk_object_def_t **objdef = self; - if(objdef && *objdef && (*objdef)->objcmp) - { + + if(objdef && *objdef && (*objdef)->objcmp){ return (*objdef)->objcmp(self, object); } return -1; @@ -137,8 +131,7 @@ int tsk_object_cmp(const void *self, const void *object) void* tsk_object_ref(void *self) { - if(self) - { + if(self){ TSK_OBJECT_HEADER_GET(self)->refCount++; return self; } @@ -149,8 +142,7 @@ void* tsk_object_unref(void *self) { if(self) { - if(!--(TSK_OBJECT_HEADER_GET(self)->refCount)) - { + if(!--(TSK_OBJECT_HEADER_GET(self)->refCount)){ tsk_object_delete(self); return 0; } @@ -163,15 +155,13 @@ void tsk_object_delete(void *self) const tsk_object_def_t ** objdef = self; if(self && *objdef) { - if((*objdef)->destructor) - { + if((*objdef)->destructor){ self = (*objdef)->destructor(self); #if TSK_DEBUG_OBJECTS TSK_DEBUG_INFO("N° objects:%d", --tsk_objects_count); #endif } - else - { + else{ TSK_DEBUG_WARN("No destructor found."); } free(self); diff --git a/trunk/tinySAK/src/tsk_ragel_state.h b/trunk/tinySAK/src/tsk_ragel_state.h index 93a4243f..12ed8228 100644 --- a/trunk/tinySAK/src/tsk_ragel_state.h +++ b/trunk/tinySAK/src/tsk_ragel_state.h @@ -37,6 +37,13 @@ TSK_BEGIN_DECLS + +#if defined(_MSC_VER) +# define atoi64 _atoi64 +#else +# define atoi64 atoll +#endif + #define TSK_SCANNER_SET_STRING(string) \ if(!string) \ { \ @@ -66,17 +73,22 @@ TSK_BEGIN_DECLS } \ } -#define TSK_PARSER_SET_INTEGER(integer) \ +#define TSK_PARSER_SET_INTEGER_EX(retval, type, func) \ { \ int len = (int)(p - tag_start); \ if(len>=0) \ { \ char* tmp = tsk_calloc(len+1, sizeof(char)); \ memcpy(tmp, tag_start, len); \ - integer = atoi(tmp); \ + retval = (##type)##func(tmp); \ free(tmp); \ } \ } +#define TSK_PARSER_SET_INTEGER(retval) TSK_PARSER_SET_INTEGER_EX(retval, int, atoi) +#define TSK_PARSER_SET_INT(retval) TSK_PARSER_SET_INTEGER(retval) +#define TSK_PARSER_SET_UINT(retval) TSK_PARSER_SET_INTEGER_EX(retval, uint32_t, atoi64) +#define TSK_PARSER_SET_FLOAT(retval) TSK_PARSER_SET_INTEGER_EX(retval, float, atof) +#define TSK_PARSER_SET_DOUBLE(retval) TSK_PARSER_SET_INTEGER_EX(retval, double, atof) #define TSK_PARSER_ADD_PARAM(dest) \ { \ diff --git a/trunk/tinySAK/src/tsk_string.c b/trunk/tinySAK/src/tsk_string.c index 7491e375..35439ebe 100644 --- a/trunk/tinySAK/src/tsk_string.c +++ b/trunk/tinySAK/src/tsk_string.c @@ -156,16 +156,20 @@ char* tsk_strndup(const char *s1, size_t n) return ret; } -/**@ingroup tsk_string_group -* Checks if @ref str1 contains an occurrence of @ref str2. -* @param str1 The master. -* @param size The size of @b str1. -* @param str2 The string for which to search an occcurrence. -* @retval 1 if @ref str1 contains an occurrence of @ref str2 and Zero otherwise. -*/ -int tsk_strcontains(const char * str1, size_t size, const char * str2) +int tsk_strcontains(const char * str, size_t size, const char * sub_str) { - return ((str1 && str2) && (strstr(str1, str2) && strstr(str1, str2) < (str1 + size))); + return (tsk_strindexOf(str, size, sub_str) >= 0); +} + +int tsk_strindexOf(const char * str, size_t size, const char * sub_str) +{ + if(str && sub_str){ + const char* sub_start = strstr(str, sub_str); + if(sub_start && (sub_start < (str + size))){ + return (sub_start - str); + } + } + return -1; } /**@ingroup tsk_string_group diff --git a/trunk/tinySAK/src/tsk_string.h b/trunk/tinySAK/src/tsk_string.h index 96d49c0e..b488fd3c 100644 --- a/trunk/tinySAK/src/tsk_string.h +++ b/trunk/tinySAK/src/tsk_string.h @@ -52,7 +52,8 @@ TINYSAK_API int tsk_strcmp(const char * str1, const char * str2); TINYSAK_API int tsk_strncmp(const char * str1, const char * str2, size_t n); TINYSAK_API char* tsk_strdup(const char *s1); TINYSAK_API char* tsk_strndup(const char *s1, size_t n); -TINYSAK_API int tsk_strcontains(const char * str1, size_t size, const char * str2); +TINYSAK_API int tsk_strcontains(const char * str, size_t size, const char * sub_str); +TINYSAK_API int tsk_strindexOf(const char * str, size_t size, const char * sub_str); TINYSAK_API void tsk_strcat(char** destination, const char* source); TINYSAK_API void tsk_strncat(char** destination, const char* source, size_t n); TINYSAK_API int tsk_sprintf(char** str, const char* format, ...); diff --git a/trunk/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h b/trunk/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h index 6b73a15a..e39490b1 100644 --- a/trunk/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h +++ b/trunk/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h @@ -21,9 +21,7 @@ */ /**@file tsip_header_Security_Client.h - * @brief SIP header 'Security-Client'. - * - * @author Mamadou Diop + * @brief SIP header 'Security-Client' as per RFC 3329. * * @date Created: Sat Nov 8 16:54:58 2009 mdiop */ @@ -33,8 +31,18 @@ #include "tinysip_config.h" #include "tinysip/headers/tsip_header.h" +#include "tnet_types.h" + TSIP_BEGIN_DECLS +/**@def TSIP_HEADER_ROUTE_CREATE +* Creates new sip 'Security_Client' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header. +* @sa TSK_OBJECT_SAFE_FREE. +*/ +#define TSIP_HEADER_SECURITY_CLIENT_VA_ARGS() tsip_header_Security_Client_def_t +#define TSIP_HEADER_SECURITY_CLIENT_CREATE() tsk_object_new(TSIP_HEADER_SECURITY_CLIENT_VA_ARGS()) +#define TSIP_HEADER_SECURITY_CLIENT_CREATE_NULL() TSIP_HEADER_SECURITY_CLIENT_CREATE() + //////////////////////////////////////////////////////////////////////////////////////////////////// /// @struct /// @@ -42,15 +50,66 @@ TSIP_BEGIN_DECLS /// @author Mamadou /// @date 12/3/2009 /// -/// @par ABNF +/// @par ABNF : Security-Client = "Security-Client" HCOLON sec-mechanism *(COMMA sec-mechanism) +/// sec-mechanism = mechanism-name *( SEMI mech-parameters ) +/// mechanism-name = ( "digest" / "tls" / "ipsec-ike" / "ipsec-man" / token ) +/// mech-parameters = ( preference / digest-algorithm / digest-qop / digest-verify / mech-extension ) +/// preference = "q" EQUAL qvalue +/// digest-algorithm = "d-alg" EQUAL token +/// digest-qop = "d-qop" EQUAL token +/// digest-verify = "d-ver" EQUAL LDQUOT 32LHEX RDQUOT +/// mech-extension = generic-param +/// +/// mechanism-name = ( "ipsec-3gpp" ) +/// mech-parameters = ( algorithm / protocol /mode / +/// encrypt-algorithm / spi / +/// port1 / port2 ) +/// algorithm = "alg" EQUAL ( "hmac-md5-96" / +/// "hmac-sha-1-96" ) +/// protocol = "prot" EQUAL ( "ah" / "esp" ) +/// mode = "mod" EQUAL ( "trans" / "tun" ) +/// encrypt-algorithm = "ealg" EQUAL ( "des-ede3-cbc" / "null" ) +/// spi = "spi" EQUAL spivalue +/// spivalue = 10DIGIT; 0 to 4294967295 +/// port1 = "port1" EQUAL port +/// port2 = "port2" EQUAL port +/// port = 1*DIGIT +/// /// //////////////////////////////////////////////////////////////////////////////////////////////////// typedef struct tsip_header_Security_Client_s { TSIP_DECLARE_HEADER; + + //! sec-mechanism (e.g. "digest" / "tls" / "ipsec-3gpp") + char* mech; + //! algorithm (e.g. "hmac-md5-96" / "hmac-sha-1-96") + char* alg; + //! protocol (e.g. "ah" / "esp") + char* prot; + //! mode (e.g. "trans" / "tun") + char* mod; + //! encrypt-algorithm (e.g. "des-ede3-cbc" / "null") + char* ealg; + //! client port + tnet_port_t port_c; + //! server port + tnet_port_t port_s; + //! client spi + uint32_t spi_c; + //! server spi + uint32_t spi_s; + //! preference + double q; } tsip_header_Security_Client_t; +typedef tsk_list_t tsip_header_Security_Clients_L_t; + +tsip_header_Security_Clients_L_t *tsip_header_Security_Client_parse(const char *data, size_t size); + +TINYSIP_GEXTERN const void *tsip_header_Security_Client_def_t; + TSIP_END_DECLS #endif /* _TSIP_HEADER_SECURITY_CLIENT_H_ */ diff --git a/trunk/tinySIP/include/tinysip/parsers/tsip_parser_message.h b/trunk/tinySIP/include/tinysip/parsers/tsip_parser_message.h index 6de39f53..0c572f88 100644 --- a/trunk/tinySIP/include/tinysip/parsers/tsip_parser_message.h +++ b/trunk/tinySIP/include/tinysip/parsers/tsip_parser_message.h @@ -36,7 +36,7 @@ TSIP_BEGIN_DECLS -TINYSIP_API TSIP_BOOLEAN tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t **result); +TINYSIP_API TSIP_BOOLEAN tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t **result, TSIP_BOOLEAN extract_content); TSIP_END_DECLS diff --git a/trunk/tinySIP/include/tinysip/transactions/tsip_transac_layer.h b/trunk/tinySIP/include/tinysip/transactions/tsip_transac_layer.h index 3d6cb4e3..f86de7f0 100644 --- a/trunk/tinySIP/include/tinysip/transactions/tsip_transac_layer.h +++ b/trunk/tinySIP/include/tinysip/transactions/tsip_transac_layer.h @@ -48,6 +48,8 @@ typedef struct tsip_transac_layer_s const tsip_stack_handle_t *stack; + unsigned reliable:1; + tsip_transacs_L_t *transactions; TSK_DECLARE_SAFEOBJ; diff --git a/trunk/tinySIP/include/tinysip/transports/tsip_transport.h b/trunk/tinySIP/include/tinysip/transports/tsip_transport.h index 75de52f8..040b1a99 100644 --- a/trunk/tinySIP/include/tinysip/transports/tsip_transport.h +++ b/trunk/tinySIP/include/tinysip/transports/tsip_transport.h @@ -61,6 +61,8 @@ typedef struct tsip_transport_s const char *protocol; const char *via_protocol; const char *service; /**< NAPTR service name */ + + tsk_buffer_t *buff_stream; } tsip_transport_t; diff --git a/trunk/tinySIP/ragel.sh b/trunk/tinySIP/ragel.sh index 1b63435c..f8c6369f 100644 --- a/trunk/tinySIP/ragel.sh +++ b/trunk/tinySIP/ragel.sh @@ -5,7 +5,7 @@ export OPTIONS="-C -L -T0" #export OPTIONS="-C -L -G2" # SIP/SIPS/TEL URI parser -ragel.exe $OPTIONS -o ../src/parsers/tsip_parser_uri.c tsip_parser_uri.rl +#ragel.exe $OPTIONS -o ../src/parsers/tsip_parser_uri.c tsip_parser_uri.rl # SIP message (both requests an responses) parser. ragel.exe $OPTIONS -o ../src/parsers/tsip_parser_message.c tsip_parser_message.rl @@ -15,103 +15,106 @@ ragel.exe $OPTIONS -o ../src/parsers/tsip_parser_header.c tsip_parser_header.rl # ==Allow -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Allow.c tsip_parser_header_Allow.rl +##ragel.exe $OPTIONS -o ../src/headers/tsip_header_Allow.c tsip_parser_header_Allow.rl # ==Allow-Events -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Allow_Events.c tsip_parser_header_Allow_Events.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Allow_Events.c tsip_parser_header_Allow_Events.rl # ==Authorization -######ragel.exe $OPTIONS -o ../src/headers/tsip_header_Authorization.c tsip_parser_header_Authorization.rl +#######ragel.exe $OPTIONS -o ../src/headers/tsip_header_Authorization.c tsip_parser_header_Authorization.rl # ==Call-ID -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Call_ID.c tsip_parser_header_Call_ID.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Call_ID.c tsip_parser_header_Call_ID.rl # ==Content-Length -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Content_Length.c tsip_parser_header_Content_Length.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Content_Length.c tsip_parser_header_Content_Length.rl # ==Content-Type -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Content_Type.c tsip_parser_header_Content_Type.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Content_Type.c tsip_parser_header_Content_Type.rl # ==Contact -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Contact.c tsip_parser_header_Contact.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Contact.c tsip_parser_header_Contact.rl # ==CSeq -ragel.exe $OPTIONS -o ../src/headers/tsip_header_CSeq.c tsip_parser_header_CSeq.rl +#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 +#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 +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Expires.c tsip_parser_header_Expires.rl # ==From -ragel.exe $OPTIONS -o ../src/headers/tsip_header_From.c tsip_parser_header_From.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_From.c tsip_parser_header_From.rl # ==Max-Forwards -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Max_Forwards.c tsip_parser_header_Max_Forwards.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Max_Forwards.c tsip_parser_header_Max_Forwards.rl # ==Min-Expires -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Min_Expires.c tsip_parser_header_Min_Expires.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Min_Expires.c tsip_parser_header_Min_Expires.rl # ==Path -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Path.c tsip_parser_header_Path.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Path.c tsip_parser_header_Path.rl # ==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 +#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 +#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 +#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 +#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 +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_P_Preferred_Identity.c tsip_parser_header_P_Preferred_Identity.rl # ==Privacy -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Privacy.c tsip_parser_header_Privacy.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Privacy.c tsip_parser_header_Privacy.rl # ==Proxy-Authenticate -########ragel.exe $OPTIONS -o ../src/headers/tsip_header_Proxy_Authenticate.c tsip_parser_header_Proxy_Authenticate.rl +#########ragel.exe $OPTIONS -o ../src/headers/tsip_header_Proxy_Authenticate.c tsip_parser_header_Proxy_Authenticate.rl # ==Proxy-Authorization -#########ragel.exe $OPTIONS -o ../src/headers/tsip_header_Proxy_Authorization.c tsip_parser_header_Proxy_Authorization.rl +##########ragel.exe $OPTIONS -o ../src/headers/tsip_header_Proxy_Authorization.c tsip_parser_header_Proxy_Authorization.rl # ==Record-Route -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Record_Route.c tsip_parser_header_Record_Route.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Record_Route.c tsip_parser_header_Record_Route.rl # ==Require -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Require.c tsip_parser_header_Require.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Require.c tsip_parser_header_Require.rl # == Server -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Server.c tsip_parser_header_Server.rl +#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 +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Route.c tsip_parser_header_Route.rl + +# == Security-Client +ragel.exe $OPTIONS -o ../src/headers/tsip_header_Security_Client.c tsip_parser_header_Security_Client.rl # == Service-Route -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Service_Route.c tsip_parser_header_Service_Route.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Service_Route.c tsip_parser_header_Service_Route.rl # ==Subscription-State -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Subscription_State.c tsip_parser_header_Subscription_State.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Subscription_State.c tsip_parser_header_Subscription_State.rl # ==Supported -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Supported.c tsip_parser_header_Supported.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Supported.c tsip_parser_header_Supported.rl # ==To -ragel.exe $OPTIONS -o ../src/headers/tsip_header_To.c tsip_parser_header_To.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_To.c tsip_parser_header_To.rl # ==User-Agent -ragel.exe $OPTIONS -o ../src/headers/tsip_header_User_Agent.c tsip_parser_header_User_Agent.rl +#ragel.exe $OPTIONS -o ../src/headers/tsip_header_User_Agent.c tsip_parser_header_User_Agent.rl # ==Via -ragel.exe $OPTIONS -o ../src/headers/tsip_header_Via.c tsip_parser_header_Via.rl +#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 +#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 +##########ragel.exe $OPTIONS -o ../src/headers/tsip_header_WWW_Authenticate.c tsip_parser_header_WWW_Authenticate.rl diff --git a/trunk/tinySIP/ragel/tsip_parser_header.rl b/trunk/tinySIP/ragel/tsip_parser_header.rl index d2fc2e93..7a238124 100644 --- a/trunk/tinySIP/ragel/tsip_parser_header.rl +++ b/trunk/tinySIP/ragel/tsip_parser_header.rl @@ -52,6 +52,7 @@ #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_Security_Client.h" #include "tinysip/headers/tsip_header_Server.h" #include "tinysip/headers/tsip_header_Service_Route.h" #include "tinysip/headers/tsip_header_Subscription_State.h" @@ -589,7 +590,8 @@ # /*== Security_Client: ==*/ action parse_header_Security_Client { - TSK_DEBUG_ERROR("parse_header_Security_Client NOT IMPLEMENTED"); + tsip_header_Security_Clients_L_t* headers = tsip_header_Security_Client_parse(state->tag_start, (state->tag_end-state->tag_start)); + ADD_HEADERS(headers); } # /*== Security-Server: ==*/ diff --git a/trunk/tinySIP/ragel/tsip_parser_header_Security_Client.rl b/trunk/tinySIP/ragel/tsip_parser_header_Security_Client.rl index e69de29b..651ea929 100644 --- a/trunk/tinySIP/ragel/tsip_parser_header_Security_Client.rl +++ b/trunk/tinySIP/ragel/tsip_parser_header_Security_Client.rl @@ -0,0 +1,288 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Security_Client.c + * @brief SIP Security-Client header as per RFC 3329. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#include "tinysip/headers/tsip_header_Security_Client.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include + +/**@defgroup tsip_header_Security_Client_group SIP Security_Client header. +*/ + +/*********************************** +* Ragel state machine. +*/ +%%{ + machine tsip_machine_parser_header_Security_Client; + + # Includes + include tsip_machine_utils "./tsip_machine_utils.rl"; + + action tag + { + tag_start = p; + } + + action create_securityclient + { + if(!curr_securityclient) + { + curr_securityclient = TSIP_HEADER_SECURITY_CLIENT_CREATE_NULL(); + } + } + + action add_securityclient + { + if(curr_securityclient) + { + tsk_list_push_back_data(hdr_securityclients, ((void**) &curr_securityclient)); + } + } + + action parse_mech + { + if(curr_securityclient) + { + TSK_PARSER_SET_STRING(curr_securityclient->mech); + } + } + + action parse_port_s + { + if(curr_securityclient) + { + TSK_PARSER_SET_INT(curr_securityclient->port_s); + } + } + + action parse_port_c + { + if(curr_securityclient) + { + TSK_PARSER_SET_INT(curr_securityclient->port_c); + } + } + + action parse_spi_s + { + if(curr_securityclient) + { + TSK_PARSER_SET_UINT(curr_securityclient->spi_s); + } + } + + action parse_spi_c + { + if(curr_securityclient) + { + TSK_PARSER_SET_UINT(curr_securityclient->spi_c); + } + } + + action parse_ealg + { + if(curr_securityclient) + { + TSK_PARSER_SET_STRING(curr_securityclient->ealg); + } + } + + action parse_alg + { + if(curr_securityclient) + { + TSK_PARSER_SET_STRING(curr_securityclient->alg); + } + } + + action parse_preference + { + if(curr_securityclient) + { + TSK_PARSER_SET_DOUBLE(curr_securityclient->q); + } + } + + action parse_param + { + if(curr_securityclient) + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_securityclient)); + } + } + + + + action eob + { + } + + mech_extension = generic_param>tag %parse_param; + port_s = "port-s"i EQUAL DIGIT+>tag %parse_port_s; + port_c = "port-c"i EQUAL DIGIT+>tag %parse_port_c; + spi_s = "spi-s"i EQUAL DIGIT+>tag %parse_spi_s; + spi_c = "spi-c"i EQUAL DIGIT+>tag %parse_spi_c; + ealg = "ealg"i EQUAL token>tag %parse_ealg; + alg = "alg"i EQUAL token>tag %parse_alg; + preference = "q"i EQUAL qvalue>tag %parse_preference; + mech_parameters = (preference | alg | ealg | spi_c | spi_s | port_c | port_s) @1 | mech_extension @0; + mechanism_name = token>tag %parse_mech; + sec_mechanism = (mechanism_name ( SEMI mech_parameters )*) >create_securityclient %add_securityclient; + Security_Client = "Security-Client"i HCOLON sec_mechanism ( COMMA sec_mechanism )*; + + # Entry point + main := Security_Client :>CRLF @eob; + +}%% + +int tsip_header_Security_Client_tostring(const void* header, tsk_buffer_t* output) +{ + if(header) + { + const tsip_header_Security_Client_t *Security_Client = header; + int ret = 0; + + // ipsec-3gpp; alg=hmac-md5-96; ealg=des-ede3-cbc; spi-c=1111; spi-s=2222; port-c=5062; port-s=5064 + if(tsk_striequals(Security_Client->mech, "ipsec-3gpp")) + { + tsk_buffer_appendEx(output, "%s%s%s%s%s;spi-c=%u;spi-s=%u;port-c=%u;port-s=%u", + Security_Client->mech, + + Security_Client->alg ? ";alg=" : "", + Security_Client->alg ? Security_Client->alg : "", + + Security_Client->ealg ? ";ealg=" : "", + Security_Client->ealg ? Security_Client->ealg : "", + + Security_Client->spi_c, + Security_Client->spi_s, + Security_Client->port_c, + Security_Client->port_s + ); + } + else if(Security_Client->mech){ + tsk_buffer_append(output, Security_Client->mech, strlen(Security_Client->mech)); + } + + if(Security_Client->q >= 0){ + /* qvalue = ("0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] ) */ + tsk_buffer_appendEx(output, ";q=%1.3f", Security_Client->q); + } + + return ret; + } + + return -1; +} + +tsip_header_Security_Clients_L_t *tsip_header_Security_Client_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_Security_Clients_L_t *hdr_securityclients = TSK_LIST_CREATE(); + + const char *tag_start; + tsip_header_Security_Client_t *curr_securityclient = 0; + + %%write data; + %%write init; + %%write exec; + + if( cs < %%{ write first_final; }%% ) + { + TSK_OBJECT_SAFE_FREE(curr_securityclient); + TSK_OBJECT_SAFE_FREE(hdr_securityclients); + } + + return hdr_securityclients; +} + + + + + +//======================================================== +// Security_Client header object definition +// + +/**@ingroup tsip_header_Security_Client_group +*/ +static void* tsip_header_Security_Client_create(void *self, va_list * app) +{ + tsip_header_Security_Client_t *Security_Client = self; + if(Security_Client) + { + + TSIP_HEADER(Security_Client)->type = tsip_htype_Security_Client; + TSIP_HEADER(Security_Client)->tostring = tsip_header_Security_Client_tostring; + + Security_Client->q = -1; + } + else + { + TSK_DEBUG_ERROR("Failed to create new Security_Client header."); + } + return self; +} + +/**@ingroup tsip_header_Security_Client_group +*/ +static void* tsip_header_Security_Client_destroy(void *self) +{ + tsip_header_Security_Client_t *Security_Client = self; + if(Security_Client) + { + TSK_FREE(Security_Client->mech); + TSK_FREE(Security_Client->alg); + TSK_FREE(Security_Client->prot); + TSK_FREE(Security_Client->mod); + TSK_FREE(Security_Client->ealg); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Security_Client)); + } + else TSK_DEBUG_ERROR("Null Security_Client header."); + + return self; +} + +static const tsk_object_def_t tsip_header_Security_Client_def_s = +{ + sizeof(tsip_header_Security_Client_t), + tsip_header_Security_Client_create, + tsip_header_Security_Client_destroy, + 0 +}; +const void *tsip_header_Security_Client_def_t = &tsip_header_Security_Client_def_s; \ No newline at end of file diff --git a/trunk/tinySIP/ragel/tsip_parser_message.rl b/trunk/tinySIP/ragel/tsip_parser_message.rl index 4b5adc64..9c0f9b48 100644 --- a/trunk/tinySIP/ragel/tsip_parser_message.rl +++ b/trunk/tinySIP/ragel/tsip_parser_message.rl @@ -35,9 +35,9 @@ #include "tsk_debug.h" #include "tsk_memory.h" -static void tsip_message_parser_execute(tsk_ragel_state_t *state, tsip_message_t *message); +static void tsip_message_parser_execute(tsk_ragel_state_t *state, tsip_message_t *message, TSIP_BOOLEAN extract_content); static void tsip_message_parser_init(tsk_ragel_state_t *state); -static void tsip_message_parser_eoh(tsk_ragel_state_t *state, tsip_message_t *message); +static void tsip_message_parser_eoh(tsk_ragel_state_t *state, tsip_message_t *message, TSIP_BOOLEAN extract_content); /*********************************** * Ragel state machine. @@ -166,7 +166,7 @@ static void tsip_message_parser_eoh(tsk_ragel_state_t *state, tsip_message_t *me state->pe = pe; state->eof = eof; - tsip_message_parser_eoh(state, message); + tsip_message_parser_eoh(state, message, extract_content); cs = state->cs; p = state->p; @@ -186,22 +186,8 @@ static void tsip_message_parser_eoh(tsk_ragel_state_t *state, tsip_message_t *me /* Regel data */ %%write data; -//////////////////////////////////////////////////////////////////////////////////////////////////// -/// @fn TSIP_BOOLEAN tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t *result) -/// -/// @brief Parse a SIP message. Both requests and reponses messages. -/// -/// @author Mamadou -/// @date 12/4/2009 -/// -/// @param [in,out] state The ragel state to use. -/// @param [out] result Non-null sip message created using @ref TSIP_MESSAGE_CREATE. You must use @ref TSK_OBJECT_SAFE_FREE to -/// free the result. -/// -/// @return @ref TSIP_TRUE if succeed and @ref TSIP_FALSE otherwise. -/// -//////////////////////////////////////////////////////////////////////////////////////////////////// -TSIP_BOOLEAN tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t **result) + +TSIP_BOOLEAN tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t **result, TSIP_BOOLEAN extract_content) { if(!state || state->pe <= state->p) { @@ -219,7 +205,7 @@ TSIP_BOOLEAN tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t **resul /* * State mechine execution. */ - tsip_message_parser_execute(state, *result); + tsip_message_parser_execute(state, *result, extract_content); /* Check result */ @@ -242,7 +228,7 @@ static void tsip_message_parser_init(tsk_ragel_state_t *state) state->cs = cs; } -static void tsip_message_parser_execute(tsk_ragel_state_t *state, tsip_message_t *message) +static void tsip_message_parser_execute(tsk_ragel_state_t *state, tsip_message_t *message, TSIP_BOOLEAN extract_content) { int cs = state->cs; const char *p = state->p; @@ -257,14 +243,14 @@ static void tsip_message_parser_execute(tsk_ragel_state_t *state, tsip_message_t state->eof = eof; } -static void tsip_message_parser_eoh(tsk_ragel_state_t *state, tsip_message_t *message) +static void tsip_message_parser_eoh(tsk_ragel_state_t *state, tsip_message_t *message, TSIP_BOOLEAN extract_content) { int cs = state->cs; const char *p = state->p; const char *pe = state->pe; const char *eof = state->eof; - if(message) + if(extract_content && message) { uint32_t clen = tsip_message_getContent_length(message); if((p+clen) Content) diff --git a/trunk/tinySIP/src/headers/tsip_header_Security_Client.c b/trunk/tinySIP/src/headers/tsip_header_Security_Client.c index 8b137891..238e867a 100644 --- a/trunk/tinySIP/src/headers/tsip_header_Security_Client.c +++ b/trunk/tinySIP/src/headers/tsip_header_Security_Client.c @@ -1 +1,905 @@ - + +/* #line 1 "tsip_parser_header_Security_Client.rl" */ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Security_Client.c + * @brief SIP Security-Client header as per RFC 3329. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#include "tinysip/headers/tsip_header_Security_Client.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include + +/**@defgroup tsip_header_Security_Client_group SIP Security_Client header. +*/ + +/*********************************** +* Ragel state machine. +*/ + +/* #line 167 "tsip_parser_header_Security_Client.rl" */ + + +int tsip_header_Security_Client_tostring(const void* header, tsk_buffer_t* output) +{ + if(header) + { + const tsip_header_Security_Client_t *Security_Client = header; + int ret = 0; + + // ipsec-3gpp; alg=hmac-md5-96; ealg=des-ede3-cbc; spi-c=1111; spi-s=2222; port-c=5062; port-s=5064 + if(tsk_striequals(Security_Client->mech, "ipsec-3gpp")) + { + tsk_buffer_appendEx(output, "%s%s%s%s%s;spi-c=%u;spi-s=%u;port-c=%u;port-s=%u", + Security_Client->mech, + + Security_Client->alg ? ";alg=" : "", + Security_Client->alg ? Security_Client->alg : "", + + Security_Client->ealg ? ";ealg=" : "", + Security_Client->ealg ? Security_Client->ealg : "", + + Security_Client->spi_c, + Security_Client->spi_s, + Security_Client->port_c, + Security_Client->port_s + ); + } + else if(Security_Client->mech){ + tsk_buffer_append(output, Security_Client->mech, strlen(Security_Client->mech)); + } + + if(Security_Client->q >= 0){ + /* qvalue = ("0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] ) */ + tsk_buffer_appendEx(output, ";q=%1.3f", Security_Client->q); + } + + return ret; + } + + return -1; +} + +tsip_header_Security_Clients_L_t *tsip_header_Security_Client_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_Security_Clients_L_t *hdr_securityclients = TSK_LIST_CREATE(); + + const char *tag_start; + tsip_header_Security_Client_t *curr_securityclient = 0; + + +/* #line 105 "../src/headers/tsip_header_Security_Client.c" */ +static const char _tsip_machine_parser_header_Security_Client_actions[] = { + 0, 1, 0, 1, 3, 1, 4, 1, + 5, 1, 6, 1, 7, 1, 8, 1, + 9, 1, 10, 1, 11, 1, 12, 2, + 1, 0, 2, 3, 2, 2, 4, 2, + 2, 5, 2, 2, 6, 2, 2, 7, + 2, 2, 8, 2, 2, 9, 2, 2, + 10, 2, 2, 11, 2 +}; + +static const short _tsip_machine_parser_header_Security_Client_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 17, 19, 21, 23, 25, 27, + 29, 32, 49, 50, 52, 68, 85, 90, + 91, 93, 97, 124, 125, 127, 153, 171, + 177, 178, 180, 185, 204, 205, 207, 226, + 227, 229, 232, 248, 250, 252, 254, 256, + 258, 259, 261, 266, 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, 481, 501, 519, 525, 526, 528, + 533, 552, 553, 555, 574, 591, 611, 631, + 651, 669, 675, 676, 678, 683, 702, 703, + 705, 724, 741, 761, 781, 801, 820, 842, + 860, 866, 867, 869, 874, 893, 894, 896, + 915, 922, 940, 946, 947, 949, 954, 973, + 974, 976, 995, 1002, 1020, 1026, 1027, 1029, + 1034, 1055, 1056, 1058, 1079, 1085, 1092, 1099, + 1106, 1111, 1117, 1123, 1129, 1135, 1155, 1175, + 1194, 1216, 1234, 1240, 1241, 1243, 1248, 1267, + 1268, 1270, 1289, 1296, 1314, 1320, 1321, 1323, + 1328, 1347, 1348, 1350, 1369, 1376 +}; + +static const char _tsip_machine_parser_header_Security_Client_trans_keys[] = { + 83, 115, 69, 101, 67, 99, 85, 117, + 82, 114, 73, 105, 84, 116, 89, 121, + 45, 67, 99, 76, 108, 73, 105, 69, + 101, 78, 110, 84, 116, 9, 32, 58, + 9, 13, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 59, 10, 9, 32, 9, 32, 44, + 59, 9, 13, 32, 33, 37, 39, 65, + 69, 80, 81, 83, 97, 101, 112, 113, + 115, 126, 42, 43, 45, 46, 48, 57, + 66, 90, 95, 122, 10, 9, 32, 9, + 32, 33, 37, 39, 65, 69, 80, 81, + 83, 97, 101, 112, 113, 115, 126, 42, + 43, 45, 46, 48, 57, 66, 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, 10, 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, 44, 59, 61, 76, 108, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 71, 103, 126, 42, 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, 9, 13, + 32, 33, 37, 39, 44, 59, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 65, 97, 126, 42, 46, 48, 57, 66, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 76, 108, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 71, 103, 126, 42, 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, 9, 13, 32, 33, + 37, 39, 44, 59, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 79, 111, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 82, 114, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 84, 116, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 45, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 67, 83, 99, + 115, 126, 42, 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, 9, 13, 32, 44, 59, + 48, 57, 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, 9, 13, 32, 44, 59, + 48, 57, 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, 48, 49, 91, 126, 42, 43, 45, + 46, 50, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 13, 32, 33, 34, 37, + 39, 48, 49, 91, 126, 42, 43, 45, + 46, 50, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 46, 59, 9, 13, 32, + 44, 59, 48, 57, 9, 13, 32, 44, + 59, 48, 57, 9, 13, 32, 44, 59, + 48, 57, 9, 13, 32, 44, 59, 9, + 13, 32, 44, 46, 59, 9, 13, 32, + 44, 48, 59, 9, 13, 32, 44, 48, + 59, 9, 13, 32, 44, 48, 59, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 80, 112, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 73, 105, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 45, 59, + 61, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 67, 83, 99, 115, 126, + 42, 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, 9, 13, 32, 44, 59, 48, 57, + 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, 9, 13, 32, 44, 59, 48, 57, + 0 +}; + +static const char _tsip_machine_parser_header_Security_Client_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 2, 2, 2, 2, 2, 2, + 3, 7, 1, 2, 6, 9, 5, 1, + 2, 4, 17, 1, 2, 16, 10, 6, + 1, 2, 5, 9, 1, 2, 9, 1, + 2, 3, 4, 0, 0, 0, 0, 0, + 1, 2, 5, 1, 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, 12, 12, 10, 6, 1, 2, 5, + 9, 1, 2, 9, 9, 12, 12, 12, + 10, 6, 1, 2, 5, 9, 1, 2, + 9, 9, 12, 12, 12, 11, 14, 10, + 6, 1, 2, 5, 9, 1, 2, 9, + 5, 10, 6, 1, 2, 5, 9, 1, + 2, 9, 5, 10, 6, 1, 2, 5, + 11, 1, 2, 11, 6, 5, 5, 5, + 5, 6, 6, 6, 6, 12, 12, 11, + 14, 10, 6, 1, 2, 5, 9, 1, + 2, 9, 5, 10, 6, 1, 2, 5, + 9, 1, 2, 9, 5, 0 +}; + +static const char _tsip_machine_parser_header_Security_Client_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 0, 0, 5, 4, 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, 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, 4, 4, 4, 0, 0, 0, 0, + 5, 0, 0, 5, 4, 4, 4, 4, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 4, 4, 4, 4, 4, 4, 4, + 0, 0, 0, 0, 5, 0, 0, 5, + 1, 4, 0, 0, 0, 0, 5, 0, + 0, 5, 1, 4, 0, 0, 0, 0, + 5, 0, 0, 5, 0, 1, 1, 1, + 0, 0, 0, 0, 0, 4, 4, 4, + 4, 4, 0, 0, 0, 0, 5, 0, + 0, 5, 1, 4, 0, 0, 0, 0, + 5, 0, 0, 5, 1, 0 +}; + +static const short _tsip_machine_parser_header_Security_Client_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 24, 26, 29, 32, 35, 38, 41, + 44, 48, 61, 63, 66, 78, 92, 98, + 100, 103, 108, 131, 133, 136, 158, 173, + 180, 182, 185, 191, 206, 208, 211, 226, + 228, 231, 235, 246, 248, 250, 252, 254, + 256, 258, 261, 267, 269, 273, 287, 292, + 298, 304, 310, 313, 318, 325, 327, 330, + 332, 335, 337, 340, 343, 345, 348, 350, + 353, 355, 362, 369, 375, 381, 387, 393, + 396, 400, 407, 414, 421, 423, 426, 429, + 431, 433, 450, 467, 482, 489, 491, 494, + 500, 515, 517, 520, 535, 549, 566, 583, + 600, 615, 622, 624, 627, 633, 648, 650, + 653, 668, 682, 699, 716, 733, 749, 768, + 783, 790, 792, 795, 801, 816, 818, 821, + 836, 843, 858, 865, 867, 870, 876, 891, + 893, 896, 911, 918, 933, 940, 942, 945, + 951, 968, 970, 973, 990, 997, 1004, 1011, + 1018, 1024, 1031, 1038, 1045, 1052, 1069, 1086, + 1102, 1121, 1136, 1143, 1145, 1148, 1154, 1169, + 1171, 1174, 1189, 1196, 1211, 1218, 1220, 1223, + 1229, 1244, 1246, 1249, 1264, 1271 +}; + +static const unsigned char _tsip_machine_parser_header_Security_Client_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 8, 8, 1, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 12, 1, 13, 13, 1, 14, 14, + 1, 15, 15, 1, 15, 15, 16, 1, + 16, 17, 16, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 1, 19, 1, 20, + 20, 1, 20, 20, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 1, 21, 22, + 21, 23, 23, 23, 24, 25, 23, 23, + 23, 23, 23, 1, 26, 27, 26, 16, + 28, 1, 29, 1, 30, 30, 1, 30, + 30, 16, 28, 1, 28, 31, 28, 32, + 32, 32, 33, 34, 35, 36, 37, 33, + 34, 35, 36, 37, 32, 32, 32, 32, + 32, 32, 1, 38, 1, 39, 39, 1, + 39, 39, 32, 32, 32, 33, 34, 35, + 36, 37, 33, 34, 35, 36, 37, 32, + 32, 32, 32, 32, 32, 1, 40, 41, + 40, 42, 42, 42, 43, 44, 45, 42, + 42, 42, 42, 42, 1, 46, 47, 46, + 16, 28, 45, 1, 48, 1, 49, 49, + 1, 49, 49, 16, 28, 45, 1, 45, + 50, 45, 51, 52, 51, 51, 53, 51, + 51, 51, 51, 51, 51, 1, 54, 1, + 55, 55, 1, 55, 56, 55, 51, 52, + 51, 51, 53, 51, 51, 51, 51, 51, + 51, 1, 57, 1, 58, 58, 1, 58, + 58, 52, 1, 52, 64, 65, 66, 59, + 60, 61, 62, 63, 52, 1, 52, 1, + 59, 1, 60, 1, 61, 1, 62, 1, + 67, 1, 52, 52, 1, 68, 41, 68, + 43, 44, 1, 69, 1, 52, 52, 52, + 1, 68, 41, 68, 51, 51, 51, 43, + 44, 51, 51, 51, 51, 51, 1, 71, + 70, 70, 70, 1, 73, 65, 72, 72, + 72, 1, 73, 65, 74, 74, 74, 1, + 73, 65, 75, 75, 75, 1, 73, 65, + 1, 77, 76, 70, 70, 1, 78, 73, + 65, 79, 72, 72, 1, 80, 1, 81, + 82, 1, 83, 1, 84, 85, 1, 86, + 1, 65, 87, 1, 65, 88, 1, 65, + 1, 84, 89, 1, 84, 1, 81, 90, + 1, 81, 1, 78, 73, 65, 91, 74, + 74, 1, 78, 73, 65, 75, 75, 75, + 1, 93, 65, 92, 92, 92, 1, 95, + 65, 94, 94, 94, 1, 95, 65, 96, + 96, 96, 1, 95, 65, 97, 97, 97, + 1, 95, 65, 1, 98, 92, 92, 1, + 78, 95, 65, 99, 94, 94, 1, 78, + 95, 65, 100, 96, 96, 1, 78, 95, + 65, 97, 97, 97, 1, 101, 1, 78, + 102, 1, 78, 103, 1, 78, 1, 77, + 1, 40, 41, 40, 42, 42, 42, 43, + 44, 45, 104, 104, 42, 42, 42, 42, + 42, 1, 40, 41, 40, 42, 42, 42, + 43, 44, 45, 105, 105, 42, 42, 42, + 42, 42, 1, 106, 41, 106, 42, 42, + 42, 43, 44, 107, 42, 42, 42, 42, + 42, 1, 108, 109, 108, 16, 28, 107, + 1, 110, 1, 111, 111, 1, 111, 111, + 16, 28, 107, 1, 107, 112, 107, 113, + 52, 113, 113, 53, 113, 113, 113, 113, + 113, 113, 1, 114, 1, 115, 115, 1, + 115, 56, 115, 113, 52, 113, 113, 53, + 113, 113, 113, 113, 113, 113, 1, 116, + 117, 116, 118, 118, 118, 119, 120, 118, + 118, 118, 118, 118, 1, 40, 41, 40, + 42, 42, 42, 43, 44, 45, 121, 121, + 42, 42, 42, 42, 42, 1, 40, 41, + 40, 42, 42, 42, 43, 44, 45, 122, + 122, 42, 42, 42, 42, 42, 1, 40, + 41, 40, 42, 42, 42, 43, 44, 45, + 123, 123, 42, 42, 42, 42, 42, 1, + 124, 41, 124, 42, 42, 42, 43, 44, + 125, 42, 42, 42, 42, 42, 1, 126, + 127, 126, 16, 28, 125, 1, 128, 1, + 129, 129, 1, 129, 129, 16, 28, 125, + 1, 125, 130, 125, 131, 52, 131, 131, + 53, 131, 131, 131, 131, 131, 131, 1, + 132, 1, 133, 133, 1, 133, 56, 133, + 131, 52, 131, 131, 53, 131, 131, 131, + 131, 131, 131, 1, 134, 135, 134, 136, + 136, 136, 137, 138, 136, 136, 136, 136, + 136, 1, 40, 41, 40, 42, 42, 42, + 43, 44, 45, 139, 139, 42, 42, 42, + 42, 42, 1, 40, 41, 40, 42, 42, + 42, 43, 44, 45, 140, 140, 42, 42, + 42, 42, 42, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 141, 141, 42, + 42, 42, 42, 42, 1, 40, 41, 40, + 42, 42, 42, 43, 142, 44, 45, 42, + 42, 42, 42, 42, 1, 40, 41, 40, + 42, 42, 42, 43, 44, 45, 143, 144, + 143, 144, 42, 42, 42, 42, 42, 1, + 145, 41, 145, 42, 42, 42, 43, 44, + 146, 42, 42, 42, 42, 42, 1, 147, + 148, 147, 16, 28, 146, 1, 149, 1, + 150, 150, 1, 150, 150, 16, 28, 146, + 1, 146, 151, 146, 51, 52, 51, 51, + 53, 51, 51, 51, 152, 51, 51, 1, + 153, 1, 154, 154, 1, 154, 56, 154, + 51, 52, 51, 51, 53, 51, 51, 51, + 152, 51, 51, 1, 155, 156, 155, 157, + 159, 158, 1, 160, 41, 160, 42, 42, + 42, 43, 44, 161, 42, 42, 42, 42, + 42, 1, 162, 163, 162, 16, 28, 161, + 1, 164, 1, 165, 165, 1, 165, 165, + 16, 28, 161, 1, 161, 166, 161, 51, + 52, 51, 51, 53, 51, 51, 51, 167, + 51, 51, 1, 168, 1, 169, 169, 1, + 169, 56, 169, 51, 52, 51, 51, 53, + 51, 51, 51, 167, 51, 51, 1, 170, + 171, 170, 172, 174, 173, 1, 175, 41, + 175, 42, 42, 42, 43, 44, 176, 42, + 42, 42, 42, 42, 1, 177, 178, 177, + 16, 28, 176, 1, 179, 1, 180, 180, + 1, 180, 180, 16, 28, 176, 1, 176, + 181, 176, 51, 52, 51, 51, 182, 183, + 53, 51, 51, 51, 51, 51, 51, 1, + 184, 1, 185, 185, 1, 185, 56, 185, + 51, 52, 51, 51, 182, 183, 53, 51, + 51, 51, 51, 51, 51, 1, 186, 187, + 186, 188, 189, 190, 1, 186, 187, 186, + 188, 190, 191, 1, 186, 187, 186, 188, + 190, 192, 1, 186, 187, 186, 188, 190, + 193, 1, 186, 187, 186, 188, 190, 1, + 186, 187, 186, 188, 194, 190, 1, 186, + 187, 186, 188, 195, 190, 1, 186, 187, + 186, 188, 196, 190, 1, 186, 187, 186, + 188, 193, 190, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 197, 197, 42, + 42, 42, 42, 42, 1, 40, 41, 40, + 42, 42, 42, 43, 44, 45, 198, 198, + 42, 42, 42, 42, 42, 1, 40, 41, + 40, 42, 42, 42, 43, 199, 44, 45, + 42, 42, 42, 42, 42, 1, 40, 41, + 40, 42, 42, 42, 43, 44, 45, 200, + 201, 200, 201, 42, 42, 42, 42, 42, + 1, 202, 41, 202, 42, 42, 42, 43, + 44, 203, 42, 42, 42, 42, 42, 1, + 204, 205, 204, 16, 28, 203, 1, 206, + 1, 207, 207, 1, 207, 207, 16, 28, + 203, 1, 203, 208, 203, 51, 52, 51, + 51, 53, 51, 51, 51, 209, 51, 51, + 1, 210, 1, 211, 211, 1, 211, 56, + 211, 51, 52, 51, 51, 53, 51, 51, + 51, 209, 51, 51, 1, 212, 213, 212, + 214, 216, 215, 1, 217, 41, 217, 42, + 42, 42, 43, 44, 218, 42, 42, 42, + 42, 42, 1, 219, 220, 219, 16, 28, + 218, 1, 221, 1, 222, 222, 1, 222, + 222, 16, 28, 218, 1, 218, 223, 218, + 51, 52, 51, 51, 53, 51, 51, 51, + 224, 51, 51, 1, 225, 1, 226, 226, + 1, 226, 56, 226, 51, 52, 51, 51, + 53, 51, 51, 51, 224, 51, 51, 1, + 227, 228, 227, 229, 231, 230, 1, 1, + 0 +}; + +static const unsigned char _tsip_machine_parser_header_Security_Client_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 21, 19, 20, 22, 51, 21, + 17, 26, 22, 23, 26, 24, 25, 27, + 30, 89, 101, 114, 139, 157, 28, 29, + 31, 51, 30, 17, 26, 35, 31, 32, + 33, 34, 36, 53, 42, 54, 37, 38, + 39, 40, 41, 43, 44, 45, 46, 47, + 48, 50, 52, 49, 22, 181, 55, 88, + 56, 59, 57, 58, 60, 75, 61, 73, + 62, 63, 71, 64, 65, 69, 66, 67, + 68, 70, 72, 74, 76, 84, 77, 80, + 78, 79, 81, 82, 83, 85, 86, 87, + 90, 91, 92, 96, 92, 93, 94, 95, + 97, 100, 98, 99, 22, 51, 100, 17, + 26, 102, 103, 104, 105, 109, 105, 106, + 107, 108, 110, 113, 111, 112, 22, 51, + 113, 17, 26, 115, 116, 117, 118, 119, + 129, 120, 124, 120, 121, 122, 123, 125, + 128, 126, 127, 22, 51, 17, 128, 26, + 130, 134, 130, 131, 132, 133, 135, 138, + 136, 137, 22, 51, 17, 138, 26, 140, + 144, 140, 141, 142, 143, 145, 148, 153, + 146, 147, 22, 51, 17, 149, 26, 150, + 151, 152, 154, 155, 156, 158, 159, 160, + 161, 171, 162, 166, 162, 163, 164, 165, + 167, 170, 168, 169, 22, 51, 17, 170, + 26, 172, 176, 172, 173, 174, 175, 177, + 180, 178, 179, 22, 51, 17, 180, 26 +}; + +static const char _tsip_machine_parser_header_Security_Client_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 23, 0, 0, 26, 26, 0, + 26, 3, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, + 50, 50, 0, 50, 19, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 21, 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, 50, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 44, 44, 0, 44, + 15, 0, 0, 0, 50, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 41, 41, + 0, 41, 13, 0, 0, 0, 0, 0, + 0, 50, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 32, 32, 32, 0, 7, + 50, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 29, 29, 29, 0, 5, 50, + 0, 0, 0, 0, 0, 0, 1, 1, + 0, 0, 47, 47, 47, 0, 17, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 38, 38, 38, 0, + 11, 50, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 35, 35, 35, 0, 9 +}; + +static const int tsip_machine_parser_header_Security_Client_start = 1; +static const int tsip_machine_parser_header_Security_Client_first_final = 181; +static const int tsip_machine_parser_header_Security_Client_error = 0; + +static const int tsip_machine_parser_header_Security_Client_en_main = 1; + + +/* #line 221 "tsip_parser_header_Security_Client.rl" */ + +/* #line 632 "../src/headers/tsip_header_Security_Client.c" */ + { + cs = tsip_machine_parser_header_Security_Client_start; + } + +/* #line 222 "tsip_parser_header_Security_Client.rl" */ + +/* #line 639 "../src/headers/tsip_header_Security_Client.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_Security_Client_trans_keys + _tsip_machine_parser_header_Security_Client_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Security_Client_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Security_Client_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_Security_Client_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_Security_Client_indicies[_trans]; + cs = _tsip_machine_parser_header_Security_Client_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Security_Client_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Security_Client_actions + _tsip_machine_parser_header_Security_Client_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 53 "tsip_parser_header_Security_Client.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 58 "tsip_parser_header_Security_Client.rl" */ + { + if(!curr_securityclient) + { + curr_securityclient = TSIP_HEADER_SECURITY_CLIENT_CREATE_NULL(); + } + } + break; + case 2: +/* #line 66 "tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient) + { + tsk_list_push_back_data(hdr_securityclients, ((void**) &curr_securityclient)); + } + } + break; + case 3: +/* #line 74 "tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient) + { + TSK_PARSER_SET_STRING(curr_securityclient->mech); + } + } + break; + case 4: +/* #line 82 "tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient) + { + TSK_PARSER_SET_INT(curr_securityclient->port_s); + } + } + break; + case 5: +/* #line 90 "tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient) + { + TSK_PARSER_SET_INT(curr_securityclient->port_c); + } + } + break; + case 6: +/* #line 98 "tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient) + { + TSK_PARSER_SET_UINT(curr_securityclient->spi_s); + } + } + break; + case 7: +/* #line 106 "tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient) + { + TSK_PARSER_SET_UINT(curr_securityclient->spi_c); + } + } + break; + case 8: +/* #line 114 "tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient) + { + TSK_PARSER_SET_STRING(curr_securityclient->ealg); + } + } + break; + case 9: +/* #line 122 "tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient) + { + TSK_PARSER_SET_STRING(curr_securityclient->alg); + } + } + break; + case 10: +/* #line 130 "tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient) + { + TSK_PARSER_SET_DOUBLE(curr_securityclient->q); + } + } + break; + case 11: +/* #line 138 "tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient) + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_securityclient)); + } + } + break; + case 12: +/* #line 148 "tsip_parser_header_Security_Client.rl" */ + { + } + break; +/* #line 823 "../src/headers/tsip_header_Security_Client.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 223 "tsip_parser_header_Security_Client.rl" */ + + if( cs < +/* #line 839 "../src/headers/tsip_header_Security_Client.c" */ +181 +/* #line 224 "tsip_parser_header_Security_Client.rl" */ + ) + { + TSK_OBJECT_SAFE_FREE(curr_securityclient); + TSK_OBJECT_SAFE_FREE(hdr_securityclients); + } + + return hdr_securityclients; +} + + + + + +//======================================================== +// Security_Client header object definition +// + +/**@ingroup tsip_header_Security_Client_group +*/ +static void* tsip_header_Security_Client_create(void *self, va_list * app) +{ + tsip_header_Security_Client_t *Security_Client = self; + if(Security_Client) + { + + TSIP_HEADER(Security_Client)->type = tsip_htype_Security_Client; + TSIP_HEADER(Security_Client)->tostring = tsip_header_Security_Client_tostring; + + Security_Client->q = -1; + } + else + { + TSK_DEBUG_ERROR("Failed to create new Security_Client header."); + } + return self; +} + +/**@ingroup tsip_header_Security_Client_group +*/ +static void* tsip_header_Security_Client_destroy(void *self) +{ + tsip_header_Security_Client_t *Security_Client = self; + if(Security_Client) + { + TSK_FREE(Security_Client->mech); + TSK_FREE(Security_Client->alg); + TSK_FREE(Security_Client->prot); + TSK_FREE(Security_Client->mod); + TSK_FREE(Security_Client->ealg); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Security_Client)); + } + else TSK_DEBUG_ERROR("Null Security_Client header."); + + return self; +} + +static const tsk_object_def_t tsip_header_Security_Client_def_s = +{ + sizeof(tsip_header_Security_Client_t), + tsip_header_Security_Client_create, + tsip_header_Security_Client_destroy, + 0 +}; +const void *tsip_header_Security_Client_def_t = &tsip_header_Security_Client_def_s; \ No newline at end of file diff --git a/trunk/tinySIP/src/parsers/tsip_parser_header.c b/trunk/tinySIP/src/parsers/tsip_parser_header.c index c0a24452..100fb6a8 100644 --- a/trunk/tinySIP/src/parsers/tsip_parser_header.c +++ b/trunk/tinySIP/src/parsers/tsip_parser_header.c @@ -54,6 +54,7 @@ #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_Security_Client.h" #include "tinysip/headers/tsip_header_Server.h" #include "tinysip/headers/tsip_header_Service_Route.h" #include "tinysip/headers/tsip_header_Subscription_State.h" @@ -92,7 +93,7 @@ * Ragel state machine. */ -/* #line 737 "tsip_parser_header.rl" */ +/* #line 739 "tsip_parser_header.rl" */ TSIP_BOOLEAN tsip_header_parse(tsk_ragel_state_t *state, tsip_message_t *message) @@ -103,7 +104,7 @@ TSIP_BOOLEAN tsip_header_parse(tsk_ragel_state_t *state, tsip_message_t *message const char *eof = pe; -/* #line 107 "../src/parsers/tsip_parser_header.c" */ +/* #line 108 "../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, @@ -2154,16 +2155,16 @@ static const int tsip_machine_parser_headers_error = 0; static const int tsip_machine_parser_headers_en_main = 1; -/* #line 747 "tsip_parser_header.rl" */ +/* #line 749 "tsip_parser_header.rl" */ -/* #line 2160 "../src/parsers/tsip_parser_header.c" */ +/* #line 2161 "../src/parsers/tsip_parser_header.c" */ { cs = tsip_machine_parser_headers_start; } -/* #line 748 "tsip_parser_header.rl" */ +/* #line 750 "tsip_parser_header.rl" */ -/* #line 2167 "../src/parsers/tsip_parser_header.c" */ +/* #line 2168 "../src/parsers/tsip_parser_header.c" */ { int _klen; unsigned int _trans; @@ -2237,70 +2238,70 @@ _match: switch ( *_acts++ ) { case 0: -/* #line 98 "tsip_parser_header.rl" */ +/* #line 99 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Accept NOT IMPLEMENTED"); } break; case 1: -/* #line 104 "tsip_parser_header.rl" */ +/* #line 105 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Accept_Contact NOT IMPLEMENTED"); } break; case 2: -/* #line 110 "tsip_parser_header.rl" */ +/* #line 111 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Accept_Encoding NOT IMPLEMENTED"); } break; case 3: -/* #line 116 "tsip_parser_header.rl" */ +/* #line 117 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Accept_Language NOT IMPLEMENTED"); } break; case 4: -/* #line 122 "tsip_parser_header.rl" */ +/* #line 123 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Accept_Resource_Priority NOT IMPLEMENTED"); } break; case 5: -/* #line 128 "tsip_parser_header.rl" */ +/* #line 129 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Alert_Info NOT IMPLEMENTED"); } break; case 6: -/* #line 134 "tsip_parser_header.rl" */ +/* #line 135 "tsip_parser_header.rl" */ { tsip_header_Allow_t *header = tsip_header_Allow_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 7: -/* #line 141 "tsip_parser_header.rl" */ +/* #line 142 "tsip_parser_header.rl" */ { tsip_header_Allow_Events_t *header = tsip_header_Allow_Events_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 8: -/* #line 148 "tsip_parser_header.rl" */ +/* #line 149 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Authentication_Info NOT IMPLEMENTED"); } break; case 9: -/* #line 154 "tsip_parser_header.rl" */ +/* #line 155 "tsip_parser_header.rl" */ { tsip_header_Authorization_t *header = tsip_header_Authorization_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 10: -/* #line 161 "tsip_parser_header.rl" */ +/* #line 162 "tsip_parser_header.rl" */ { if(!message->Call_ID) { @@ -2309,13 +2310,13 @@ _match: } break; case 11: -/* #line 170 "tsip_parser_header.rl" */ +/* #line 171 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Call_Info NOT IMPLEMENTED"); } break; case 12: -/* #line 176 "tsip_parser_header.rl" */ +/* #line 177 "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) @@ -2337,25 +2338,25 @@ _match: } break; case 13: -/* #line 198 "tsip_parser_header.rl" */ +/* #line 199 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Content_Disposition NOT IMPLEMENTED"); } break; case 14: -/* #line 204 "tsip_parser_header.rl" */ +/* #line 205 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("PARSE_HEADER_ACCEPT NOT IMPLEMENTED"); } break; case 15: -/* #line 210 "tsip_parser_header.rl" */ +/* #line 211 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Content_Language NOT IMPLEMENTED"); } break; case 16: -/* #line 216 "tsip_parser_header.rl" */ +/* #line 217 "tsip_parser_header.rl" */ { if(!message->Content_Length) { @@ -2364,7 +2365,7 @@ _match: } break; case 17: -/* #line 225 "tsip_parser_header.rl" */ +/* #line 226 "tsip_parser_header.rl" */ { if(!message->Content_Type) { @@ -2373,7 +2374,7 @@ _match: } break; case 18: -/* #line 234 "tsip_parser_header.rl" */ +/* #line 235 "tsip_parser_header.rl" */ { if(!message->CSeq) { @@ -2382,26 +2383,26 @@ _match: } break; case 19: -/* #line 243 "tsip_parser_header.rl" */ +/* #line 244 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Date NOT IMPLEMENTED"); } break; case 20: -/* #line 249 "tsip_parser_header.rl" */ +/* #line 250 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Error_Info NOT IMPLEMENTED"); } break; case 21: -/* #line 255 "tsip_parser_header.rl" */ +/* #line 256 "tsip_parser_header.rl" */ { tsip_header_Event_t *header = tsip_header_Event_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 22: -/* #line 262 "tsip_parser_header.rl" */ +/* #line 263 "tsip_parser_header.rl" */ { if(!message->Expires) { @@ -2410,7 +2411,7 @@ _match: } break; case 23: -/* #line 271 "tsip_parser_header.rl" */ +/* #line 272 "tsip_parser_header.rl" */ { if(!message->From) { @@ -2419,283 +2420,283 @@ _match: } break; case 24: -/* #line 280 "tsip_parser_header.rl" */ +/* #line 281 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_History_Info NOT IMPLEMENTED"); } break; case 25: -/* #line 286 "tsip_parser_header.rl" */ +/* #line 287 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Identity NOT IMPLEMENTED"); } break; case 26: -/* #line 292 "tsip_parser_header.rl" */ +/* #line 293 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Identity_Info NOT IMPLEMENTED"); } break; case 27: -/* #line 298 "tsip_parser_header.rl" */ +/* #line 299 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_In_Reply_To NOT IMPLEMENTED"); } break; case 28: -/* #line 304 "tsip_parser_header.rl" */ +/* #line 305 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Join NOT IMPLEMENTED"); } break; case 29: -/* #line 310 "tsip_parser_header.rl" */ +/* #line 311 "tsip_parser_header.rl" */ { tsip_header_Max_Forwards_t *header = tsip_header_Max_Forwards_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 30: -/* #line 317 "tsip_parser_header.rl" */ +/* #line 318 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_MIME_Version NOT IMPLEMENTED"); } break; case 31: -/* #line 323 "tsip_parser_header.rl" */ +/* #line 324 "tsip_parser_header.rl" */ { tsip_header_Min_Expires_t *header = tsip_header_Min_Expires_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 32: -/* #line 330 "tsip_parser_header.rl" */ +/* #line 331 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Min_SE NOT IMPLEMENTED"); } break; case 33: -/* #line 336 "tsip_parser_header.rl" */ +/* #line 337 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Organization NOT IMPLEMENTED"); } break; case 34: -/* #line 342 "tsip_parser_header.rl" */ +/* #line 343 "tsip_parser_header.rl" */ { tsip_header_P_Access_Network_Info_t *header = tsip_header_P_Access_Network_Info_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 35: -/* #line 349 "tsip_parser_header.rl" */ +/* #line 350 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_Answer_State NOT IMPLEMENTED"); } break; case 36: -/* #line 355 "tsip_parser_header.rl" */ +/* #line 356 "tsip_parser_header.rl" */ { tsip_header_P_Asserted_Identities_L_t* headers = tsip_header_P_Asserted_Identity_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADERS(headers); } break; case 37: -/* #line 362 "tsip_parser_header.rl" */ +/* #line 363 "tsip_parser_header.rl" */ { tsip_header_P_Associated_URIs_L_t* headers = tsip_header_P_Associated_URI_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADERS(headers); } break; case 38: -/* #line 369 "tsip_parser_header.rl" */ +/* #line 370 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_Called_Party_ID NOT IMPLEMENTED"); } break; case 39: -/* #line 375 "tsip_parser_header.rl" */ +/* #line 376 "tsip_parser_header.rl" */ { tsip_header_P_Charging_Function_Addressess_L_t* headers = tsip_header_P_Charging_Function_Addresses_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADERS(headers); } break; case 40: -/* #line 382 "tsip_parser_header.rl" */ +/* #line 383 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_Charging_Vector NOT IMPLEMENTED"); } break; case 41: -/* #line 388 "tsip_parser_header.rl" */ +/* #line 389 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_DCS_Billing_Info NOT IMPLEMENTED"); } break; case 42: -/* #line 394 "tsip_parser_header.rl" */ +/* #line 395 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_DCS_LAES NOT IMPLEMENTED"); } break; case 43: -/* #line 400 "tsip_parser_header.rl" */ +/* #line 401 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_DCS_OSPS NOT IMPLEMENTED"); } break; case 44: -/* #line 406 "tsip_parser_header.rl" */ +/* #line 407 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_DCS_Redirect NOT IMPLEMENTED"); } break; case 45: -/* #line 412 "tsip_parser_header.rl" */ +/* #line 413 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_DCS_Trace_Party_ID NOT IMPLEMENTED"); } break; case 46: -/* #line 418 "tsip_parser_header.rl" */ +/* #line 419 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_Early_Media NOT IMPLEMENTED"); } break; case 47: -/* #line 424 "tsip_parser_header.rl" */ +/* #line 425 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_Media_Authorization NOT IMPLEMENTED"); } break; case 48: -/* #line 430 "tsip_parser_header.rl" */ +/* #line 431 "tsip_parser_header.rl" */ { tsip_header_P_Preferred_Identity_t *header = tsip_header_P_Preferred_Identity_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 49: -/* #line 437 "tsip_parser_header.rl" */ +/* #line 438 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_Profile_Key NOT IMPLEMENTED"); } break; case 50: -/* #line 443 "tsip_parser_header.rl" */ +/* #line 444 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_User_Database NOT IMPLEMENTED"); } break; case 51: -/* #line 449 "tsip_parser_header.rl" */ +/* #line 450 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_P_Visited_Network_ID NOT IMPLEMENTED"); } break; case 52: -/* #line 455 "tsip_parser_header.rl" */ +/* #line 456 "tsip_parser_header.rl" */ { tsip_header_Paths_L_t* headers = tsip_header_Path_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADERS(headers); } break; case 53: -/* #line 462 "tsip_parser_header.rl" */ +/* #line 463 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Priority NOT IMPLEMENTED"); } break; case 54: -/* #line 468 "tsip_parser_header.rl" */ +/* #line 469 "tsip_parser_header.rl" */ { tsip_header_Privacy_t *header = tsip_header_Privacy_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 55: -/* #line 475 "tsip_parser_header.rl" */ +/* #line 476 "tsip_parser_header.rl" */ { tsip_header_Proxy_Authenticate_t *header = tsip_header_Proxy_Authenticate_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 56: -/* #line 482 "tsip_parser_header.rl" */ +/* #line 483 "tsip_parser_header.rl" */ { tsip_header_Proxy_Authorization_t *header = tsip_header_Proxy_Authorization_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 57: -/* #line 489 "tsip_parser_header.rl" */ +/* #line 490 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Proxy_Require NOT IMPLEMENTED"); } break; case 58: -/* #line 495 "tsip_parser_header.rl" */ +/* #line 496 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_RAck NOT IMPLEMENTED"); } break; case 59: -/* #line 501 "tsip_parser_header.rl" */ +/* #line 502 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Reason NOT IMPLEMENTED"); } break; case 60: -/* #line 507 "tsip_parser_header.rl" */ +/* #line 508 "tsip_parser_header.rl" */ { tsip_header_Record_Route_t *header = tsip_header_Record_Route_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 61: -/* #line 514 "tsip_parser_header.rl" */ +/* #line 515 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Refer_Sub NOT IMPLEMENTED"); } break; case 62: -/* #line 520 "tsip_parser_header.rl" */ +/* #line 521 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Refer_To NOT IMPLEMENTED"); } break; case 63: -/* #line 526 "tsip_parser_header.rl" */ +/* #line 527 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Referred_By NOT IMPLEMENTED"); } break; case 64: -/* #line 532 "tsip_parser_header.rl" */ +/* #line 533 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Reject_Contact NOT IMPLEMENTED"); } break; case 65: -/* #line 538 "tsip_parser_header.rl" */ +/* #line 539 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Replaces NOT IMPLEMENTED"); } break; case 66: -/* #line 544 "tsip_parser_header.rl" */ +/* #line 545 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Reply_To NOT IMPLEMENTED"); } break; case 67: -/* #line 550 "tsip_parser_header.rl" */ +/* #line 551 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Request_Disposition NOT IMPLEMENTED"); } break; case 68: -/* #line 556 "tsip_parser_header.rl" */ +/* #line 557 "tsip_parser_header.rl" */ { tsip_header_Require_t *header = tsip_header_Require_parse(state->tag_start, (state->tag_end-state->tag_start)); if(header) @@ -2705,114 +2706,115 @@ _match: } break; case 69: -/* #line 566 "tsip_parser_header.rl" */ +/* #line 567 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Resource_Priority NOT IMPLEMENTED"); } break; case 70: -/* #line 572 "tsip_parser_header.rl" */ +/* #line 573 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Retry_After NOT IMPLEMENTED"); } break; case 71: -/* #line 578 "tsip_parser_header.rl" */ +/* #line 579 "tsip_parser_header.rl" */ { tsip_header_Routes_L_t* headers = tsip_header_Route_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADERS(headers); } break; case 72: -/* #line 585 "tsip_parser_header.rl" */ +/* #line 586 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_RSeq NOT IMPLEMENTED"); } break; case 73: -/* #line 591 "tsip_parser_header.rl" */ +/* #line 592 "tsip_parser_header.rl" */ { - TSK_DEBUG_ERROR("parse_header_Security_Client NOT IMPLEMENTED"); + tsip_header_Security_Clients_L_t* headers = tsip_header_Security_Client_parse(state->tag_start, (state->tag_end-state->tag_start)); + ADD_HEADERS(headers); } break; case 74: -/* #line 597 "tsip_parser_header.rl" */ +/* #line 599 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Security_Server NOT IMPLEMENTED"); } break; case 75: -/* #line 603 "tsip_parser_header.rl" */ +/* #line 605 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Security_Verify NOT IMPLEMENTED"); } break; case 76: -/* #line 609 "tsip_parser_header.rl" */ +/* #line 611 "tsip_parser_header.rl" */ { tsip_header_Server_t *header = tsip_header_Server_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 77: -/* #line 616 "tsip_parser_header.rl" */ +/* #line 618 "tsip_parser_header.rl" */ { tsip_header_Service_Routes_L_t* headers = tsip_header_Service_Route_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADERS(headers); } break; case 78: -/* #line 623 "tsip_parser_header.rl" */ +/* #line 625 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Session_Expires NOT IMPLEMENTED"); } break; case 79: -/* #line 629 "tsip_parser_header.rl" */ +/* #line 631 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_SIP_ETag NOT IMPLEMENTED"); } break; case 80: -/* #line 635 "tsip_parser_header.rl" */ +/* #line 637 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_SIP_If_Match NOT IMPLEMENTED"); } break; case 81: -/* #line 641 "tsip_parser_header.rl" */ +/* #line 643 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Subject NOT IMPLEMENTED"); } break; case 82: -/* #line 647 "tsip_parser_header.rl" */ +/* #line 649 "tsip_parser_header.rl" */ { tsip_header_Subscription_State_t* header = tsip_header_Subscription_State_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 83: -/* #line 654 "tsip_parser_header.rl" */ +/* #line 656 "tsip_parser_header.rl" */ { tsip_header_Supported_t *header = tsip_header_Supported_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 84: -/* #line 661 "tsip_parser_header.rl" */ +/* #line 663 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Target_Dialog NOT IMPLEMENTED"); } break; case 85: -/* #line 667 "tsip_parser_header.rl" */ +/* #line 669 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Timestamp NOT IMPLEMENTED"); } break; case 86: -/* #line 673 "tsip_parser_header.rl" */ +/* #line 675 "tsip_parser_header.rl" */ { if(!message->To) { @@ -2821,20 +2823,20 @@ _match: } break; case 87: -/* #line 682 "tsip_parser_header.rl" */ +/* #line 684 "tsip_parser_header.rl" */ { TSK_DEBUG_ERROR("parse_header_Unsupported NOT IMPLEMENTED"); } break; case 88: -/* #line 688 "tsip_parser_header.rl" */ +/* #line 690 "tsip_parser_header.rl" */ { tsip_header_User_Agent_t *header = tsip_header_User_Agent_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; case 89: -/* #line 695 "tsip_parser_header.rl" */ +/* #line 697 "tsip_parser_header.rl" */ { if(!message->firstVia) { @@ -2851,20 +2853,20 @@ _match: } break; case 90: -/* #line 712 "tsip_parser_header.rl" */ +/* #line 714 "tsip_parser_header.rl" */ { tsip_header_Warnings_L_t* headers = tsip_header_Warning_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADERS(headers); } break; case 91: -/* #line 719 "tsip_parser_header.rl" */ +/* #line 721 "tsip_parser_header.rl" */ { tsip_header_WWW_Authenticate_t *header = tsip_header_WWW_Authenticate_parse(state->tag_start, (state->tag_end-state->tag_start)); ADD_HEADER(header); } break; -/* #line 2868 "../src/parsers/tsip_parser_header.c" */ +/* #line 2870 "../src/parsers/tsip_parser_header.c" */ } } @@ -2877,12 +2879,12 @@ _again: _out: {} } -/* #line 749 "tsip_parser_header.rl" */ +/* #line 751 "tsip_parser_header.rl" */ return ( cs >= -/* #line 2884 "../src/parsers/tsip_parser_header.c" */ +/* #line 2886 "../src/parsers/tsip_parser_header.c" */ 1299 -/* #line 750 "tsip_parser_header.rl" */ +/* #line 752 "tsip_parser_header.rl" */ ); //return (cs == tsip_machine_parser_headers_first_final); } \ No newline at end of file diff --git a/trunk/tinySIP/src/parsers/tsip_parser_message.c b/trunk/tinySIP/src/parsers/tsip_parser_message.c index 82257ced..082d7156 100644 --- a/trunk/tinySIP/src/parsers/tsip_parser_message.c +++ b/trunk/tinySIP/src/parsers/tsip_parser_message.c @@ -37,9 +37,9 @@ #include "tsk_debug.h" #include "tsk_memory.h" -static void tsip_message_parser_execute(tsk_ragel_state_t *state, tsip_message_t *message); +static void tsip_message_parser_execute(tsk_ragel_state_t *state, tsip_message_t *message, TSIP_BOOLEAN extract_content); static void tsip_message_parser_init(tsk_ragel_state_t *state); -static void tsip_message_parser_eoh(tsk_ragel_state_t *state, tsip_message_t *message); +static void tsip_message_parser_eoh(tsk_ragel_state_t *state, tsip_message_t *message, TSIP_BOOLEAN extract_content); /*********************************** * Ragel state machine. @@ -181,22 +181,8 @@ static const int tsip_machine_parser_message_en_main = 1; /* #line 188 "tsip_parser_message.rl" */ -//////////////////////////////////////////////////////////////////////////////////////////////////// -/// @fn TSIP_BOOLEAN tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t *result) -/// -/// @brief Parse a SIP message. Both requests and reponses messages. -/// -/// @author Mamadou -/// @date 12/4/2009 -/// -/// @param [in,out] state The ragel state to use. -/// @param [out] result Non-null sip message created using @ref TSIP_MESSAGE_CREATE. You must use @ref TSK_OBJECT_SAFE_FREE to -/// free the result. -/// -/// @return @ref TSIP_TRUE if succeed and @ref TSIP_FALSE otherwise. -/// -//////////////////////////////////////////////////////////////////////////////////////////////////// -TSIP_BOOLEAN tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t **result) + +TSIP_BOOLEAN tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t **result, TSIP_BOOLEAN extract_content) { if(!state || state->pe <= state->p) { @@ -214,14 +200,14 @@ TSIP_BOOLEAN tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t **resul /* * State mechine execution. */ - tsip_message_parser_execute(state, *result); + tsip_message_parser_execute(state, *result, extract_content); /* Check result */ if( state->cs < -/* #line 223 "../src/parsers/tsip_parser_message.c" */ +/* #line 209 "../src/parsers/tsip_parser_message.c" */ 42 -/* #line 226 "tsip_parser_message.rl" */ +/* #line 212 "tsip_parser_message.rl" */ ) { TSK_OBJECT_SAFE_FREE(*result); @@ -237,17 +223,17 @@ static void tsip_message_parser_init(tsk_ragel_state_t *state) /* Regel machine initialization. */ -/* #line 241 "../src/parsers/tsip_parser_message.c" */ +/* #line 227 "../src/parsers/tsip_parser_message.c" */ { cs = tsip_machine_parser_message_start; } -/* #line 241 "tsip_parser_message.rl" */ +/* #line 227 "tsip_parser_message.rl" */ state->cs = cs; } -static void tsip_message_parser_execute(tsk_ragel_state_t *state, tsip_message_t *message) +static void tsip_message_parser_execute(tsk_ragel_state_t *state, tsip_message_t *message, TSIP_BOOLEAN extract_content) { int cs = state->cs; const char *p = state->p; @@ -255,7 +241,7 @@ static void tsip_message_parser_execute(tsk_ragel_state_t *state, tsip_message_t const char *eof = state->eof; -/* #line 259 "../src/parsers/tsip_parser_message.c" */ +/* #line 245 "../src/parsers/tsip_parser_message.c" */ { int _klen; unsigned int _trans; @@ -441,7 +427,7 @@ _match: state->pe = pe; state->eof = eof; - tsip_message_parser_eoh(state, message); + tsip_message_parser_eoh(state, message, extract_content); cs = state->cs; p = state->p; @@ -449,7 +435,7 @@ _match: eof = state->eof; } break; -/* #line 453 "../src/parsers/tsip_parser_message.c" */ +/* #line 439 "../src/parsers/tsip_parser_message.c" */ } } @@ -462,7 +448,7 @@ _again: _out: {} } -/* #line 253 "tsip_parser_message.rl" */ +/* #line 239 "tsip_parser_message.rl" */ state->cs = cs; state->p = p; @@ -470,14 +456,14 @@ _again: state->eof = eof; } -static void tsip_message_parser_eoh(tsk_ragel_state_t *state, tsip_message_t *message) +static void tsip_message_parser_eoh(tsk_ragel_state_t *state, tsip_message_t *message, TSIP_BOOLEAN extract_content) { int cs = state->cs; const char *p = state->p; const char *pe = state->pe; const char *eof = state->eof; - if(message) + if(extract_content && message) { uint32_t clen = tsip_message_getContent_length(message); if((p+clen) Content) diff --git a/trunk/tinySIP/src/transactions/tsip_transac_layer.c b/trunk/tinySIP/src/transactions/tsip_transac_layer.c index 1542b2b5..1d104b38 100644 --- a/trunk/tinySIP/src/transactions/tsip_transac_layer.c +++ b/trunk/tinySIP/src/transactions/tsip_transac_layer.c @@ -56,7 +56,7 @@ tsip_transac_t* tsip_transac_layer_new(const tsip_transac_layer_t *self, TSIP_BO else { // NON-INVITE Client transaction (NICT) - tsip_transac_nict_t *transac = TSIP_TRANSAC_NICT_CREATE(self->stack, 0, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value); + tsip_transac_nict_t *transac = TSIP_TRANSAC_NICT_CREATE(self->stack, self->reliable, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value); ret = TSIP_TRANSAC(transac); tsk_list_push_back_data(self->transactions, (void**)&transac); @@ -71,7 +71,7 @@ tsip_transac_t* tsip_transac_layer_new(const tsip_transac_layer_t *self, TSIP_BO else { // NON-INVITE Server transaction (NIST) - tsip_transac_nist_t *transac = TSIP_TRANSAC_NIST_CREATE(self->stack, 0, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value); + tsip_transac_nist_t *transac = TSIP_TRANSAC_NIST_CREATE(self->stack, self->reliable, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value); ret = TSIP_TRANSAC(transac); tsk_list_push_back_data(self->transactions, (void**)&transac); diff --git a/trunk/tinySIP/src/transports/tsip_transport.c b/trunk/tinySIP/src/transports/tsip_transport.c index 97606a00..2c1f2e85 100644 --- a/trunk/tinySIP/src/transports/tsip_transport.c +++ b/trunk/tinySIP/src/transports/tsip_transport.c @@ -267,6 +267,9 @@ static void* tsip_transport_create(void * self, va_list * app) transport->via_protocol = "TLS"; transport->service = "SIPS+D2T"; } + + /* Stream buffer */ + transport->buff_stream = TSK_BUFFER_CREATE_NULL(); } else { @@ -286,7 +289,8 @@ static void* tsip_transport_destroy(void * self) if(transport) { TSK_OBJECT_SAFE_FREE(transport->net_transport); - + TSK_OBJECT_SAFE_FREE(transport->buff_stream); + /*TSK_FREE(transport->scheme); TSK_FREE(transport->protocol); TSK_FREE(transport->via_protocol); diff --git a/trunk/tinySIP/src/transports/tsip_transport_layer.c b/trunk/tinySIP/src/transports/tsip_transport_layer.c index f59eccf2..5fc47ddc 100644 --- a/trunk/tinySIP/src/transports/tsip_transport_layer.c +++ b/trunk/tinySIP/src/transports/tsip_transport_layer.c @@ -35,25 +35,13 @@ #include "tinysip/parsers/tsip_parser_message.h" #include "tsk_thread.h" +#include "tsk_debug.h" -/*== Non-blocking callback function -*/ -static int tsip_transport_layer_stream_data_read(const tsip_transport_t *transport, const void* data, size_t size) -{ - return 0; -} - -/*== Non-blocking callback function -*/ -static int tsip_transport_layer_dgram_data_read(const tsip_transport_t *transport, const void* data, size_t size) +int tsip_transport_layer_handle_incoming_msg(const tsip_transport_t *transport, tsip_message_t *message) { int ret = -1; - tsk_ragel_state_t state; - tsip_message_t *message = 0; - tsk_ragel_state_init(&state, data, size); - if(tsip_message_parse(&state, &message) == TSIP_TRUE - && message->firstVia && message->Call_ID && message->CSeq && message->From && message->To) + if(message) { const tsip_transac_layer_t *layer_transac = tsip_stack_get_transac_layer(transport->stack); const tsip_dialog_layer_t *layer_dialog = tsip_stack_get_dialog_layer(transport->stack); @@ -66,6 +54,97 @@ static int tsip_transport_layer_dgram_data_read(const tsip_transport_t *transpor ret = tsip_dialog_layer_handle_incoming_msg(layer_dialog, message); } } + return ret; +} + +/*== Non-blocking callback function (STREAM) +*/ +static int tsip_transport_layer_stream_data_read(const tsip_transport_t *transport, const void* data, size_t size) +{ + int ret = -1; + tsk_ragel_state_t state; + tsip_message_t *message = TSIP_NULL; + int endOfheaders = -1; + + + /* RFC 3261 - 7.5 Framing SIP Messages + + Unlike HTTP, SIP implementations can use UDP or other unreliable + datagram protocols. Each such datagram carries one request or + response. See Section 18 on constraints on usage of unreliable + transports. + + Implementations processing SIP messages over stream-oriented + transports MUST ignore any CRLF appearing before the start-line + [H4.1]. + + The Content-Length header field value is used to locate the end of + each SIP message in a stream. It will always be present when SIP + messages are sent over stream-oriented transports. + */ + + /* Check if buffer is too big to be valid (have we missed some chuncks?) */ + if(TSK_BUFFER_SIZE(transport->buff_stream) >= 0xFFFF){ + tsk_buffer_cleanup(transport->buff_stream); + } + + /* Append new content. */ + tsk_buffer_append(transport->buff_stream, data, size); + + /* Check if we have all SIP headers. */ + if((endOfheaders = tsk_strindexOf(TSK_BUFFER_DATA(transport->buff_stream),TSK_BUFFER_SIZE(transport->buff_stream), "\r\n\r\n"/*2CRLF*/)) < 0){ + TSK_DEBUG_INFO("No all SIP headers in the TCP buffer."); + goto bail; + } + + /* If we are there this mean that we have all SIP headers. + * ==> Parse the SIP message without the content. + */ + tsk_ragel_state_init(&state, data, size); + if(tsip_message_parse(&state, &message, TSIP_FALSE/* do not extract the content */) == TSIP_TRUE + && message->firstVia && message->Call_ID && message->CSeq && message->From && message->To) + { + size_t clen = TSIP_MESSAGE_CONTENT_LENGTH(message); /* MUST have content-length header (see RFC 3261 - 7.5). If no CL header then the macro return zero. */ + if(clen == 0){ /* No content */ + tsk_buffer_remove(transport->buff_stream, 0, (endOfheaders + 4/*2CRLF*/)); /* Remove SIP headers and CRLF */ + } + else{ /* There is a content */ + if((endOfheaders + 4/*2CRLF*/ + clen) > TSK_BUFFER_SIZE(transport->buff_stream)){ /* There is content but not all the content. */ + TSK_DEBUG_INFO("No all SIP content in the TCP buffer."); + goto bail; + } + else{ + /* Add the content to the message. */ + tsip_message_add_content(message, TSIP_NULL, TSK_BUFFER_TO_U8(transport->buff_stream) + endOfheaders + 4/*2CRLF*/, clen); + /* Remove SIP headers, CRLF and the content. */ + tsk_buffer_remove(transport->buff_stream, 0, (endOfheaders + 4/*2CRLF*/ + clen)); + } + } + } + + /* Handle the incoming message. */ + ret = tsip_transport_layer_handle_incoming_msg(transport, message); + +bail: + TSK_OBJECT_SAFE_FREE(message); + + return ret; +} + +/*== Non-blocking callback function (DGRAM) +*/ +static int tsip_transport_layer_dgram_data_read(const tsip_transport_t *transport, const void* data, size_t size) +{ + int ret = -1; + tsk_ragel_state_t state; + tsip_message_t *message = 0; + + tsk_ragel_state_init(&state, data, size); + if(tsip_message_parse(&state, &message, TSIP_TRUE) == TSIP_TRUE + && message->firstVia && message->Call_ID && message->CSeq && message->From && message->To) + { + ret = tsip_transport_layer_handle_incoming_msg(transport, message); + } TSK_OBJECT_SAFE_FREE(message); return ret; diff --git a/trunk/tinySIP/src/tsip.c b/trunk/tinySIP/src/tsip.c index f3ea8fe8..eff69903 100644 --- a/trunk/tinySIP/src/tsip.c +++ b/trunk/tinySIP/src/tsip.c @@ -399,6 +399,13 @@ int tsip_stack_start(tsip_stack_handle_t *self) { // What to do ? } + + /* ALL IS OK + * + */ + if(stack->layer_transac){ + stack->layer_transac->reliable = TNET_SOCKET_TYPE_IS_STREAM(stack->proxy_cscf_type); + } TSK_DEBUG_INFO("SIP STACK -- START"); diff --git a/trunk/tinySIP/src/tsip_message.c b/trunk/tinySIP/src/tsip_message.c index be0ffc69..52527b9d 100644 --- a/trunk/tinySIP/src/tsip_message.c +++ b/trunk/tinySIP/src/tsip_message.c @@ -126,11 +126,15 @@ int tsip_message_add_content(tsip_message_t *self, const char* content_type, con { if(self) { - TSK_OBJECT_SAFE_FREE(self->Content_Type); + if(content_type){ + TSK_OBJECT_SAFE_FREE(self->Content_Type); + } TSK_OBJECT_SAFE_FREE(self->Content_Length); TSK_OBJECT_SAFE_FREE(self->Content); - TSIP_MESSAGE_ADD_HEADER(self, TSIP_HEADER_CONTENT_TYPE_VA_ARGS(content_type)); + if(content_type){ + TSIP_MESSAGE_ADD_HEADER(self, TSIP_HEADER_CONTENT_TYPE_VA_ARGS(content_type)); + } TSIP_MESSAGE_ADD_HEADER(self, TSIP_HEADER_CONTENT_LENGTH_VA_ARGS(size)); self->Content = TSK_BUFFER_CREATE(content, size); @@ -406,7 +410,7 @@ tsip_request_t *tsip_request_new(const char* method, const tsip_uri_t *request_u 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_CONTENT_LENGTH_VA_ARGS(0)); /*request->From = TSIP_HEADER_FROM_CREATE(0, from, 0); request->To = TSIP_HEADER_TO_CREATE(0, to, 0); @@ -436,6 +440,7 @@ tsip_response_t *tsip_response_new(short status_code, const char* reason_phrase, { response = TSIP_RESPONSE_CREATE(request, status_code, reason_phrase); TSIP_MESSAGE_ADD_HEADER(response, TSIP_HEADER_USER_AGENT_VA_ARGS(TSIP_HEADER_USER_AGENT_DEFAULT)); /* To be compliant with OMA SIMPLE IM v1.0*/ + TSIP_MESSAGE_ADD_HEADER(response, TSIP_HEADER_CONTENT_LENGTH_VA_ARGS(0)); /* Copy other headers */ diff --git a/trunk/tinySIP/test/test/test.c b/trunk/tinySIP/test/test/test.c index 42d07d51..8aa2f73b 100644 --- a/trunk/tinySIP/test/test/test.c +++ b/trunk/tinySIP/test/test/test.c @@ -42,10 +42,10 @@ #define RUN_TEST_LOOP 1 #define RUN_TEST_ALL 0 -#define RUN_TEST_MESSAGES 0 +#define RUN_TEST_MESSAGES 1 #define RUN_TEST_URI 0 #define RUN_TEST_TRANSAC 0 -#define RUN_TEST_STACK 1 +#define RUN_TEST_STACK 0 #ifdef _WIN32_WCE int _tmain(int argc, _TCHAR* argv[]) diff --git a/trunk/tinySIP/test/test/test_sipmessages.h b/trunk/tinySIP/test/test/test_sipmessages.h index b90c71d3..f0376bfc 100644 --- a/trunk/tinySIP/test/test/test_sipmessages.h +++ b/trunk/tinySIP/test/test/test_sipmessages.h @@ -92,7 +92,8 @@ "Allow: INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER\r\n" \ "User-Agent: IM-client/OMA1.0 Mercuro-Bronze/v4.0.1508.0\r\n" \ "c: text/plain; charset=utf-8\r\n" \ - "Security-Client: ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;prot=esp;mod=trans;port-c=61676;port-s=61662;spi-c=12345;spi-s=67890\r\n" \ + "Security-Client: ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;prot=esp;mod=trans;port-c=61676;port-s=61662;spi-c=4294967295;spi-s=67890,tls;q=0.2\r\n" \ + "Security-Client: ipsec-ike;q=0.1,tls;q=0.2\r\n" \ "Security-Server: ipsec-3gpp;alg=hmac-md5-96;prot=esp;mod=trans;ealg=aes-cbc;spi-c=5000;spi-s=5001;port-c=78952;port-s=77854\r\n" \ "Security-Verify: ipsec-3gpp;alg=hmac-md5-96;prot=esp;mod=trans;ealg=aes-cbc;spi-c=5000;spi-s=5001;port-c=9999;port-s=20000\r\n" \ "Service-Route: ,,\r\n" \ @@ -124,7 +125,7 @@ void test_parser() uint32_t clength; tsk_ragel_state_init(&state, SIP_MSG_2_TEST, strlen(SIP_MSG_2_TEST)); - tsip_message_parse(&state, &message); + tsip_message_parse(&state, &message, TSIP_TRUE); enabled = tsip_message_allowed(message, "REFER"); enabled = tsip_message_allowed(message, "MESSAGE"); @@ -175,7 +176,7 @@ void test_responses() tsip_request_t *response = 0; tsk_ragel_state_init(&state, SIP_MESSAGE, strlen(SIP_MESSAGE)); - tsip_message_parse(&state, &request); + tsip_message_parse(&state, &request, TSIP_TRUE); /* Create the response and destroy the request */ response = tsip_response_new(200, "OK you can move forward", request); diff --git a/trunk/tinySIP/test/test/test_stack.h b/trunk/tinySIP/test/test/test_stack.h index 69dccaaf..4700dded 100644 --- a/trunk/tinySIP/test/test/test_stack.h +++ b/trunk/tinySIP/test/test/test_stack.h @@ -123,7 +123,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"), @@ -139,7 +139,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"), @@ -157,7 +157,7 @@ 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"), @@ -166,14 +166,14 @@ void test_stack() 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.16.225", "tcp", 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, @@ -192,18 +192,18 @@ void test_stack() tsip_register(stack, op); - tsk_thread_sleep(1000); + 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_PARAM("to", "sip:mamadou@ericsson.com"), - // - // TSIP_OPERATION_SET_NULL()); - // tsip_subscribe(stack, op2); - //} + { + 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_PARAM("to", "sip:mamadou@ims.inexbee.com"), + + TSIP_OPERATION_SET_NULL()); + tsip_subscribe(stack, op2); + } //{ // tsip_operation_handle_t *op3 = TSIP_OPERATION_CREATE(stack, diff --git a/trunk/tinySIP/test/test/test_uri.h b/trunk/tinySIP/test/test/test_uri.h index 1d62e9a7..1213771a 100644 --- a/trunk/tinySIP/test/test/test_uri.h +++ b/trunk/tinySIP/test/test/test_uri.h @@ -173,8 +173,8 @@ void test_uri_cmp() void test_uri() { - test_uri_cmp(); test_uri_parser(); + test_uri_cmp(); } #endif /* _TEST_SIPURI_H */ diff --git a/trunk/vs_2005/tinySIP/tinySIP.vcproj b/trunk/vs_2005/tinySIP/tinySIP.vcproj index bde6c44b..5010aec5 100644 --- a/trunk/vs_2005/tinySIP/tinySIP.vcproj +++ b/trunk/vs_2005/tinySIP/tinySIP.vcproj @@ -864,57 +864,23 @@ Name="api" > - - - - - - - - - - - - - - + + @@ -1436,23 +1402,23 @@ Name="api" >