Update parsers.

This commit is contained in:
bossiel 2010-02-12 18:28:33 +00:00
parent 7b2d6e3a81
commit d968c7e945
35 changed files with 6362 additions and 333 deletions

View File

@ -32,7 +32,7 @@
#include "tsk_debug.h"
#if defined (_DEBUG) || defined (DEBUG)
# define TSK_DEBUG_OBJECTS 1
# define TSK_DEBUG_OBJECTS 0
static int tsk_objects_count = 0;
#else
# define TSK_DEBUG_OBJECTS 0

View File

@ -50,20 +50,23 @@ tsk_param_t *tsk_params_parse_param(const char* line, size_t size)
const char* start = line;
const char* end = (line + size);
const char* equal = strstr(line, "=");
tsk_param_t *param = TSK_PARAM_CREATE(0, 0);
tsk_param_t *param = TSK_PARAM_CREATE_NULL();
if(equal && equal<end)
if(param && equal && equal<end)
{
param->name = tsk_calloc((equal-start)+1, sizeof(const char));
if((param->name = tsk_calloc((equal-start)+1, sizeof(const char)))){
memcpy(param->name, start, (equal-start));
}
param->value = tsk_calloc((end-equal-1)+1, sizeof(const char));
memcpy(param->value, equal+1, (end-equal-1));
if((param->value = tsk_calloc((end-equal-1)+1, sizeof(const char)))){
memcpy(param->value, equal+1, (end-equal-1));
}
}
else
else if(param)
{
param->name = tsk_calloc((end-start)+1, sizeof(const char));
memcpy(param->name, start, (end-start));
if((param->name = tsk_calloc((end-start)+1, sizeof(const char)))){
memcpy(param->name, start, (end-start));
}
}
return param;

View File

@ -38,6 +38,7 @@
TSK_BEGIN_DECLS
#define TSK_PARAM_CREATE(name, value) tsk_object_new(tsk_param_def_t, name, value)
#define TSK_PARAM_CREATE_NULL() TSK_PARAM_CREATE(0,0)
typedef struct tsk_param_s
{

View File

@ -159,12 +159,13 @@ char* tsk_strndup(const char *s1, size_t n)
/**@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, const char * str2)
int tsk_strcontains(const char * str1, size_t size, const char * str2)
{
return ((str1 && str2) && strstr(str1, str2));
return ((str1 && str2) && (strstr(str1, str2) && strstr(str1, str2) < (str1 + size)));
}
/**@ingroup tsk_string_group

View File

@ -52,7 +52,7 @@ 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, const char * str2);
TINYSAK_API int tsk_strcontains(const char * str1, size_t size, const char * str2);
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, ...);

View File

@ -33,6 +33,8 @@
#include "tinysip_config.h"
#include "tinysip/headers/tsip_header.h"
#include "tsk_uuid.h"
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_CALL_ID_CREATE
@ -62,7 +64,7 @@ typedef struct tsip_header_Call_ID_s
}
tsip_header_Call_ID_t;
void tsip_header_Call_ID_random(tsk_istr_t *result);
int tsip_header_Call_ID_random(tsk_uuidstring_t *result);
tsip_header_Call_ID_t *tsip_header_Call_ID_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_Call_ID_def_t;

View File

@ -42,20 +42,6 @@ TSIP_BEGIN_DECLS
*/
#define TSIP_HEADER_CONTACT_CREATE() tsk_object_new(tsip_header_Contact_def_t)
//#define TSIP_CONTACT_CREATE() tsk_object_new(tsip_contact_def_t)
//
//typedef struct tsip_contact_s
//{
// TSK_DECLARE_OBJECT;
//
// char *display_name;
// tsip_uri_t *uri;
// int32_t expires;
// tsk_params_L_t *params;
//}
//tsip_contact_t;
//typedef tsk_list_t tsip_contacts_L_t;
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
@ -97,18 +83,13 @@ typedef struct tsip_header_Contact_s
char *display_name;
tsip_uri_t *uri;
int32_t expires;
//tsip_contacts_L_t *contacts;
}
tsip_header_Contact_t;
typedef tsk_list_t tsip_header_Contacts_L_t;
//const tsip_contact_t *tsip_header_Contact_get_ContactAt(tsip_header_Contact_t *hdr_contact, size_t index);
//#define tsip_header_Contact_get_Contact(hdr_contact) tsip_header_Contact_get_ContactAt(hdr_contact, 0)
tsip_header_Contacts_L_t *tsip_header_Contact_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_Contact_def_t;
//TINYSIP_GEXTERN const void *tsip_contact_def_t;
TSIP_END_DECLS

View File

@ -33,24 +33,42 @@
#include "tinysip_config.h"
#include "tinysip/headers/tsip_header.h"
#include "tinysip/tsip_uri.h"
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_PATH_CREATE
* Creates new sip 'Path' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_PATH_CREATE() tsk_object_new(tsip_header_Path_def_t)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
/// @brief SIP header 'Path'.
/// @brief SIP header 'Path' as per RFC 3327.
/// @author Mamadou
/// @date 12/3/2009
///
/// @par ABNF
/// @par ABNF : Path = "Path" HCOLON path-value *(COMMA path-value)
/// path-value = name-addr *( SEMI rr-param )
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsip_header_Path_s
{
TSIP_DECLARE_HEADER;
char *display_name;
tsip_uri_t *uri;
}
tsip_header_Path_t;
typedef tsk_list_t tsip_header_Paths_L_t;
tsip_header_Paths_L_t *tsip_header_Path_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_Path_def_t;
TSIP_END_DECLS
#endif /* _TSIP_HEADER_PATH_H_ */

View File

@ -33,8 +33,16 @@
#include "tinysip_config.h"
#include "tinysip/headers/tsip_header.h"
#include "tinysip/tsip_uri.h"
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_ROUTE_CREATE
* Creates new sip 'Route' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_ROUTE_CREATE() tsk_object_new(tsip_header_Route_def_t)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
///
@ -42,15 +50,27 @@ TSIP_BEGIN_DECLS
/// @author Mamadou
/// @date 12/3/2009
///
/// @par ABNF
/// @par ABNF : Route = "Route" HCOLON route-param *(COMMA route-param)
/// route-param = name-addr *( SEMI rr-param )
///
////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct tsip_header_Route_s
{
TSIP_DECLARE_HEADER;
char *display_name;
tsip_uri_t *uri;
}
tsip_header_Route_t;
//#define TSIP_DECLARE_HEADER_ROUTE tsip_header_Route_t header_Route
typedef tsk_list_t tsip_header_Routes_L_t;
tsip_header_Routes_L_t *tsip_header_Route_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_Route_def_t;
TSIP_END_DECLS
#endif /* _TSIP_HEADER_ROUTE_H_ */

View File

@ -33,14 +33,15 @@
#include "tinysip_config.h"
#include "tinysip/headers/tsip_header.h"
#include "tinysip/tsip_uri.h"
TSIP_BEGIN_DECLS
/**@def TSIP_HEADER_SERVICE_ROUTE_CREATE
* Creates new sip 'Service-Route' header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
* @sa TSK_OBJECT_SAFE_FREE.
*/
#define TSIP_HEADER_SERVICE_ROUTE_VA_ARGS(service_route) tsip_header_Service_Route_def_t, (const char*)service_route
#define TSIP_HEADER_SERVICE_ROUTE_CREATE(service_route) tsk_object_new(TSIP_HEADER_SERVICE_ROUTE_VA_ARGS(service_route))
#define TSIP_HEADER_SERVICE_ROUTE_CREATE() tsk_object_new(tsip_header_Service_Route_def_t)
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @struct
@ -56,11 +57,15 @@ TSIP_BEGIN_DECLS
typedef struct tsip_header_Service_Route_s
{
TSIP_DECLARE_HEADER;
char *value;
char *display_name;
tsip_uri_t *uri;
}
tsip_header_Service_Route_t;
tsip_header_Service_Route_t *tsip_header_Service_Route_parse(const char *data, size_t size);
typedef tsk_list_t tsip_header_Service_Routes_L_t;
tsip_header_Service_Routes_L_t *tsip_header_Service_Route_parse(const char *data, size_t size);
TINYSIP_GEXTERN const void *tsip_header_Service_Route_def_t;

View File

@ -38,6 +38,9 @@
#include "tinysip/api/tsip_register.h"
#include "tinysip/headers/tsip_header_Service_Route.h"
#include "tinysip/headers/tsip_header_Path.h"
#include "tnet_socket.h"
#include "dns/tnet_dns.h"
@ -130,6 +133,7 @@ typedef struct tsip_stack_s
char* display_name;
struct tsip_uri_s *public_identity;
struct tsip_uri_s *preferred_identity;
//struct tsip_uri_s *associated_identity;
char *private_identity;
char *password;
@ -149,6 +153,8 @@ typedef struct tsip_stack_s
char* device_id;
char* mobility;
char* sec_agree_mech;
tsip_header_Paths_L_t* paths;
tsip_header_Service_Routes_L_t* service_routes;
/* DNS */
tnet_dns_ctx_t *dns_ctx;

View File

@ -21,7 +21,7 @@ ragel.exe $OPTIONS -o ../src/parsers/tsip_parser_uri.c tsip_parser_uri.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
@ -50,6 +50,9 @@ ragel.exe $OPTIONS -o ../src/headers/tsip_header_Authorization.c tsip_parser_hea
# ==Min-Expires
#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
# ==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
@ -63,7 +66,7 @@ ragel.exe $OPTIONS -o ../src/headers/tsip_header_Authorization.c tsip_parser_hea
#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
@ -71,6 +74,12 @@ ragel.exe $OPTIONS -o ../src/headers/tsip_header_Proxy_Authorization.c tsip_pars
# ==Require
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Require.c tsip_parser_header_Require.rl
# == Service-Route
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Route.c tsip_parser_header_Route.rl
# == Service-Route
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Service_Route.c tsip_parser_header_Service_Route.rl
# ==Supported
#ragel.exe $OPTIONS -o ../src/headers/tsip_header_Supported.c tsip_parser_header_Supported.rl

View File

@ -39,13 +39,16 @@
#include "tinysip/headers/tsip_header_From.h"
#include "tinysip/headers/tsip_header_Max_Forwards.h"
#include "tinysip/headers/tsip_header_Min_Expires.h"
#include "tinysip/headers/tsip_header_P_Preferred_Identity.h"
#include "tinysip/headers/tsip_header_Path.h"
#include "tinysip/headers/tsip_header_P_Access_Network_Info.h"
#include "tinysip/headers/tsip_header_P_Preferred_Identity.h"
#include "tinysip/headers/tsip_header_Privacy.h"
#include "tinysip/headers/tsip_header_Proxy_Authenticate.h"
#include "tinysip/headers/tsip_header_Proxy_Authorization.h"
#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_Service_Route.h"
#include "tinysip/headers/tsip_header_Supported.h"
#include "tinysip/headers/tsip_header_To.h"
#include "tinysip/headers/tsip_header_User_Agent.h"
@ -440,7 +443,18 @@
# /*== Path: ==*/
action parse_header_Path
{
TSK_DEBUG_ERROR("parse_header_Path NOT IMPLEMENTED");
tsip_header_Paths_L_t* headers = tsip_header_Path_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
}
# /* == Priority: ==*/
@ -574,7 +588,18 @@
# /*== Route: ==*/
action parse_header_Route
{
TSK_DEBUG_ERROR("parse_header_Route NOT IMPLEMENTED");
tsip_header_Routes_L_t* headers = tsip_header_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
}
# /*== RSeq: ==*/
@ -610,7 +635,18 @@
# /*== Service-Route: ==*/
action parse_header_Service_Route
{
TSK_DEBUG_ERROR("parse_header_Service_Route NOT IMPLEMENTED");
tsip_header_Service_Routes_L_t* headers = tsip_header_Service_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Service_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
}
# /*== Session-Expires: ==*/

View File

@ -84,10 +84,9 @@ int tsip_header_Call_ID_tostring(const void* header, tsk_buffer_t* output)
return -1;
}
void tsip_header_Call_ID_random(tsk_istr_t *result)
int tsip_header_Call_ID_random(tsk_uuidstring_t *result)
{
uint64_t epoch = tsk_time_epoch();
tsk_itoa(epoch, result);
return tsk_uuidgenerate(result);
}
tsip_header_Call_ID_t *tsip_header_Call_ID_parse(const char *data, size_t size)

View File

@ -0,0 +1,211 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_Path.c
* @brief SIP Service-Path header as per RFC 3608.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_Path.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_time.h"
#include <string.h>
/**@defgroup tsip_header_Path_group SIP Service-Path header.
*/
/***********************************
* Ragel state machine.
*/
%%{
machine tsip_machine_parser_header_Path;
# Includes
include tsip_machine_utils "./tsip_machine_utils.rl";
action tag
{
tag_start = p;
}
action create_path
{
if(!curr_path)
{
curr_path = TSIP_HEADER_PATH_CREATE();
}
}
action parse_display_name
{
if(curr_path)
{
PARSER_SET_STRING(curr_path->display_name);
}
}
action parse_uri
{
if(curr_path && !curr_path->uri)
{
int len = (int)(p - tag_start);
curr_path->uri = tsip_uri_parse(tag_start, (size_t)len);
}
}
action parse_param
{
if(curr_path)
{
PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_path));
}
}
action add_path
{
if(curr_path)
{
tsk_list_push_back_data(hdr_paths, ((void**) &curr_path));
}
}
action eob
{
}
URI = (scheme HCOLON any+)>tag %parse_uri;
display_name = (( token LWS )+ | quoted_string)>tag %parse_display_name;
my_name_addr = display_name? :>LAQUOT<: URI :>RAQUOT;
rr_param = (generic_param)>tag %parse_param;
path_value = (my_name_addr ( SEMI rr_param )*) >create_path %add_path;
Path = "Path" HCOLON path_value (COMMA path_value)*;
# Entry point
main := Path :>CRLF @eob;
}%%
int tsip_header_Path_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_Path_t *Path = header;
int ret = 0;
if(Path->display_name){ /* Display Name */
tsk_buffer_appendEx(output, "\"%s\"", Path->display_name);
}
if(ret=tsip_uri_serialize(Path->uri, 1, 1, output)){ /* Path */
return ret;
}
return ret;
}
return -1;
}
tsip_header_Paths_L_t *tsip_header_Path_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_Paths_L_t *hdr_paths = TSK_LIST_CREATE();
const char *tag_start;
tsip_header_Path_t *curr_path = 0;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% )
{
TSK_OBJECT_SAFE_FREE(curr_path);
TSK_OBJECT_SAFE_FREE(hdr_paths);
}
return hdr_paths;
}
//========================================================
// Path header object definition
//
/**@ingroup tsip_header_Path_group
*/
static void* tsip_header_Path_create(void *self, va_list * app)
{
tsip_header_Path_t *Path = self;
if(Path)
{
TSIP_HEADER(Path)->type = tsip_htype_Path;
TSIP_HEADER(Path)->tostring = tsip_header_Path_tostring;
}
else
{
TSK_DEBUG_ERROR("Failed to create new Path header.");
}
return self;
}
/**@ingroup tsip_header_Path_group
*/
static void* tsip_header_Path_destroy(void *self)
{
tsip_header_Path_t *Path = self;
if(Path)
{
TSK_FREE(Path->display_name);
TSK_OBJECT_SAFE_FREE(Path->uri);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Path));
}
else TSK_DEBUG_ERROR("Null Path header.");
return self;
}
static const tsk_object_def_t tsip_header_Path_def_s =
{
sizeof(tsip_header_Path_t),
tsip_header_Path_create,
tsip_header_Path_destroy,
0
};
const void *tsip_header_Path_def_t = &tsip_header_Path_def_s;

View File

@ -0,0 +1,214 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_header_Route.c
* @brief SIP Service-Route header as per RFC 3608.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinysip/headers/tsip_header_Route.h"
#include "tinysip/parsers/tsip_parser_uri.h"
#include "tsk_debug.h"
#include "tsk_memory.h"
#include "tsk_time.h"
#include <string.h>
/**@defgroup tsip_header_Route_group SIP Service-Route header.
*/
/***********************************
* Ragel state machine.
*/
%%{
machine tsip_machine_parser_header_Route;
# Includes
include tsip_machine_utils "./tsip_machine_utils.rl";
action tag
{
tag_start = p;
}
action create_route
{
if(!curr_route)
{
curr_route = TSIP_HEADER_ROUTE_CREATE();
}
}
action parse_display_name
{
if(curr_route)
{
PARSER_SET_STRING(curr_route->display_name);
}
}
action parse_uri
{
if(curr_route && !curr_route->uri)
{
int len = (int)(p - tag_start);
curr_route->uri = tsip_uri_parse(tag_start, (size_t)len);
}
}
action parse_param
{
if(curr_route)
{
PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_route));
}
}
action add_route
{
if(curr_route)
{
tsk_list_push_back_data(hdr_routes, ((void**) &curr_route));
}
}
action eob
{
}
URI = (scheme HCOLON any+)>tag %parse_uri;
display_name = (( token LWS )+ | quoted_string)>tag %parse_display_name;
my_name_addr = display_name? :>LAQUOT<: URI :>RAQUOT;
rr_param = (generic_param)>tag %parse_param;
#route_param = (my_name_addr ( SEMI rr_param )*)>create_route %add_route;
#Route = "Route" HCOLON route_param (COMMA route_param)*;
route_value = (my_name_addr ( SEMI rr_param )*) >create_route %add_route;
Route = "Route" HCOLON route_value (COMMA route_value)*;
# Entry point
main := Route :>CRLF @eob;
}%%
int tsip_header_Route_tostring(const void* header, tsk_buffer_t* output)
{
if(header)
{
const tsip_header_Route_t *Route = header;
int ret = 0;
if(Route->display_name){ /* Display Name */
tsk_buffer_appendEx(output, "\"%s\"", Route->display_name);
}
if(ret=tsip_uri_serialize(Route->uri, 1, 1, output)){ /* Route */
return ret;
}
return ret;
}
return -1;
}
tsip_header_Routes_L_t *tsip_header_Route_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_Routes_L_t *hdr_routes = TSK_LIST_CREATE();
const char *tag_start;
tsip_header_Route_t *curr_route = 0;
%%write data;
%%write init;
%%write exec;
if( cs < %%{ write first_final; }%% )
{
TSK_OBJECT_SAFE_FREE(curr_route);
TSK_OBJECT_SAFE_FREE(hdr_routes);
}
return hdr_routes;
}
//========================================================
// Route header object definition
//
/**@ingroup tsip_header_Route_group
*/
static void* tsip_header_Route_create(void *self, va_list * app)
{
tsip_header_Route_t *Route = self;
if(Route)
{
TSIP_HEADER(Route)->type = tsip_htype_Route;
TSIP_HEADER(Route)->tostring = tsip_header_Route_tostring;
}
else
{
TSK_DEBUG_ERROR("Failed to create new Route header.");
}
return self;
}
/**@ingroup tsip_header_Route_group
*/
static void* tsip_header_Route_destroy(void *self)
{
tsip_header_Route_t *Route = self;
if(Route)
{
TSK_FREE(Route->display_name);
TSK_OBJECT_SAFE_FREE(Route->uri);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Route));
}
else TSK_DEBUG_ERROR("Null Route header.");
return self;
}
static const tsk_object_def_t tsip_header_Route_def_s =
{
sizeof(tsip_header_Route_t),
tsip_header_Route_create,
tsip_header_Route_destroy,
0
};
const void *tsip_header_Route_def_t = &tsip_header_Route_def_s;

View File

@ -54,16 +54,60 @@
tag_start = p;
}
action parse_route
action create_service
{
PARSER_SET_STRING(hdr_service_route->value);
if(!curr_service)
{
curr_service = TSIP_HEADER_SERVICE_ROUTE_CREATE();
}
}
action parse_display_name
{
if(curr_service)
{
PARSER_SET_STRING(curr_service->display_name);
}
}
action parse_uri
{
if(curr_service && !curr_service->uri)
{
int len = (int)(p - tag_start);
curr_service->uri = tsip_uri_parse(tag_start, (size_t)len);
}
}
action parse_param
{
if(curr_service)
{
PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_service));
}
}
action add_service
{
if(curr_service)
{
tsk_list_push_back_data(hdr_services, ((void**) &curr_service));
}
}
action eob
{
}
Service_Route = ( "Service-Route"i ) HCOLON any*>tag %parse_route;
URI = (scheme HCOLON any+)>tag %parse_uri;
display_name = (( token LWS )+ | quoted_string)>tag %parse_display_name;
my_name_addr = display_name? :>LAQUOT<: URI :>RAQUOT;
rr_param = (generic_param)>tag %parse_param;
sr_value = (my_name_addr ( SEMI rr_param )*) >create_service %add_service;
Service_Route = "Service-Route" HCOLON sr_value (COMMA sr_value)*;
# Entry point
main := Service_Route :>CRLF @eob;
@ -75,23 +119,32 @@ int tsip_header_Service_Route_tostring(const void* header, tsk_buffer_t* output)
if(header)
{
const tsip_header_Service_Route_t *Service_Route = header;
if(Service_Route->value)
{
return tsk_buffer_append(output, Service_Route->value, strlen(Service_Route->value));
int ret = 0;
if(Service_Route->display_name){ /* Display Name */
tsk_buffer_appendEx(output, "\"%s\"", Service_Route->display_name);
}
if(ret=tsip_uri_serialize(Service_Route->uri, 1, 1, output)){ /* Route */
return ret;
}
return ret;
}
return -1;
}
tsip_header_Service_Route_t *tsip_header_Service_Route_parse(const char *data, size_t size)
tsip_header_Service_Routes_L_t *tsip_header_Service_Route_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_Service_Route_t *hdr_service_route = TSIP_HEADER_SERVICE_ROUTE_CREATE(0);
tsip_header_Service_Routes_L_t *hdr_services = TSK_LIST_CREATE();
const char *tag_start;
tsip_header_Service_Route_t *curr_service = 0;
%%write data;
%%write init;
@ -99,18 +152,17 @@ tsip_header_Service_Route_t *tsip_header_Service_Route_parse(const char *data, s
if( cs < %%{ write first_final; }%% )
{
TSK_OBJECT_SAFE_FREE(hdr_service_route);
TSK_OBJECT_SAFE_FREE(curr_service);
TSK_OBJECT_SAFE_FREE(hdr_services);
}
return hdr_service_route;
return hdr_services;
}
//========================================================
// Service_Route header object definition
//
@ -122,7 +174,6 @@ static void* tsip_header_Service_Route_create(void *self, va_list * app)
tsip_header_Service_Route_t *Service_Route = self;
if(Service_Route)
{
Service_Route->value = tsk_strdup(va_arg(*app, const char *));
TSIP_HEADER(Service_Route)->type = tsip_htype_Service_Route;
TSIP_HEADER(Service_Route)->tostring = tsip_header_Service_Route_tostring;
}
@ -140,7 +191,9 @@ static void* tsip_header_Service_Route_destroy(void *self)
tsip_header_Service_Route_t *Service_Route = self;
if(Service_Route)
{
TSK_FREE(Service_Route->value);
TSK_FREE(Service_Route->display_name);
TSK_OBJECT_SAFE_FREE(Service_Route->uri);
TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Service_Route));
}
else TSK_DEBUG_ERROR("Null Service_Route header.");

View File

@ -48,7 +48,6 @@
action tag
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
@ -69,17 +68,17 @@
action parse_user_name
{
PARSER_SET_STRING(uri->user_name);
PARSER_SET_STRING(uri->user_name);
}
action parse_password
{
PARSER_SET_STRING(uri->password);
PARSER_SET_STRING(uri->password);
}
action parse_host
{
PARSER_SET_STRING(uri->host);
PARSER_SET_STRING(uri->host);
}
action parse_port
@ -104,7 +103,7 @@
main := |*
("sip:"i>tag %is_sip | "sips:"i>tag %is_sips) @100
{
if(tsk_strcontains(te, "@"))
if(tsk_strcontains(te, (pe - te), "@"))
{
fgoto sip_usrinfo;
}
@ -121,7 +120,7 @@
}
};
(':' port)@80
(":" port)@80
{
ts++;
SCANNER_SET_INTEGER(uri->port);

View File

@ -288,8 +288,8 @@ int tsip_challenge_update(tsip_challenge_t *self, const char* scheme, const char
tsk_strupdate(&self->nonce, nonce);
tsk_strupdate(&self->opaque, opaque);
tsk_strupdate(&self->algorithm, algorithm);
self->qop = tsk_strcontains(qop, "auth-int") ? "auth-int" :
(tsk_strcontains(qop, "auth") ? "auth" : 0);
self->qop = tsk_strcontains(qop, strlen(qop), "auth-int") ? "auth-int" :
(tsk_strcontains(qop, strlen(qop), "auth") ? "auth" : 0);
if(noncechanged && self->qop){
tsip_challenge_reset_cnonce(self);
@ -443,8 +443,8 @@ static void* tsip_challenge_create(void *self, va_list * app)
challenge->opaque = tsk_strdup(va_arg(*app, const char*));
challenge->algorithm = tsk_strdup(va_arg(*app, const char*));
qop = va_arg(*app, const char*);
challenge->qop = tsk_strcontains(qop, "auth-int") ? "auth-int" :
(tsk_strcontains(qop, "auth") ? "auth" : 0);
challenge->qop = tsk_strcontains(qop, strlen(qop), "auth-int") ? "auth-int" :
(tsk_strcontains(qop, strlen(qop), "auth") ? "auth" : 0);
if(challenge->qop){
tsip_challenge_reset_cnonce(challenge);

View File

@ -611,19 +611,21 @@ int tsip_dialog_init(tsip_dialog_t *self, tsip_dialog_type_t type, tsip_stack_ha
self->type = type;
self->stack = tsk_object_ref(stack);
if(!self->routes)self->routes = TSK_LIST_CREATE();
if(!self->challenges)self->challenges = TSK_LIST_CREATE();
if(!self->routes){
self->routes = TSK_LIST_CREATE();
}
if(!self->challenges){
self->challenges = TSK_LIST_CREATE();
}
self->expires = TSIP_DIALOG_EXPIRES_DEFAULT;
if(call_id)
{
if(call_id){
tsk_strupdate(&self->callid, call_id);
}
else
{
tsk_istr_t cid;
tsip_header_Call_ID_random(&cid);
tsk_strupdate(&self->callid, cid);
else{
tsk_uuidstring_t uuid; /* Call-id is a random UUID */
tsip_header_Call_ID_random(&uuid);
tsk_strupdate(&self->callid, uuid);
}
self->operation = tsk_object_ref(operation);

View File

@ -178,7 +178,7 @@ void tsip_dialog_register_init(tsip_dialog_register_t *self)
*/
tsip_dialog_registerContext_Init(&self->_fsm, self);
TSIP_DIALOG(self)->expires = 10;
TSIP_DIALOG(self)->expires = 30;
TSIP_DIALOG(self)->callback = TSIP_DIALOG_EVENT_CALLBACK(tsip_dialog_register_event_callback);
TSIP_DIALOG(self)->uri_local = tsk_object_ref((void*)TSIP_DIALOG_GET_STACK(self)->public_identity);
@ -241,12 +241,47 @@ void tsip_dialog_register_Trying_2_Trying_X_1xx(tsip_dialog_register_t *self, co
/* Trying -> (2xx) -> Connected
*/
#include "tsk_thread.h"
//#include "tsk_thread.h"
void tsip_dialog_register_Trying_2_Connected_X_2xx(tsip_dialog_register_t *self, const tsip_message_t* msg)
{
/* Alert the user. */
TSIP_DIALOG_REGISTER_SIGNAL_INCOMING(self, self->unregistering ? tsip_unregister_ok : tsip_register_ok,
TSIP_RESPONSE_CODE(msg), TSIP_RESPONSE_PHRASE(msg));
TSIP_DIALOG_REGISTER_SIGNAL_INCOMING(self, tsip_register_ok,
TSIP_RESPONSE_CODE(msg), TSIP_RESPONSE_PHRASE(msg));
/* - Set P-associated-uriS
* - Update service-routes
* - Update Pats
*/
if(TSIP_DIALOG(self)->state != tsip_established) /* Must be called before "tsip_dialog_update" update the state. */
{
size_t index;
tsip_header_t* hdr;
/* To avoid memory leaks ==> delete all concerned objects (it worth nothing) */
//TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->associated_uri);
TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->service_routes);
TSK_OBJECT_SAFE_FREE(TSIP_DIALOG_GET_STACK(self)->paths);
/* Service-Route */
for(index = 0; (hdr = (tsip_header_t*)tsip_message_get_headerAt(msg, tsip_htype_Service_Route, index)); index++){
if(index == 0){
TSIP_DIALOG_GET_STACK(self)->service_routes = TSK_LIST_CREATE();
}
hdr = tsk_object_ref(hdr);
tsk_list_push_back_data(TSIP_DIALOG_GET_STACK(self)->service_routes, (void**)&hdr);
}
/* Paths */
for(index = 0; (hdr = (tsip_header_t*)tsip_message_get_headerAt(msg, tsip_htype_Path, index)); index++){
if(index == 0){
TSIP_DIALOG_GET_STACK(self)->paths = TSK_LIST_CREATE();
}
hdr = tsk_object_ref(hdr);
tsk_list_push_back_data(TSIP_DIALOG_GET_STACK(self)->paths, (void**)&hdr);
}
/* Associated Uris */
// FIXME
}
/* Update the dialog state. */
tsip_dialog_update(TSIP_DIALOG(self), msg);

View File

@ -62,10 +62,9 @@ int tsip_header_Call_ID_tostring(const void* header, tsk_buffer_t* output)
return -1;
}
void tsip_header_Call_ID_random(tsk_istr_t *result)
int tsip_header_Call_ID_random(tsk_uuidstring_t *result)
{
uint64_t epoch = tsk_time_epoch();
tsk_itoa(epoch, result);
return tsk_uuidgenerate(result);
}
tsip_header_Call_ID_t *tsip_header_Call_ID_parse(const char *data, size_t size)
@ -79,7 +78,7 @@ tsip_header_Call_ID_t *tsip_header_Call_ID_parse(const char *data, size_t size)
const char *tag_start;
/* #line 83 "../source/headers/tsip_header_Call_ID.c" */
/* #line 82 "../src/headers/tsip_header_Call_ID.c" */
static const int tsip_machine_parser_header_Call_ID_start = 1;
static const int tsip_machine_parser_header_Call_ID_first_final = 17;
static const int tsip_machine_parser_header_Call_ID_error = 0;
@ -87,16 +86,16 @@ static const int tsip_machine_parser_header_Call_ID_error = 0;
static const int tsip_machine_parser_header_Call_ID_en_main = 1;
/* #line 104 "tsip_parser_header_Call_ID.rl" */
/* #line 103 "tsip_parser_header_Call_ID.rl" */
/* #line 93 "../source/headers/tsip_header_Call_ID.c" */
/* #line 92 "../src/headers/tsip_header_Call_ID.c" */
{
cs = tsip_machine_parser_header_Call_ID_start;
}
/* #line 105 "tsip_parser_header_Call_ID.rl" */
/* #line 104 "tsip_parser_header_Call_ID.rl" */
/* #line 100 "../source/headers/tsip_header_Call_ID.c" */
/* #line 99 "../src/headers/tsip_header_Call_ID.c" */
{
if ( p == pe )
goto _test_eof;
@ -264,7 +263,7 @@ st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
/* #line 268 "../source/headers/tsip_header_Call_ID.c" */
/* #line 267 "../src/headers/tsip_header_Call_ID.c" */
switch( (*p) ) {
case 13: goto tr13;
case 37: goto st13;
@ -299,7 +298,7 @@ st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
/* #line 303 "../source/headers/tsip_header_Call_ID.c" */
/* #line 302 "../src/headers/tsip_header_Call_ID.c" */
if ( (*p) == 10 )
goto tr16;
goto st0;
@ -312,7 +311,7 @@ st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
/* #line 316 "../source/headers/tsip_header_Call_ID.c" */
/* #line 315 "../src/headers/tsip_header_Call_ID.c" */
goto st0;
st15:
if ( ++p == pe )
@ -395,12 +394,12 @@ case 16:
_out: {}
}
/* #line 106 "tsip_parser_header_Call_ID.rl" */
/* #line 105 "tsip_parser_header_Call_ID.rl" */
if( cs <
/* #line 402 "../source/headers/tsip_header_Call_ID.c" */
/* #line 401 "../src/headers/tsip_header_Call_ID.c" */
17
/* #line 107 "tsip_parser_header_Call_ID.rl" */
/* #line 106 "tsip_parser_header_Call_ID.rl" */
)
{
TSK_OBJECT_SAFE_FREE(hdr_call_id);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -41,13 +41,16 @@
#include "tinysip/headers/tsip_header_From.h"
#include "tinysip/headers/tsip_header_Max_Forwards.h"
#include "tinysip/headers/tsip_header_Min_Expires.h"
#include "tinysip/headers/tsip_header_P_Preferred_Identity.h"
#include "tinysip/headers/tsip_header_Path.h"
#include "tinysip/headers/tsip_header_P_Access_Network_Info.h"
#include "tinysip/headers/tsip_header_P_Preferred_Identity.h"
#include "tinysip/headers/tsip_header_Privacy.h"
#include "tinysip/headers/tsip_header_Proxy_Authenticate.h"
#include "tinysip/headers/tsip_header_Proxy_Authorization.h"
#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_Service_Route.h"
#include "tinysip/headers/tsip_header_Supported.h"
#include "tinysip/headers/tsip_header_To.h"
#include "tinysip/headers/tsip_header_User_Agent.h"
@ -60,7 +63,7 @@
* Ragel state machine.
*/
/* #line 739 "tsip_parser_header.rl" */
/* #line 775 "tsip_parser_header.rl" */
TSIP_BOOLEAN tsip_header_parse(tsip_ragel_state_t *state, tsip_message_t *message)
@ -71,7 +74,7 @@ TSIP_BOOLEAN tsip_header_parse(tsip_ragel_state_t *state, tsip_message_t *messag
const char *eof = pe;
/* #line 75 "../source/parsers/tsip_parser_header.c" */
/* #line 78 "../src/parsers/tsip_parser_header.c" */
static const int tsip_machine_parser_headers_start = 1;
static const int tsip_machine_parser_headers_first_final = 1306;
static const int tsip_machine_parser_headers_error = 0;
@ -79,16 +82,16 @@ static const int tsip_machine_parser_headers_error = 0;
static const int tsip_machine_parser_headers_en_main = 1;
/* #line 749 "tsip_parser_header.rl" */
/* #line 785 "tsip_parser_header.rl" */
/* #line 85 "../source/parsers/tsip_parser_header.c" */
/* #line 88 "../src/parsers/tsip_parser_header.c" */
{
cs = tsip_machine_parser_headers_start;
}
/* #line 750 "tsip_parser_header.rl" */
/* #line 786 "tsip_parser_header.rl" */
/* #line 92 "../source/parsers/tsip_parser_header.c" */
/* #line 95 "../src/parsers/tsip_parser_header.c" */
{
if ( p == pe )
goto _test_eof;
@ -236,43 +239,43 @@ case 11:
goto tr50;
goto st0;
tr50:
/* #line 66 "tsip_parser_header.rl" */
/* #line 69 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Accept NOT IMPLEMENTED");
}
goto st1306;
tr66:
/* #line 72 "tsip_parser_header.rl" */
/* #line 75 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Accept_Contact NOT IMPLEMENTED");
}
goto st1306;
tr79:
/* #line 78 "tsip_parser_header.rl" */
/* #line 81 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Accept_Encoding NOT IMPLEMENTED");
}
goto st1306;
tr92:
/* #line 84 "tsip_parser_header.rl" */
/* #line 87 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Accept_Language NOT IMPLEMENTED");
}
goto st1306;
tr114:
/* #line 90 "tsip_parser_header.rl" */
/* #line 93 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Accept_Resource_Priority NOT IMPLEMENTED");
}
goto st1306;
tr129:
/* #line 96 "tsip_parser_header.rl" */
/* #line 99 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Alert_Info NOT IMPLEMENTED");
}
goto st1306;
tr139:
/* #line 102 "tsip_parser_header.rl" */
/* #line 105 "tsip_parser_header.rl" */
{
tsip_header_Allow_t *header = tsip_header_Allow_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -282,7 +285,7 @@ tr139:
}
goto st1306;
tr151:
/* #line 112 "tsip_parser_header.rl" */
/* #line 115 "tsip_parser_header.rl" */
{
tsip_header_Allow_Events_t *header = tsip_header_Allow_Events_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -292,13 +295,13 @@ tr151:
}
goto st1306;
tr175:
/* #line 122 "tsip_parser_header.rl" */
/* #line 125 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Authentication_Info NOT IMPLEMENTED");
}
goto st1306;
tr189:
/* #line 128 "tsip_parser_header.rl" */
/* #line 131 "tsip_parser_header.rl" */
{
tsip_header_Authorization_t *header = tsip_header_Authorization_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -308,7 +311,7 @@ tr189:
}
goto st1306;
tr204:
/* #line 138 "tsip_parser_header.rl" */
/* #line 141 "tsip_parser_header.rl" */
{
if(!message->Call_ID)
{
@ -317,13 +320,13 @@ tr204:
}
goto st1306;
tr212:
/* #line 147 "tsip_parser_header.rl" */
/* #line 150 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Call_Info NOT IMPLEMENTED");
}
goto st1306;
tr224:
/* #line 153 "tsip_parser_header.rl" */
/* #line 156 "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)
@ -347,25 +350,25 @@ tr224:
}
goto st1306;
tr247:
/* #line 177 "tsip_parser_header.rl" */
/* #line 180 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Content_Disposition NOT IMPLEMENTED");
}
goto st1306;
tr260:
/* #line 183 "tsip_parser_header.rl" */
/* #line 186 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("PARSE_HEADER_ACCEPT NOT IMPLEMENTED");
}
goto st1306;
tr274:
/* #line 189 "tsip_parser_header.rl" */
/* #line 192 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Content_Language NOT IMPLEMENTED");
}
goto st1306;
tr283:
/* #line 195 "tsip_parser_header.rl" */
/* #line 198 "tsip_parser_header.rl" */
{
if(!message->Content_Length)
{
@ -374,7 +377,7 @@ tr283:
}
goto st1306;
tr292:
/* #line 204 "tsip_parser_header.rl" */
/* #line 207 "tsip_parser_header.rl" */
{
if(!message->Content_Type)
{
@ -383,7 +386,7 @@ tr292:
}
goto st1306;
tr300:
/* #line 213 "tsip_parser_header.rl" */
/* #line 216 "tsip_parser_header.rl" */
{
if(!message->CSeq)
{
@ -392,25 +395,25 @@ tr300:
}
goto st1306;
tr309:
/* #line 222 "tsip_parser_header.rl" */
/* #line 225 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Date NOT IMPLEMENTED");
}
goto st1306;
tr326:
/* #line 228 "tsip_parser_header.rl" */
/* #line 231 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Error_Info NOT IMPLEMENTED");
}
goto st1306;
tr335:
/* #line 234 "tsip_parser_header.rl" */
/* #line 237 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Event NOT IMPLEMENTED");
}
goto st1306;
tr346:
/* #line 240 "tsip_parser_header.rl" */
/* #line 243 "tsip_parser_header.rl" */
{
if(!message->Expires)
{
@ -419,7 +422,7 @@ tr346:
}
goto st1306;
tr355:
/* #line 249 "tsip_parser_header.rl" */
/* #line 252 "tsip_parser_header.rl" */
{
if(!message->From)
{
@ -428,37 +431,37 @@ tr355:
}
goto st1306;
tr372:
/* #line 258 "tsip_parser_header.rl" */
/* #line 261 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_History_Info NOT IMPLEMENTED");
}
goto st1306;
tr387:
/* #line 264 "tsip_parser_header.rl" */
/* #line 267 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Identity NOT IMPLEMENTED");
}
goto st1306;
tr396:
/* #line 270 "tsip_parser_header.rl" */
/* #line 273 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Identity_Info NOT IMPLEMENTED");
}
goto st1306;
tr411:
/* #line 276 "tsip_parser_header.rl" */
/* #line 279 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_In_Reply_To NOT IMPLEMENTED");
}
goto st1306;
tr420:
/* #line 282 "tsip_parser_header.rl" */
/* #line 285 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Join NOT IMPLEMENTED");
}
goto st1306;
tr438:
/* #line 288 "tsip_parser_header.rl" */
/* #line 291 "tsip_parser_header.rl" */
{
tsip_header_Max_Forwards_t *header = tsip_header_Max_Forwards_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -468,13 +471,13 @@ tr438:
}
goto st1306;
tr455:
/* #line 298 "tsip_parser_header.rl" */
/* #line 301 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_MIME_Version NOT IMPLEMENTED");
}
goto st1306;
tr470:
/* #line 304 "tsip_parser_header.rl" */
/* #line 307 "tsip_parser_header.rl" */
{
tsip_header_Min_Expires_t *header = tsip_header_Min_Expires_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -484,19 +487,19 @@ tr470:
}
goto st1306;
tr477:
/* #line 314 "tsip_parser_header.rl" */
/* #line 317 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Min_SE NOT IMPLEMENTED");
}
goto st1306;
tr494:
/* #line 320 "tsip_parser_header.rl" */
/* #line 323 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Organization NOT IMPLEMENTED");
}
goto st1306;
tr531:
/* #line 326 "tsip_parser_header.rl" */
/* #line 329 "tsip_parser_header.rl" */
{
tsip_header_P_Access_Network_Info_t *header = tsip_header_P_Access_Network_Info_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -506,85 +509,85 @@ tr531:
}
goto st1306;
tr547:
/* #line 336 "tsip_parser_header.rl" */
/* #line 339 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Answer_State NOT IMPLEMENTED");
}
goto st1306;
tr569:
/* #line 342 "tsip_parser_header.rl" */
/* #line 345 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Asserted_Identity NOT IMPLEMENTED");
}
goto st1306;
tr585:
/* #line 348 "tsip_parser_header.rl" */
/* #line 351 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Associated_URI NOT IMPLEMENTED");
}
goto st1306;
tr606:
/* #line 354 "tsip_parser_header.rl" */
/* #line 357 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Called_Party_ID NOT IMPLEMENTED");
}
goto st1306;
tr638:
/* #line 360 "tsip_parser_header.rl" */
/* #line 363 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Charging_Function_Addresses NOT IMPLEMENTED");
}
goto st1306;
tr649:
/* #line 366 "tsip_parser_header.rl" */
/* #line 369 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Charging_Vector NOT IMPLEMENTED");
}
goto st1306;
tr674:
/* #line 372 "tsip_parser_header.rl" */
/* #line 375 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_DCS_Billing_Info NOT IMPLEMENTED");
}
goto st1306;
tr683:
/* #line 378 "tsip_parser_header.rl" */
/* #line 381 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_DCS_LAES NOT IMPLEMENTED");
}
goto st1306;
tr692:
/* #line 384 "tsip_parser_header.rl" */
/* #line 387 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_DCS_OSPS NOT IMPLEMENTED");
}
goto st1306;
tr705:
/* #line 390 "tsip_parser_header.rl" */
/* #line 393 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_DCS_Redirect NOT IMPLEMENTED");
}
goto st1306;
tr724:
/* #line 396 "tsip_parser_header.rl" */
/* #line 399 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_DCS_Trace_Party_ID NOT IMPLEMENTED");
}
goto st1306;
tr740:
/* #line 402 "tsip_parser_header.rl" */
/* #line 405 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Early_Media NOT IMPLEMENTED");
}
goto st1306;
tr764:
/* #line 408 "tsip_parser_header.rl" */
/* #line 411 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Media_Authorization NOT IMPLEMENTED");
}
goto st1306;
tr788:
/* #line 414 "tsip_parser_header.rl" */
/* #line 417 "tsip_parser_header.rl" */
{
tsip_header_P_Preferred_Identity_t *header = tsip_header_P_Preferred_Identity_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -594,37 +597,48 @@ tr788:
}
goto st1306;
tr802:
/* #line 424 "tsip_parser_header.rl" */
/* #line 427 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Profile_Key NOT IMPLEMENTED");
}
goto st1306;
tr820:
/* #line 430 "tsip_parser_header.rl" */
/* #line 433 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_User_Database NOT IMPLEMENTED");
}
goto st1306;
tr843:
/* #line 436 "tsip_parser_header.rl" */
/* #line 439 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_P_Visited_Network_ID NOT IMPLEMENTED");
}
goto st1306;
tr851:
/* #line 442 "tsip_parser_header.rl" */
/* #line 445 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Path NOT IMPLEMENTED");
tsip_header_Paths_L_t* headers = tsip_header_Path_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
}
goto st1306;
tr865:
/* #line 448 "tsip_parser_header.rl" */
/* #line 462 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Priority NOT IMPLEMENTED");
}
goto st1306;
tr874:
/* #line 454 "tsip_parser_header.rl" */
/* #line 468 "tsip_parser_header.rl" */
{
tsip_header_Privacy_t *header = tsip_header_Privacy_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -634,7 +648,7 @@ tr874:
}
goto st1306;
tr897:
/* #line 464 "tsip_parser_header.rl" */
/* #line 478 "tsip_parser_header.rl" */
{
tsip_header_Proxy_Authenticate_t *header = tsip_header_Proxy_Authenticate_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -644,7 +658,7 @@ tr897:
}
goto st1306;
tr911:
/* #line 474 "tsip_parser_header.rl" */
/* #line 488 "tsip_parser_header.rl" */
{
tsip_header_Proxy_Authorization_t *header = tsip_header_Proxy_Authorization_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -654,25 +668,25 @@ tr911:
}
goto st1306;
tr923:
/* #line 484 "tsip_parser_header.rl" */
/* #line 498 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Proxy_Require NOT IMPLEMENTED");
}
goto st1306;
tr935:
/* #line 490 "tsip_parser_header.rl" */
/* #line 504 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_RAck NOT IMPLEMENTED");
}
goto st1306;
tr952:
/* #line 496 "tsip_parser_header.rl" */
/* #line 510 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Reason NOT IMPLEMENTED");
}
goto st1306;
tr967:
/* #line 502 "tsip_parser_header.rl" */
/* #line 516 "tsip_parser_header.rl" */
{
tsip_header_Record_Route_t *header = tsip_header_Record_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -682,49 +696,49 @@ tr967:
}
goto st1306;
tr980:
/* #line 518 "tsip_parser_header.rl" */
/* #line 532 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Refer_To NOT IMPLEMENTED");
}
goto st1306;
tr990:
/* #line 524 "tsip_parser_header.rl" */
/* #line 538 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Referred_By NOT IMPLEMENTED");
}
goto st1306;
tr999:
/* #line 512 "tsip_parser_header.rl" */
/* #line 526 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Refer_Sub NOT IMPLEMENTED");
}
goto st1306;
tr1016:
/* #line 530 "tsip_parser_header.rl" */
/* #line 544 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Reject_Contact NOT IMPLEMENTED");
}
goto st1306;
tr1028:
/* #line 536 "tsip_parser_header.rl" */
/* #line 550 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Replaces NOT IMPLEMENTED");
}
goto st1306;
tr1037:
/* #line 542 "tsip_parser_header.rl" */
/* #line 556 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Reply_To NOT IMPLEMENTED");
}
goto st1306;
tr1060:
/* #line 548 "tsip_parser_header.rl" */
/* #line 562 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Request_Disposition NOT IMPLEMENTED");
}
goto st1306;
tr1068:
/* #line 554 "tsip_parser_header.rl" */
/* #line 568 "tsip_parser_header.rl" */
{
tsip_header_Require_t *header = tsip_header_Require_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -734,91 +748,113 @@ tr1068:
}
goto st1306;
tr1088:
/* #line 564 "tsip_parser_header.rl" */
/* #line 578 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Resource_Priority NOT IMPLEMENTED");
}
goto st1306;
tr1102:
/* #line 570 "tsip_parser_header.rl" */
/* #line 584 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Retry_After NOT IMPLEMENTED");
}
goto st1306;
tr1111:
/* #line 576 "tsip_parser_header.rl" */
/* #line 590 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Route NOT IMPLEMENTED");
tsip_header_Routes_L_t* headers = tsip_header_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
}
goto st1306;
tr1119:
/* #line 582 "tsip_parser_header.rl" */
/* #line 607 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_RSeq NOT IMPLEMENTED");
}
goto st1306;
tr1145:
/* #line 588 "tsip_parser_header.rl" */
/* #line 613 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Security_Client NOT IMPLEMENTED");
}
goto st1306;
tr1156:
/* #line 594 "tsip_parser_header.rl" */
/* #line 619 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Security_Server NOT IMPLEMENTED");
}
goto st1306;
tr1167:
/* #line 600 "tsip_parser_header.rl" */
/* #line 625 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Security_Verify NOT IMPLEMENTED");
}
goto st1306;
tr1177:
/* #line 606 "tsip_parser_header.rl" */
/* #line 631 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Server NOT IMPLEMENTED");
}
goto st1306;
tr1191:
/* #line 612 "tsip_parser_header.rl" */
/* #line 637 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Service_Route NOT IMPLEMENTED");
tsip_header_Service_Routes_L_t* headers = tsip_header_Service_Route_parse(state->tag_start, (state->tag_end-state->tag_start));
if(headers)
{
tsk_list_item_t *item;
tsk_list_foreach(item, headers)
{
tsip_header_Service_Route_t *hdr = tsk_object_ref(item->data);
tsk_list_push_back_data(message->headers, ((void**) &hdr));
}
TSK_OBJECT_SAFE_FREE(headers);
}
}
goto st1306;
tr1208:
/* #line 618 "tsip_parser_header.rl" */
/* #line 654 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Session_Expires NOT IMPLEMENTED");
}
goto st1306;
tr1221:
/* #line 624 "tsip_parser_header.rl" */
/* #line 660 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_SIP_ETag NOT IMPLEMENTED");
}
goto st1306;
tr1234:
/* #line 630 "tsip_parser_header.rl" */
/* #line 666 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_SIP_If_Match NOT IMPLEMENTED");
}
goto st1306;
tr1247:
/* #line 636 "tsip_parser_header.rl" */
/* #line 672 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Subject NOT IMPLEMENTED");
}
goto st1306;
tr1267:
/* #line 642 "tsip_parser_header.rl" */
/* #line 678 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("PARSE_HEADER_ACCEPT NOT IMPLEMENTED");
}
goto st1306;
tr1278:
/* #line 648 "tsip_parser_header.rl" */
/* #line 684 "tsip_parser_header.rl" */
{
tsip_header_Supported_t *header = tsip_header_Supported_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -828,19 +864,19 @@ tr1278:
}
goto st1306;
tr1298:
/* #line 658 "tsip_parser_header.rl" */
/* #line 694 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Target_Dialog NOT IMPLEMENTED");
}
goto st1306;
tr1311:
/* #line 664 "tsip_parser_header.rl" */
/* #line 700 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Timestamp NOT IMPLEMENTED");
}
goto st1306;
tr1317:
/* #line 670 "tsip_parser_header.rl" */
/* #line 706 "tsip_parser_header.rl" */
{
if(!message->To)
{
@ -849,13 +885,13 @@ tr1317:
}
goto st1306;
tr1334:
/* #line 679 "tsip_parser_header.rl" */
/* #line 715 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Unsupported NOT IMPLEMENTED");
}
goto st1306;
tr1348:
/* #line 685 "tsip_parser_header.rl" */
/* #line 721 "tsip_parser_header.rl" */
{
tsip_header_User_Agent_t *header = tsip_header_User_Agent_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -865,7 +901,7 @@ tr1348:
}
goto st1306;
tr1356:
/* #line 695 "tsip_parser_header.rl" */
/* #line 731 "tsip_parser_header.rl" */
{
if(!message->firstVia)
{
@ -882,13 +918,13 @@ tr1356:
}
goto st1306;
tr1369:
/* #line 712 "tsip_parser_header.rl" */
/* #line 748 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Warning NOT IMPLEMENTED");
}
goto st1306;
tr1389:
/* #line 718 "tsip_parser_header.rl" */
/* #line 754 "tsip_parser_header.rl" */
{
tsip_header_WWW_Authenticate_t *header = tsip_header_WWW_Authenticate_parse(state->tag_start, (state->tag_end-state->tag_start));
if(header)
@ -898,11 +934,11 @@ tr1389:
}
goto st1306;
tr1396:
/* #line 183 "tsip_parser_header.rl" */
/* #line 186 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("PARSE_HEADER_ACCEPT NOT IMPLEMENTED");
}
/* #line 234 "tsip_parser_header.rl" */
/* #line 237 "tsip_parser_header.rl" */
{
TSK_DEBUG_ERROR("parse_header_Event NOT IMPLEMENTED");
}
@ -911,7 +947,7 @@ st1306:
if ( ++p == pe )
goto _test_eof1306;
case 1306:
/* #line 915 "../source/parsers/tsip_parser_header.c" */
/* #line 951 "../src/parsers/tsip_parser_header.c" */
goto st0;
st12:
if ( ++p == pe )
@ -13614,7 +13650,7 @@ case 1305:
_out: {}
}
/* #line 751 "tsip_parser_header.rl" */
/* #line 787 "tsip_parser_header.rl" */
return (cs == tsip_machine_parser_headers_first_final);
}

View File

@ -42,7 +42,7 @@
* Ragel state machine.
*/
/* #line 139 "tsip_parser_uri.rl" */
/* #line 138 "tsip_parser_uri.rl" */
////////////////////////////////////////////////////////////////////////////////////////////////////
@ -82,7 +82,7 @@ static const int tsip_machine_parser_uri_en_sip_usrinfo = 65;
static const int tsip_machine_parser_uri_en_main = 73;
/* #line 169 "tsip_parser_uri.rl" */
/* #line 168 "tsip_parser_uri.rl" */
/* #line 88 "../src/parsers/tsip_parser_uri.c" */
{
@ -92,7 +92,7 @@ static const int tsip_machine_parser_uri_en_main = 73;
act = 0;
}
/* #line 170 "tsip_parser_uri.rl" */
/* #line 169 "tsip_parser_uri.rl" */
/* #line 98 "../src/parsers/tsip_parser_uri.c" */
{
@ -101,11 +101,11 @@ static const int tsip_machine_parser_uri_en_main = 73;
switch ( cs )
{
tr13:
/* #line 130 "tsip_parser_uri.rl" */
/* #line 129 "tsip_parser_uri.rl" */
{{p = ((te))-1;}{ }}
goto st73;
tr21:
/* #line 116 "tsip_parser_uri.rl" */
/* #line 115 "tsip_parser_uri.rl" */
{{p = ((te))-1;}{
SCANNER_SET_STRING(uri->host);
if(uri->host_type == host_ipv6)
@ -115,11 +115,11 @@ tr21:
}}
goto st73;
tr28:
/* #line 113 "tsip_parser_uri.rl" */
/* #line 112 "tsip_parser_uri.rl" */
{{p = ((te))-1;}{ }}
goto st73;
tr40:
/* #line 116 "tsip_parser_uri.rl" */
/* #line 115 "tsip_parser_uri.rl" */
{te = p+1;{
SCANNER_SET_STRING(uri->host);
if(uri->host_type == host_ipv6)
@ -129,11 +129,11 @@ tr40:
}}
goto st73;
tr93:
/* #line 131 "tsip_parser_uri.rl" */
/* #line 130 "tsip_parser_uri.rl" */
{te = p;p--;{ }}
goto st73;
tr94:
/* #line 116 "tsip_parser_uri.rl" */
/* #line 115 "tsip_parser_uri.rl" */
{te = p;p--;{
SCANNER_SET_STRING(uri->host);
if(uri->host_type == host_ipv6)
@ -143,56 +143,56 @@ tr94:
}}
goto st73;
tr97:
/* #line 125 "tsip_parser_uri.rl" */
/* #line 124 "tsip_parser_uri.rl" */
{te = p;p--;{
ts++;
SCANNER_SET_INTEGER(uri->port);
}}
goto st73;
tr99:
/* #line 91 "tsip_parser_uri.rl" */
/* #line 90 "tsip_parser_uri.rl" */
{
PARSER_ADD_PARAM(uri->params);
}
/* #line 130 "tsip_parser_uri.rl" */
/* #line 129 "tsip_parser_uri.rl" */
{te = p;p--;{ }}
goto st73;
tr109:
/* #line 56 "tsip_parser_uri.rl" */
/* #line 55 "tsip_parser_uri.rl" */
{ uri->scheme = tsk_strdup("sip"), uri->type = uri_sip; }
/* #line 106 "tsip_parser_uri.rl" */
/* #line 105 "tsip_parser_uri.rl" */
{te = p;p--;{
if(tsk_strcontains(te, "@"))
if(tsk_strcontains(te, (pe - te), "@"))
{
{goto st65;}
}
}}
goto st73;
tr111:
/* #line 57 "tsip_parser_uri.rl" */
/* #line 56 "tsip_parser_uri.rl" */
{ uri->scheme = tsk_strdup("sips"), uri->type = uri_sips; }
/* #line 106 "tsip_parser_uri.rl" */
/* #line 105 "tsip_parser_uri.rl" */
{te = p;p--;{
if(tsk_strcontains(te, "@"))
if(tsk_strcontains(te, (pe - te), "@"))
{
{goto st65;}
}
}}
goto st73;
tr115:
/* #line 71 "tsip_parser_uri.rl" */
/* #line 70 "tsip_parser_uri.rl" */
{
PARSER_SET_STRING(uri->user_name);
PARSER_SET_STRING(uri->user_name);
}
/* #line 113 "tsip_parser_uri.rl" */
/* #line 112 "tsip_parser_uri.rl" */
{te = p;p--;{ }}
goto st73;
tr118:
/* #line 91 "tsip_parser_uri.rl" */
/* #line 90 "tsip_parser_uri.rl" */
{
PARSER_ADD_PARAM(uri->params);
}
/* #line 113 "tsip_parser_uri.rl" */
/* #line 112 "tsip_parser_uri.rl" */
{te = p;p--;{ }}
goto st73;
st73:
@ -228,7 +228,7 @@ st74:
case 74:
goto st74;
tr86:
/* #line 61 "tsip_parser_uri.rl" */
/* #line 60 "tsip_parser_uri.rl" */
{ uri->host_type = uri->host_type = host_ipv4; }
goto st1;
st1:
@ -391,7 +391,6 @@ tr16:
{te = p+1;}
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
goto st80;
@ -399,7 +398,7 @@ st80:
if ( ++p == pe )
goto _test_eof80;
case 80:
/* #line 403 "../src/parsers/tsip_parser_uri.c" */
/* #line 402 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 33: goto tr15;
case 37: goto st13;
@ -424,7 +423,6 @@ case 80:
tr17:
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
goto st13;
@ -432,7 +430,7 @@ st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
/* #line 436 "../src/parsers/tsip_parser_uri.c" */
/* #line 434 "../src/parsers/tsip_parser_uri.c" */
if ( (*p) < 65 ) {
if ( 48 <= (*p) && (*p) <= 57 )
goto st14;
@ -456,7 +454,7 @@ case 14:
goto tr15;
goto tr13;
tr101:
/* #line 91 "tsip_parser_uri.rl" */
/* #line 90 "tsip_parser_uri.rl" */
{
PARSER_ADD_PARAM(uri->params);
}
@ -465,7 +463,7 @@ st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
/* #line 469 "../src/parsers/tsip_parser_uri.c" */
/* #line 467 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 33: goto tr16;
case 37: goto tr17;
@ -516,7 +514,7 @@ st81:
if ( ++p == pe )
goto _test_eof81;
case 81:
/* #line 520 "../src/parsers/tsip_parser_uri.c" */
/* #line 518 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 33: goto tr18;
case 37: goto st17;
@ -566,7 +564,6 @@ case 18:
tr98:
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
goto st82;
@ -574,7 +571,7 @@ st82:
if ( ++p == pe )
goto _test_eof82;
case 82:
/* #line 578 "../src/parsers/tsip_parser_uri.c" */
/* #line 575 "../src/parsers/tsip_parser_uri.c" */
if ( (*p) < 65 ) {
if ( 48 <= (*p) && (*p) <= 57 )
goto st83;
@ -604,14 +601,14 @@ tr23:
tr89:
/* #line 1 "tsip_parser_uri.rl" */
{te = p+1;}
/* #line 63 "tsip_parser_uri.rl" */
/* #line 62 "tsip_parser_uri.rl" */
{ uri->host_type = uri->host_type = host_hostname; }
goto st84;
st84:
if ( ++p == pe )
goto _test_eof84;
case 84:
/* #line 615 "../src/parsers/tsip_parser_uri.c" */
/* #line 612 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 45: goto st19;
case 46: goto tr104;
@ -648,7 +645,7 @@ st85:
if ( ++p == pe )
goto _test_eof85;
case 85:
/* #line 652 "../src/parsers/tsip_parser_uri.c" */
/* #line 649 "../src/parsers/tsip_parser_uri.c" */
if ( (*p) < 65 ) {
if ( 48 <= (*p) && (*p) <= 57 )
goto st20;
@ -708,17 +705,16 @@ tr90:
{te = p+1;}
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
/* #line 63 "tsip_parser_uri.rl" */
/* #line 62 "tsip_parser_uri.rl" */
{ uri->host_type = uri->host_type = host_hostname; }
goto st86;
st86:
if ( ++p == pe )
goto _test_eof86;
case 86:
/* #line 722 "../src/parsers/tsip_parser_uri.c" */
/* #line 718 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 45: goto st19;
case 46: goto tr104;
@ -742,7 +738,7 @@ st87:
if ( ++p == pe )
goto _test_eof87;
case 87:
/* #line 746 "../src/parsers/tsip_parser_uri.c" */
/* #line 742 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 45: goto st19;
case 46: goto tr104;
@ -766,7 +762,7 @@ st88:
if ( ++p == pe )
goto _test_eof88;
case 88:
/* #line 770 "../src/parsers/tsip_parser_uri.c" */
/* #line 766 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 45: goto st19;
case 46: goto tr104;
@ -796,7 +792,7 @@ st90:
if ( ++p == pe )
goto _test_eof90;
case 90:
/* #line 800 "../src/parsers/tsip_parser_uri.c" */
/* #line 796 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 45: goto st19;
case 46: goto tr104;
@ -819,14 +815,14 @@ case 91:
tr91:
/* #line 1 "tsip_parser_uri.rl" */
{te = p+1;}
/* #line 63 "tsip_parser_uri.rl" */
/* #line 62 "tsip_parser_uri.rl" */
{ uri->host_type = uri->host_type = host_hostname; }
goto st92;
st92:
if ( ++p == pe )
goto _test_eof92;
case 92:
/* #line 830 "../src/parsers/tsip_parser_uri.c" */
/* #line 826 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 45: goto st19;
case 46: goto tr104;
@ -850,7 +846,7 @@ st93:
if ( ++p == pe )
goto _test_eof93;
case 93:
/* #line 854 "../src/parsers/tsip_parser_uri.c" */
/* #line 850 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 45: goto st19;
case 46: goto tr104;
@ -874,7 +870,7 @@ st94:
if ( ++p == pe )
goto _test_eof94;
case 94:
/* #line 878 "../src/parsers/tsip_parser_uri.c" */
/* #line 874 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 45: goto st19;
case 46: goto tr104;
@ -901,11 +897,10 @@ tr116:
tr27:
/* #line 1 "tsip_parser_uri.rl" */
{te = p+1;}
/* #line 58 "tsip_parser_uri.rl" */
/* #line 57 "tsip_parser_uri.rl" */
{ uri->scheme = tsk_strdup("tel"), uri->type = uri_tel; }
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
goto st95;
@ -913,18 +908,18 @@ st95:
if ( ++p == pe )
goto _test_eof95;
case 95:
/* #line 917 "../src/parsers/tsip_parser_uri.c" */
/* #line 912 "../src/parsers/tsip_parser_uri.c" */
if ( (*p) == 59 )
goto tr117;
goto tr116;
tr117:
/* #line 71 "tsip_parser_uri.rl" */
/* #line 70 "tsip_parser_uri.rl" */
{
PARSER_SET_STRING(uri->user_name);
PARSER_SET_STRING(uri->user_name);
}
goto st24;
tr120:
/* #line 91 "tsip_parser_uri.rl" */
/* #line 90 "tsip_parser_uri.rl" */
{
PARSER_ADD_PARAM(uri->params);
}
@ -933,7 +928,7 @@ st24:
if ( ++p == pe )
goto _test_eof24;
case 24:
/* #line 937 "../src/parsers/tsip_parser_uri.c" */
/* #line 932 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 33: goto tr29;
case 37: goto tr30;
@ -962,7 +957,6 @@ tr29:
{te = p+1;}
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
goto st96;
@ -970,7 +964,7 @@ st96:
if ( ++p == pe )
goto _test_eof96;
case 96:
/* #line 974 "../src/parsers/tsip_parser_uri.c" */
/* #line 968 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 33: goto tr32;
case 37: goto st25;
@ -995,7 +989,6 @@ case 96:
tr30:
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
goto st25;
@ -1003,7 +996,7 @@ st25:
if ( ++p == pe )
goto _test_eof25;
case 25:
/* #line 1007 "../src/parsers/tsip_parser_uri.c" */
/* #line 1000 "../src/parsers/tsip_parser_uri.c" */
if ( (*p) < 65 ) {
if ( 48 <= (*p) && (*p) <= 57 )
goto st26;
@ -1057,7 +1050,7 @@ st97:
if ( ++p == pe )
goto _test_eof97;
case 97:
/* #line 1061 "../src/parsers/tsip_parser_uri.c" */
/* #line 1054 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 33: goto tr33;
case 37: goto st28;
@ -1105,14 +1098,14 @@ case 29:
goto tr33;
goto tr28;
tr92:
/* #line 62 "tsip_parser_uri.rl" */
/* #line 61 "tsip_parser_uri.rl" */
{ uri->host_type = uri->host_type = host_ipv6; }
goto st30;
st30:
if ( ++p == pe )
goto _test_eof30;
case 30:
/* #line 1116 "../src/parsers/tsip_parser_uri.c" */
/* #line 1109 "../src/parsers/tsip_parser_uri.c" */
if ( (*p) == 58 )
goto st64;
if ( (*p) < 65 ) {
@ -1538,7 +1531,7 @@ st65:
if ( ++p == pe )
goto _test_eof65;
case 65:
/* #line 1542 "../src/parsers/tsip_parser_uri.c" */
/* #line 1535 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 33: goto tr71;
case 37: goto tr72;
@ -1560,7 +1553,6 @@ case 65:
tr71:
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
goto st66;
@ -1568,7 +1560,7 @@ st66:
if ( ++p == pe )
goto _test_eof66;
case 66:
/* #line 1572 "../src/parsers/tsip_parser_uri.c" */
/* #line 1564 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 33: goto st66;
case 37: goto st67;
@ -1590,7 +1582,6 @@ case 66:
tr72:
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
goto st67;
@ -1598,7 +1589,7 @@ st67:
if ( ++p == pe )
goto _test_eof67;
case 67:
/* #line 1602 "../src/parsers/tsip_parser_uri.c" */
/* #line 1593 "../src/parsers/tsip_parser_uri.c" */
if ( (*p) < 65 ) {
if ( 48 <= (*p) && (*p) <= 57 )
goto st68;
@ -1622,16 +1613,16 @@ case 68:
goto st66;
goto st0;
tr75:
/* #line 71 "tsip_parser_uri.rl" */
/* #line 70 "tsip_parser_uri.rl" */
{
PARSER_SET_STRING(uri->user_name);
PARSER_SET_STRING(uri->user_name);
}
goto st69;
st69:
if ( ++p == pe )
goto _test_eof69;
case 69:
/* #line 1635 "../src/parsers/tsip_parser_uri.c" */
/* #line 1626 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 33: goto tr78;
case 37: goto tr79;
@ -1655,7 +1646,6 @@ case 69:
tr78:
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
goto st70;
@ -1663,7 +1653,7 @@ st70:
if ( ++p == pe )
goto _test_eof70;
case 70:
/* #line 1667 "../src/parsers/tsip_parser_uri.c" */
/* #line 1657 "../src/parsers/tsip_parser_uri.c" */
switch( (*p) ) {
case 33: goto st70;
case 37: goto st71;
@ -1687,7 +1677,6 @@ case 70:
tr79:
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
goto st71;
@ -1695,7 +1684,7 @@ st71:
if ( ++p == pe )
goto _test_eof71;
case 71:
/* #line 1699 "../src/parsers/tsip_parser_uri.c" */
/* #line 1688 "../src/parsers/tsip_parser_uri.c" */
if ( (*p) < 65 ) {
if ( 48 <= (*p) && (*p) <= 57 )
goto st72;
@ -1719,39 +1708,38 @@ case 72:
goto st70;
goto st0;
tr76:
/* #line 71 "tsip_parser_uri.rl" */
/* #line 70 "tsip_parser_uri.rl" */
{
PARSER_SET_STRING(uri->user_name);
PARSER_SET_STRING(uri->user_name);
}
/* #line 102 "tsip_parser_uri.rl" */
/* #line 101 "tsip_parser_uri.rl" */
{ {goto st73;} }
goto st98;
tr80:
/* #line 50 "tsip_parser_uri.rl" */
{
TSK_DEBUG_INFO("URI::TAG");
tag_start = p;
}
/* #line 76 "tsip_parser_uri.rl" */
/* #line 75 "tsip_parser_uri.rl" */
{
PARSER_SET_STRING(uri->password);
PARSER_SET_STRING(uri->password);
}
/* #line 102 "tsip_parser_uri.rl" */
/* #line 101 "tsip_parser_uri.rl" */
{ {goto st73;} }
goto st98;
tr83:
/* #line 76 "tsip_parser_uri.rl" */
/* #line 75 "tsip_parser_uri.rl" */
{
PARSER_SET_STRING(uri->password);
PARSER_SET_STRING(uri->password);
}
/* #line 102 "tsip_parser_uri.rl" */
/* #line 101 "tsip_parser_uri.rl" */
{ {goto st73;} }
goto st98;
st98:
if ( ++p == pe )
goto _test_eof98;
case 98:
/* #line 1755 "../src/parsers/tsip_parser_uri.c" */
/* #line 1743 "../src/parsers/tsip_parser_uri.c" */
goto st0;
}
_test_eof73: cs = 73; goto _test_eof;
@ -1904,12 +1892,12 @@ case 98:
_out: {}
}
/* #line 171 "tsip_parser_uri.rl" */
/* #line 170 "tsip_parser_uri.rl" */
if( cs <
/* #line 1911 "../src/parsers/tsip_parser_uri.c" */
/* #line 1899 "../src/parsers/tsip_parser_uri.c" */
73
/* #line 172 "tsip_parser_uri.rl" */
/* #line 171 "tsip_parser_uri.rl" */
)
{
TSK_DEBUG_ERROR("Failed to parse SIP/SIPS/TEL URI.");

View File

@ -151,7 +151,6 @@ size_t tsip_transport_send(const tsip_transport_t* self, const char *branch, tsi
if(buffer)
{
tsip_message_tostring(msg, buffer);
printf(buffer->data);
if(buffer->size >1300)
{

View File

@ -490,9 +490,19 @@ int tsip_stack_destroy(tsip_stack_handle_t *self)
{
tsip_stack_t *stack = self;
TSK_FREE(stack->display_name);
TSK_OBJECT_SAFE_FREE(stack->public_identity);
TSK_OBJECT_SAFE_FREE(stack->preferred_identity);
//TSK_OBJECT_SAFE_FREE(stack->associated_identity);
TSK_FREE(stack->private_identity);
TSK_FREE(stack->password);
TSK_OBJECT_SAFE_FREE(stack->timer_mgr);
TSK_OBJECT_SAFE_FREE(stack->operations);
TSK_OBJECT_SAFE_FREE(stack->service_routes);
TSK_OBJECT_SAFE_FREE(stack->paths);
TSK_OBJECT_SAFE_FREE(stack->layer_dialog);
TSK_OBJECT_SAFE_FREE(stack->layer_transac);
TSK_OBJECT_SAFE_FREE(stack->layer_transport);

View File

@ -262,23 +262,41 @@ int tsip_message_tostring(const tsip_message_t *self, tsk_buffer_t *output)
}
/* First Via */
if(self->firstVia) tsip_header_tostring(TSIP_HEADER(self->firstVia), output);
if(self->firstVia){
tsip_header_tostring(TSIP_HEADER(self->firstVia), output);
}
/* From */
if(self->From) tsip_header_tostring(TSIP_HEADER(self->From), output);
if(self->From){
tsip_header_tostring(TSIP_HEADER(self->From), output);
}
/* To */
if(self->To) tsip_header_tostring(TSIP_HEADER(self->To), output);
if(self->To){
tsip_header_tostring(TSIP_HEADER(self->To), output);
}
/* Contact */
if(self->Contact) tsip_header_tostring(TSIP_HEADER(self->Contact), output);
if(self->Contact){
tsip_header_tostring(TSIP_HEADER(self->Contact), output);
}
/* Call_id */
if(self->Call_ID) tsip_header_tostring(TSIP_HEADER(self->Call_ID), output);
if(self->Call_ID){
tsip_header_tostring(TSIP_HEADER(self->Call_ID), output);
}
/* CSeq */
if(self->CSeq) tsip_header_tostring(TSIP_HEADER(self->CSeq), output);
if(self->CSeq){
tsip_header_tostring(TSIP_HEADER(self->CSeq), output);
}
/* Expires */
if(self->Expires) tsip_header_tostring(TSIP_HEADER(self->Expires), output);
if(self->Expires){
tsip_header_tostring(TSIP_HEADER(self->Expires), output);
}
/* Content-Type */
if(self->Content_Type) tsip_header_tostring(TSIP_HEADER(self->Content_Type), output);
if(self->Content_Type){
tsip_header_tostring(TSIP_HEADER(self->Content_Type), output);
}
/* Content-Length*/
if(self->Content_Length) tsip_header_tostring(TSIP_HEADER(self->Content_Length), output);
if(self->Content_Length){
tsip_header_tostring(TSIP_HEADER(self->Content_Length), output);
}
/* All other headers */
{
@ -294,8 +312,7 @@ int tsip_message_tostring(const tsip_message_t *self, tsk_buffer_t *output)
tsk_buffer_append(output, "\r\n", 2);
/* CONTENT */
if(TSIP_MESSAGE_HAS_CONTENT(self))
{
if(TSIP_MESSAGE_HAS_CONTENT(self)){
tsk_buffer_append(output, TSK_BUFFER_TO_STRING(self->Content), TSK_BUFFER_SIZE(self->Content));
}
@ -315,7 +332,7 @@ tsip_request_t *tsip_request_new(const char* method, const tsip_uri_t *request_u
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_CALL_ID_VA_ARGS(call_id));
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_CSEQ_VA_ARGS(cseq, method));
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_MAX_FORWARDS_VA_ARGS(TSIP_HEADER_MAX_FORWARDS_DEFAULT));
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_USER_AGENT_VA_ARGS(TSIP_HEADER_USER_AGENT_DEFAULT));
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_USER_AGENT_VA_ARGS(/*TSIP_HEADER_USER_AGENT_DEFAULT*/"IM-client/OMA1.0 Mercuro-Gold/v4.0.1610.0"));
/*request->From = TSIP_HEADER_FROM_CREATE(0, from, 0);

View File

@ -78,24 +78,31 @@ int __tsip_uri_serialize(const tsip_uri_t *uri, int with_params, tsk_buffer_t *o
int tsip_uri_serialize(const tsip_uri_t *uri, int with_params, int quote, tsk_buffer_t *output)
{
if(quote)
if(uri)
{
if(uri->display_name)
if(quote)
{
tsk_buffer_appendEx(output, "\"%s\"", uri->display_name);
if(uri->display_name)
{
tsk_buffer_appendEx(output, "\"%s\"", uri->display_name);
}
tsk_buffer_append(output, "<", 1);
__tsip_uri_serialize(uri, with_params, output);
tsk_buffer_append(output, ">", 1);
return 0;
}
else
{
__tsip_uri_serialize(uri, with_params, output);
tsk_buffer_append(output, "<", 1);
__tsip_uri_serialize(uri, with_params, output);
tsk_buffer_append(output, ">", 1);
return 0;
return 0;
}
}
else
{
__tsip_uri_serialize(uri, with_params, output);
return 0;
TSK_DEBUG_ERROR("Cannot serialize NULL URI.");
}
return -1;

View File

@ -23,11 +23,11 @@
#define _TEST_SIPMESSAGES_H
#define SIP_REQUEST \
"REGISTER sip:ims-network.com SIP/2.0\r\n" \
"REGISTER sip:open-ims.test SIP/2.0\r\n" \
"Test-Header: 0\r\n" \
"v: SIP/2.0/UDP [::]:1988;test=1234;comp=sigcomp;rport=254;ttl=457;received=192.0.2.101;branch=z9hG4bK1245420841406\r\n" \
"f: \"Mamadou\" <sip:mamadou@ims-network.com>;tag=29358\r\n" \
"t: <sip:mamadou@ims-network.com>;tag= 12345\r\n" \
"f: \"Mamadou\" <sip:mamadou@open-ims.test>;tag=29358\r\n" \
"t: <sip:mamadou@open-ims.test>;tag= 12345\r\n" \
"i: M-fa53180346f7f55ceb8d8670f9223dbb\r\n" \
"CSeq: 201 REGISTER\r\n" \
"Max-Forwards: 70\r\n" \
@ -37,8 +37,10 @@
"m: <sip:mamadou@[::]:1988;comp=sigcomp;transport=udp>;expires=600000;+deviceID=\"3ca50bcb-7a67-44f1-afd0-994a55f930f4\";mobility=\"fixed\";+g.3gpp.cs-voice;+g.3gpp.app%5fref=\"urn%3Aurnxxx%3A3gpp-application.ims.iari.gsmais\";+g.oma.sip-im.large-message;+g.oma.sip-im\r\n" \
"User-Agent: IM-client/OMA1.0 doubango/v0.0.0\r\n" \
"Require: pref, path\r\n" \
"Service-Route: <sip:orig@open-ims.test:6060;lr>,<sip:orig2@open-ims.test:6060;lr>\r\n" \
"Path: <sip:term@open-ims.test:4060;lr>\r\n" \
"Require: 100rel\r\n" \
"P-Preferred-Identity: <sip:mamadou@ims-network.com>\r\n" \
"P-Preferred-Identity: <sip:mamadou@open-ims.test>\r\n" \
"k: path\r\n" \
"k: gruu, outbound, timer\r\n" \
"P-Access-Network-Info: 3GPP-UTRAN-TDD;utran-cell-id-3gpp=00000000\r\n" \
@ -50,17 +52,19 @@
#define SIP_RESPONSE \
"SIP/2.0 200 This is my reason phrase\r\n" \
"To: <sip:mamadou@micromethod.com>;tag=bweyal\r\n" \
"To: <sip:mamadou@open-ims.test>;tag=bweyal\r\n" \
"Via: SIP/2.0/UDP 192.168.0.11:63140;branch=z9hG4bK1261611942868;rport=63140\r\n" \
"CSeq: 31516 REGISTER\r\n" \
"Content-Length: 0\r\n" \
"Call-ID: 1261611941121\r\n" \
"Min-Expires: 30\r\n" \
"From: <sip:mamadou@micromethod.com>;tag=1261611941121\r\n" \
"From: <sip:mamadou@open-ims.test>;tag=1261611941121\r\n" \
"Contact: <sip:mamadou@192.168.0.11:63140>;expires=3600;q=1.0,<sip:mamadou@192.168.0.11:56717>;expires=3600;q=1.0\r\n" \
"Contact: <sip:mamadou@127.0.0.1:5060>;expires=3600;q=1.0\r\n" \
"Contact: <sip:mamadou@127.0.0.1>;expires=3600;q=1.0\r\n" \
"P-Preferred-Identity: <sip:mamadou@ims-network.com>\r\n" \
"P-Preferred-Identity: <sip:mamadou@open-ims.test>\r\n" \
"Service-Route: <sip:orig@open-ims.test:6060;lr><sip:orig2@open-ims.test:6060;lr>,<sip:orig3@open-ims.test:6060;lr>\r\n" \
"Path: <sip:term@open-ims.test:4060;lr>\r\n" \
"P-Access-Network-Info: 3GPP-UTRAN-TDD;utran-cell-id-3gpp=00000000\r\n" \
"Authorization: Digest username=\"Alice\", realm=\"atlanta.com\",nonce=\"84a4cc6f3082121f32b42a2187831a9e\",response=\"7587245234b3434cc3412213e5f113a5432,test=123\"\r\n" \
"Privacy: none;user;id\r\n" \
@ -72,19 +76,22 @@
"\r\n"
#define SIP_MESSAGE \
"MESSAGE sip:mamadou@micromethod.com SIP/2.0\r\n" \
"MESSAGE sip:mamadou@open-ims.test SIP/2.0\r\n" \
"Via: SIP/2.0/UDP 192.168.0.11:64163;rport=4;branch=z9hG4bK1262758946486\r\n" \
"Via: SIP/2.0/UDP 192.168.0.11:59265;rport=59265;branch=z9hG4bK1263064096664\r\n" \
"Route: <sip:192.168.0.15:5060;lr=true;transport=udp\r\n" \
"From: <sip:bob@micromethod.com>;tag=mercuro\r\n" \
"To: <sip:mamadou@micromethod.com>\r\n" \
"From: <sip:bob@open-ims.test>;tag=mercuro\r\n" \
"To: <sip:mamadou@open-ims.test>\r\n" \
"Call-ID: 1262767804423\r\n" \
"CSeq: 8 MESSAGE\r\n" \
"Max-Forwards: 70\r\n" \
"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" \
"P-Preferred-Identity: <sip:bob@micromethod.com\r\n" \
"Service-Route: <sip:orig@open-ims.test:6060;lr;transport=udp>,<sip:atlanta.com>,<sip:orig2@open-ims.test:6060;lr>\r\n" \
"Path: <sip:term@open-ims.test:4060;lr>\r\n" \
"Route: <sip:pcscf.open-ims.test:4060;lr;transport=udp>,<sip:orig@scscf.open-ims.test:6060;lr>\r\n" \
"P-Preferred-Identity: <sip:bob@open-ims.test\r\n" \
"Allow-Events: presence, presence.winfo\r\n" \
"Content-Length: 11\r\n" \
"\r\n" \
@ -131,8 +138,8 @@ void test_parser()
void test_requests()
{
tsk_buffer_t *buffer = TSK_BUFFER_CREATE_NULL();
tsip_uri_t *from = tsip_uri_parse("sip:mamadou@micromethod.com", strlen("sip:mamadou@micromethod.com"));
tsip_uri_t *request_uri = tsip_uri_parse("sip:micromethod.com", strlen("sip:micromethod.com"));
tsip_uri_t *from = tsip_uri_parse("sip:mamadou@open-ims.test", strlen("sip:mamadou@open-ims.test"));
tsip_uri_t *request_uri = tsip_uri_parse("sip:open-ims.test", strlen("sip:open-ims.test"));
tsip_request_t *request = tsip_request_new("REGISTER", request_uri, from, from, "ABCDEFGHIJKLMOPQRSTUVWXYZ", 4521);

View File

@ -75,7 +75,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_handle_t *stack = tsip_stack_create(test_stack_callback,
TSIP_STACK_SET_DISPLAY_NAME("2233392625"),
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:2233392625@sip2sip.info"),
TSIP_STACK_SET_PRIVATE_IDENTITY("2233392625"),
@ -88,6 +88,21 @@ void test_stack()
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_handle_t *stack = tsip_stack_create(test_stack_callback,
TSIP_STACK_SET_DISPLAY_NAME("Mamadou"),
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:mamadou@ims.inexbee.com"),
TSIP_STACK_SET_PRIVATE_IDENTITY("mamadou@ims.inexbee.com"),
TSIP_STACK_SET_PASSWORD("mamadou"),
TSIP_STACK_SET_REALM("sip:ims.inexbee.com"), // FIXME: without sip:
TSIP_STACK_SET_LOCAL_IP(LOCAL_IP),
TSIP_STACK_SET_DISCOVERY_NAPTR(1),
//TSIP_STACK_SET_PROXY_CSCF("proxy.sipthor.net", "udp", 0),
//TSIP_STACK_SET_PROXY_CSCF_PORT(5060),
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());

View File

@ -28,6 +28,8 @@ const char* uris[] =
{
//== SIP:
"sip:open-ims.test",
"sip:pcscf.open-ims.test:4060;lr;transport=udp",
"sip:2233392625@sip2sip.info",
"sip:alice@iatlanta.com;p1=23",
"sip:*666*@atlanta.com",

View File

@ -1915,7 +1915,7 @@
Name="abnf"
>
<File
RelativePath="..\..\tinySIPabnf\core.abnf"
RelativePath="..\..\tinySIP\abnf\core.abnf"
>
</File>
</Filter>