Update HTTP stack.

This commit is contained in:
bossiel 2010-03-05 00:36:12 +00:00
parent 9c0e5fdc51
commit 0506a04219
20 changed files with 630 additions and 50 deletions

View File

@ -31,7 +31,43 @@
#include "tinyhttp_config.h"
#include "tinyHTTP/thttp_event.h"
THTTP_BEGIN_DECLS
typedef enum thttp_stack_param_type_e
{
/* Identity */
pname_usr,
pname_proxy,
pname_useragent,
#define THTTP_STACK_SET_USER(USRNAME_STR, PASSWORD_STR) pname_usr, (const char*)USRNAME_STR, (const char*)PASSWORD_STR
#define THTTP_STACK_SET_PROXY(HOST_STR, PORT_INT, USRNAME_STR, PASSWORD_STR) pname_proxy, (const char*)HOST_STR, (int)PORT_INT, (const char*)USRNAME_STR, (const char*)PASSWORD_STR
#define THTTP_STACK_SET_USER_AGENT(UA_STR) pname_useragent, (const char*)UA_STR
/* Network */
pname_local_ip,
pname_local_port,
#define THTTP_STACK_SET_LOCAL_IP(STR) pname_local_ip, (const char*)STR
#define THTTP_STACK_SET_LOCAL_PORT(INT) pname_local_port, (int)INT
pname_null,
#define THTTP_STACK_SET_NULL() pname_null
}
thttp_stack_param_type_t;
typedef void thttp_stack_handle_t;
TINYHTTP_API int thttp_global_init();
TINYHTTP_API int thttp_global_deinit();
TINYHTTP_API thttp_stack_handle_t *thttp_stack_create(thttp_stack_callback callback, ...);
TINYHTTP_API int thttp_stack_start(thttp_stack_handle_t *self);
TINYHTTP_API int thttp_stack_set(thttp_stack_handle_t *self, ...);
TINYHTTP_API int thttp_stack_stop(thttp_stack_handle_t *self);
THTTP_END_DECLS
#endif /* TINYHTTP_THTTP_H */

View File

@ -0,0 +1,59 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file thttp_event.h
* @brief HTTP/HTTPS event.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef TINYHTTP_EVENT_H
#define TINYHTTP_EVENT_H
#include "tinyhttp_config.h"
#include "tsk_object.h"
THTTP_BEGIN_DECLS
#define THTTP_EVENT_CREATE(code, phrase, message) tsk_object_new(thttp_event_def_t, code, phrase, (const thttp_message_t*)message)
#define THTTP_EVENT(self) ((thttp_event_t*)(self))
typedef struct thttp_event_s
{
TSK_DECLARE_OBJECT;
short code;
char* phrase;
struct thttp_message_s *message;
}
thttp_event_t;
typedef int (*thttp_stack_callback)(const thttp_event_t *httpevent);
TINYHTTP_GEXTERN const void *thttp_event_def_t;
THTTP_END_DECLS
#endif /* TINYHTTP_EVENT_H */

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file thttp_operation.h
* @brief HTTP/HTTPS operation.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef THTTP_OPERATION_H
#define THTTP_OPERATION_H
#include "tinyhttp_config.h"
THTTP_BEGIN_DECLS
THTTP_END_DECLS
#endif /* THTTP_OPERATION_H */

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file thttp_transport.h
* @brief HTTP/HTTPS transport.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef THTTP_TRANSPORT_H
#define THTTP_TRANSPORT_H
#include "tinyhttp_config.h"
THTTP_BEGIN_DECLS
THTTP_END_DECLS
#endif /* THTTP_TRANSPORT_H */

View File

@ -27,10 +27,187 @@
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "thttp.h"
#include "tinyHTTP/thttp_event.h"
#include "tnet.h"
#include "tnet_transport.h"
#include "tsk_runnable.h"
#include "tsk_time.h"
#include "tsk_debug.h"
//#include <stdarg.h>
//#include <string.h>
#include <stdlib.h> /* srand */
/** @mainpage TinyHTTP API Overview
*
* This file is an overview of <b>tinyHTTP</b> API.
*
* <b>tinySAK</b> is a HTTP (RFC 2616) stack.
*/
* <b>tinyHTTP</b> is a HTTP (RFC 2616) stack.
*/
// KeepAlive : http://www.io.com/~maus/HttpKeepAlive.html
static unsigned __thttp_initialized = 0;
static void *run(void* self);
typedef struct thttp_stack_s
{
TSK_DECLARE_OBJECT;
/* Identity */
char* username;
char* password;
char* proxy_host;
int proxy_port;
char* proxy_username;
char* proxy_password;
char* user_agent;
/* Network */
char* local_ip;
int local_port;
tnet_transport_t *transport;
unsigned running;
}
thttp_stack_t;
int __thttp_stack_set(thttp_stack_t *self, va_list values)
{
thttp_stack_param_type_t curr;
while((curr=va_arg(values, thttp_stack_param_type_t)) != pname_null)
{
switch(curr)
{
//
// Identity
//
case pname_usr:
{ /* USRNAME_STR, PASSWORD_STR */
tsk_strupdate(&self->username, va_arg(values, const char*));
tsk_strupdate(&self->password, va_arg(values, const char*));
break;
}
case pname_proxy:
{ /* HOST_STR, PORT_INT, USRNAME_STR, PASSWORD_STR */
tsk_strupdate(&self->proxy_host, va_arg(values, const char*));
self->proxy_port = va_arg(values, int);
tsk_strupdate(&self->proxy_username, va_arg(values, const char*));
tsk_strupdate(&self->proxy_password, va_arg(values, const char*));
break;
}
case pname_useragent:
{ /* UA_STR */
tsk_strupdate(&self->user_agent, va_arg(values, const char*));
break;
}
//
// Network
//
case pname_local_ip:
{ /* STR */
tsk_strupdate(&self->local_ip, va_arg(values, const char*));
break;
}
case pname_local_port:
{ /* INT */
self->local_port = va_arg(values, int);
break;
}
}/* switch */
}/* while */
}
int thttp_global_init()
{
if(!__thttp_initialized)
{
srand((unsigned int) tsk_time_epoch());
if(!tnet_startup()){
__thttp_initialized = 1;
return 0;
}
}
return -1;
}
int thttp_global_deinit()
{
if(__thttp_initialized)
{
if(!tnet_cleanup()){
__thttp_initialized = 0;
return 0;
}
}
return -1;
}
thttp_stack_handle_t *thttp_stack_create(thttp_stack_callback callback, ...)
{
}
int thttp_stack_start(thttp_stack_handle_t *self)
{
}
int thttp_stack_set(thttp_stack_handle_t *self, ...)
{
}
int thttp_stack_stop(thttp_stack_handle_t *self)
{
}
int thttp_stack_start(thttp_stack_handle_t *self)
{
if(self)
{
int ret;
thttp_stack_t *stack = self;
TSK_RUNNABLE(stack)->run = run;
if(ret = tsk_runnable_start(TSK_RUNNABLE(stack), thttp_event_def_t)){
return ret;
}
}
}

View File

@ -0,0 +1,87 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file thttp_event.c
* @brief HTTP/HTTPS event.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinyHTTP/thttp_event.h"
#include "tinyHTTP/thttp_message.h"
#include "tsk_string.h"
//========================================================
// HTTP event object definition
//
static void* thttp_event_create(void * self, va_list * app)
{
thttp_event_t *httpevent = self;
if(httpevent)
{
#if defined(__GNUC__)
httpevent->code = (short)va_arg(*app, int);
#else
httpevent->code = va_arg(*app, short);
#endif
httpevent->phrase = tsk_strdup( va_arg(*app, const char *) );
httpevent->message = tsk_object_ref((void*)va_arg(*app, thttp_message_t *));
}
return self;
}
static void* thttp_event_destroy(void * self)
{
thttp_event_t *httpevent = self;
if(httpevent)
{
TSK_FREE(httpevent->phrase);
TSK_OBJECT_SAFE_FREE(httpevent->message);
}
return self;
}
static int thttp_event_cmp(const void *obj1, const void *obj2)
{
return -1;
}
static const tsk_object_def_t thttp_event_def_s =
{
sizeof(thttp_event_t),
thttp_event_create,
thttp_event_destroy,
thttp_event_cmp,
};
const void *thttp_event_def_t = &thttp_event_def_s;

View File

@ -0,0 +1,30 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file thttp_operation.c
* @brief HTTP/HTTPS operation.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinyHTTP/thttp_operation.h"

View File

@ -0,0 +1,30 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file thttp_transport.c
* @brief HTTP/HTTPS transport.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tinyHTTP/thttp_transport.h"

View File

@ -26,14 +26,17 @@
#include "tsk.h"
#include "thttp.h"
#include "tinyHTTP/auth/thttp_auth.h"
#define LOOP 1
#define RUN_TEST_ALL 0
#define RUN_TEST_AUTH 1
#define RUN_TEST_AUTH 0
#define RUN_TEST_STACK 1
#include "test_auth.h"
#include "test_stack.h"
#ifdef _WIN32_WCE
@ -42,21 +45,27 @@ int _tmain(int argc, _TCHAR* argv[])
int main()
#endif
{
thttp_global_init();
#if LOOP
while(1)
for(;;)
#endif
{
/* Print copyright information */
printf("Doubango Project\nCopyright (C) 2009 Mamadou Diop \n\n");
printf("Doubango Project\nCopyright (C) 2009-2010 Mamadou Diop \n\n");
#if RUN_TEST_AUTH || RUN_TEST_ALL
test_basic_auth();
test_digest_auth();
#endif
#if RUN_TEST_STACK || RUN_TEST_ALL
test_stack();
#endif
}
getchar();
thttp_global_deinit();
return 0;
}

View File

@ -206,6 +206,10 @@
RelativePath=".\test_auth.h"
>
</File>
<File
RelativePath=".\test_stack.h"
>
</File>
</Filter>
<File
RelativePath=".\ReadMe.txt"

View File

@ -0,0 +1,32 @@
/*
* 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.
*
*/
#ifndef _TEST_STACK_H_
#define _TEST_STACK_H_
void test_stack()
{
}
#endif /* _TEST_STACK_H_ */

View File

@ -342,10 +342,22 @@
RelativePath=".\src\thttp.c"
>
</File>
<File
RelativePath=".\src\thttp_event.c"
>
</File>
<File
RelativePath=".\src\thttp_message.c"
>
</File>
<File
RelativePath=".\src\thttp_operation.c"
>
</File>
<File
RelativePath=".\src\thttp_transport.c"
>
</File>
<File
RelativePath=".\src\thttp_url.c"
>
@ -402,10 +414,22 @@
RelativePath=".\include\thttp.h"
>
</File>
<File
RelativePath=".\include\tinyHTTP\thttp_event.h"
>
</File>
<File
RelativePath=".\include\tinyHTTP\thttp_message.h"
>
</File>
<File
RelativePath=".\include\tinyHTTP\thttp_operation.h"
>
</File>
<File
RelativePath=".\include\tinyHTTP\thttp_transport.h"
>
</File>
<File
RelativePath=".\include\tinyHTTP\thttp_url.h"
>

View File

@ -550,7 +550,7 @@ int tipsec_boundSA(__in const tipsec_context_vista_t* context, __in UINT64 local
bundle.numSAs = 1;
bundle.saList = &sa;
bundle.ipVersion = TINYIPSEC_VISTA_GET_IPVER(TIPSEC_CONTEXT(context)->use_ipv6);
bundle.lifetime.lifetimeSeconds = (TIPSEC_CONTEXT(context)->lifetime > TINYIPSEC_SA_MAX_LIFETIME) ? TINYIPSEC_SA_MAX_LIFETIME : TIPSEC_CONTEXT(context)->lifetime;
bundle.lifetime.lifetimeSeconds = (UINT32)((TIPSEC_CONTEXT(context)->lifetime > TINYIPSEC_SA_MAX_LIFETIME) ? TINYIPSEC_SA_MAX_LIFETIME : TIPSEC_CONTEXT(context)->lifetime);
/* From remote to local (inbound) ? */
if(toInbound){

View File

@ -65,7 +65,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib IPHLPAPI.lib $(OutDir)\tinySAK.lib"
AdditionalDependencies="ws2_32.lib IPHLPAPI.lib &quot;$(OutDir)\tinySAK.lib&quot; &quot;$(DOUBANGO_HOME)\thirdparties\win32\lib\openssl\libeay32.lib&quot; &quot;$(DOUBANGO_HOME)\thirdparties\win32\lib\openssl\ssleay32.lib&quot;"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"

View File

@ -79,26 +79,26 @@ int tsip_transport_deinit(tsip_transport_t* self);
size_t tsip_transport_send(const tsip_transport_t* self, const char *branch, tsip_message_t *msg, const char* destIP, int32_t destPort);
tsip_uri_t* tsip_transport_get_uri(const tsip_transport_t *self, int lr);
#define tsip_transport_start(transport) (transport ? tnet_transport_start(transport->net_transport) : -1)
#define tsip_transport_isready(transport) (transport ? tnet_transport_isready(transport->net_transport) : -1)
#define tsip_transport_issecure(transport) (transport ? tnet_transport_issecure(transport->net_transport) : 0)
#define tsip_transport_isconnected(transport) (transport ? tnet_transport_isconnected(transport->net_transport, transport->connectedFD) : 0)
#define tsip_transport_get_description(transport) (transport ? tnet_transport_get_description(transport->net_transport) : 0)
#define tsip_transport_get_ip_n_port(transport, ip, port) (transport ? tnet_transport_get_ip_n_port(transport->net_transport, transport->connectedFD, ip, port) : -1)
#define tsip_transport_start(transport) (transport ? tnet_transport_start(transport->net_transport) : -1)
#define tsip_transport_isready(transport) (transport ? tnet_transport_isready(transport->net_transport) : -1)
#define tsip_transport_issecure(transport) (transport ? tnet_transport_issecure(transport->net_transport) : 0)
#define tsip_transport_isconnected(transport) (transport ? tnet_transport_isconnected(transport->net_transport, transport->connectedFD) : 0)
#define tsip_transport_get_description(transport) (transport ? tnet_transport_get_description(transport->net_transport) : 0)
#define tsip_transport_get_ip_n_port(transport, ip, port) (transport ? tnet_transport_get_ip_n_port(transport->net_transport, transport->connectedFD, ip, port) : -1)
#define tsip_transport_connectto(transport, host, port) (transport ? (transport->connectedFD=tnet_transport_connectto(transport->net_transport, host, port)) : TNET_INVALID_FD)
//#define tsip_transport_send(transport, buf, size) (transport ? tnet_transport_send(transport->net_transport, transport->connectedFD, buf, size) : 0)
#define tsip_transport_sendto(transport, to, buf, size) (transport ? tnet_transport_sendto(transport->net_transport, transport->connectedFD, to, buf, size) : 0)
#define tsip_transport_connectto(transport, host, port, type) (transport ? (transport->connectedFD=tnet_transport_connectto(transport->net_transport, host, port, type)) : TNET_INVALID_FD)
#define tsip_transport_connectto2(transport, host, port) (transport ? (transport->connectedFD=tnet_transport_connectto2(transport->net_transport, host, port)) : TNET_INVALID_FD)
#define tsip_transport_sendto(transport, to, buf, size) (transport ? tnet_transport_sendto(transport->net_transport, transport->connectedFD, to, buf, size) : 0)
#define tsip_transport_set_callback(transport, callback, callback_data) (transport ? tnet_transport_set_callback(transport->net_transport, callback, callback_data) : -1)
#define tsip_transport_set_callback(transport, callback, callback_data) (transport ? tnet_transport_set_callback(transport->net_transport, callback, callback_data) : -1)
#define tsip_transport_have_socket(transport, fd) (transport ? tnet_transport_have_socket(transport->net_transport, fd) : 0)
#define tsip_transport_add_socket(transport, fd, take_ownership) (transport ? tnet_transport_add_socket(transport->net_transport, fd, take_ownership) : -1)
#define tsip_transport_remove_socket(transport, fd) (transport ? tnet_transport_remove_socket(transport->net_transport, fd) : -1)
#define tsip_transport_have_socket(transport, fd) (transport ? tnet_transport_have_socket(transport->net_transport, fd) : 0)
#define tsip_transport_add_socket(transport, fd, type, take_ownership, isClient) (transport ? tnet_transport_add_socket(transport->net_transport, fd, type, take_ownership, isClient) : -1)
#define tsip_transport_remove_socket(transport, fd) (transport ? tnet_transport_remove_socket(transport->net_transport, fd) : -1)
//#define tsip_transport_get_socket_type(transport) (transport ? tnet_transport_get_socket_type(transport->net_transport) : tnet_socket_type_invalid)
//#define tsip_transport_get_socket_type(transport) (transport ? tnet_transport_get_socket_type(transport->net_transport) : tnet_socket_type_invalid)
#define tsip_transport_shutdown(transport) (transport ? tnet_transport_shutdown(transport->net_transport) : -1)
#define tsip_transport_shutdown(transport) (transport ? tnet_transport_shutdown(transport->net_transport) : -1)
TINYSIP_GEXTERN const void *tsip_transport_def_t;

View File

@ -462,8 +462,8 @@ static void* tsip_ipsec_association_create(void * self, va_list * app)
association->socket_uc = TNET_SOCKET_CREATE(ip_local, TNET_SOCKET_PORT_ANY, transport->type);
/* Add Both sockets to the network transport */
tsip_transport_add_socket(transport, association->socket_us->fd, 0);
tsip_transport_add_socket(transport, association->socket_uc->fd, 0);
tsip_transport_add_socket(transport, association->socket_us->fd, transport->type, 0, 0);
tsip_transport_add_socket(transport, association->socket_uc->fd, transport->type, 0, 1);
/* Set local */
if(!tnet_get_peerip(transport->connectedFD, &ip_remote)){ /* Get remote IP string */

View File

@ -474,7 +474,7 @@ int tsip_transport_layer_start(const tsip_transport_layer_t* self)
}
tsip_transport_set_callback(transport, TNET_SOCKET_TYPE_IS_DGRAM(transport->type) ? TNET_TRANSPORT_DATA_READ(tsip_transport_layer_dgram_data_read) : TNET_TRANSPORT_DATA_READ(tsip_transport_layer_stream_data_read), transport);
tsip_transport_connectto(transport, TSIP_STACK(self->stack)->proxy_cscf, TSIP_STACK(self->stack)->proxy_cscf_port);
tsip_transport_connectto2(transport, TSIP_STACK(self->stack)->proxy_cscf, TSIP_STACK(self->stack)->proxy_cscf_port);
}
/* FIXME: CONNECTED ?*/

View File

@ -276,8 +276,8 @@ int __tsip_stack_set(tsip_stack_t *self, va_list values)
{
return -1;
}
}
}
}/* switch */
}/* while */
return 0;
}
@ -368,8 +368,7 @@ int tsip_stack_start(tsip_stack_handle_t *self)
tsip_stack_t *stack = self;
TSK_RUNNABLE(stack)->run = run;
if(ret = tsk_runnable_start(TSK_RUNNABLE(stack), tsip_event_def_t))
{
if(ret = tsk_runnable_start(TSK_RUNNABLE(stack), tsip_event_def_t)){
return ret;
}
@ -686,7 +685,7 @@ void *run(void* self)
TSK_RUNNABLE_RUN_BEGIN(stack);
TSK_DEBUG_INFO("STACK::run -- START");
TSK_DEBUG_INFO("SIP STACK::run -- START");
if((curr = TSK_RUNNABLE_POP_FIRST(stack)))
{
@ -699,6 +698,6 @@ void *run(void* self)
TSK_RUNNABLE_RUN_END(self);
TSK_DEBUG_INFO("STACK::run -- STOP");
TSK_DEBUG_INFO("SIP STACK::run -- STOP");
return 0;
}

View File

@ -34,7 +34,7 @@
#define TEST_STACK_PIDF \
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
"<presence xmlns:cp=\"urn:ietf:params:xml:ns:pidf:cipid\" xmlns:caps=\"urn:ietf:params:xml:ns:pidf:caps\" xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" xmlns:pdm=\"urn:ietf:params:xml:ns:pidf:data-model\" xmlns:p=\"urn:ietf:params:xml:ns:pidf-diff\" xmlns:op=\"urn:oma:xml:prs:pidf:oma-pres\" entity=\"sip:mamadou@ericsson.com\" xmlns=\"urn:ietf:params:xml:ns:pidf\">"\
"<presence xmlns:cp=\"urn:ietf:params:xml:ns:pidf:cipid\" xmlns:caps=\"urn:ietf:params:xml:ns:pidf:caps\" xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" xmlns:pdm=\"urn:ietf:params:xml:ns:pidf:data-model\" xmlns:p=\"urn:ietf:params:xml:ns:pidf-diff\" xmlns:op=\"urn:oma:xml:prs:pidf:oma-pres\" entity=\"sip:mamadou@"DOMAIN"\" xmlns=\"urn:ietf:params:xml:ns:pidf\">"\
" <pdm:person id=\"CRUVREZS\">"\
" <op:overriding-willingness>"\
" <op:basic>open</op:basic>"\
@ -223,13 +223,17 @@ int test_stack_callback(const tsip_event_t *sipevent)
void test_stack()
{
#define DOMAIN "ericsson.com"
//#define DOMAIN "ims.inexbee.com"
//#define DOMAIN "sip2sip.info"
/*
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_PUBLIC_IDENTITY("sip:2233392625@DOMAIN"),
TSIP_STACK_SET_PRIVATE_IDENTITY("2233392625"),
TSIP_STACK_SET_PASSWORD("d3sb7j4fb8"),
TSIP_STACK_SET_REALM("sip:sip2sip.info"), // FIXME: without sip:
TSIP_STACK_SET_REALM("sip:DOMAIN"), // 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),
@ -240,16 +244,16 @@ void test_stack()
TSIP_STACK_SET_NETINFO("ADSL;utran-cell-id-3gpp=00000000"),
TSIP_STACK_SET_PRIVACY("header;id"),
*/
/*
tsip_stack_handle_t *stack = tsip_stack_create(test_stack_callback,
TSIP_STACK_SET_DISPLAY_NAME("Mamadou"),
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:mamadou@ericsson.com"),
TSIP_STACK_SET_PRIVATE_IDENTITY("mamadou@ericsson.com"),
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:mamadou@"DOMAIN),
TSIP_STACK_SET_PRIVATE_IDENTITY("mamadou@"DOMAIN),
TSIP_STACK_SET_PASSWORD("mamadou"),
TSIP_STACK_SET_REALM("sip:ericsson.com"), // FIXME: without sip:
TSIP_STACK_SET_REALM("sip:"DOMAIN), // FIXME: without sip:
TSIP_STACK_SET_LOCAL_IP(LOCAL_IP),
//TSIP_STACK_SET_DISCOVERY_NAPTR(1),
TSIP_STACK_SET_PROXY_CSCF("192.168.0.11", "udp", 0),
TSIP_STACK_SET_PROXY_CSCF("192.168.0.11", "tcp", 0),
//TSIP_STACK_SET_PROXY_CSCF("192.168.0.15", "udp", 0),
TSIP_STACK_SET_PROXY_CSCF_PORT(5081),
//TSIP_STACK_SET_SECAGREE_IPSEC("hmac-md5-96", "null", "trans", "esp"),
@ -257,14 +261,14 @@ 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_SET_PRIVACY("header;id"),
*/
/*
tsip_stack_handle_t *stack = tsip_stack_create(test_stack_callback,
TSIP_STACK_SET_DISPLAY_NAME("Mamadou"),
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:mamadou@ims.inexbee.com"),
TSIP_STACK_SET_PRIVATE_IDENTITY("mamadou@ims.inexbee.com"),
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:mamadou@"DOMAIN),
TSIP_STACK_SET_PRIVATE_IDENTITY("mamadou@"DOMAIN),
TSIP_STACK_SET_PASSWORD("mamadou"),
TSIP_STACK_SET_REALM("sip:ims.inexbee.com"), // FIXME: without sip:
TSIP_STACK_SET_REALM("sip:"DOMAIN), // FIXME: without sip:
TSIP_STACK_SET_LOCAL_IP(LOCAL_IP),
//TSIP_STACK_SET_DISCOVERY_NAPTR(1),
TSIP_STACK_SET_PROXY_CSCF("pcscf.ims.inexbee.com", "udp", 1),
@ -276,12 +280,13 @@ void test_stack()
TSIP_STACK_SET_NETINFO("ADSL;utran-cell-id-3gpp=00000000"),
TSIP_STACK_SET_PRIVACY("header;id"),
*/
/*
tsip_stack_handle_t *stack = tsip_stack_create(test_stack_callback,
TSIP_STACK_SET_DISPLAY_NAME("Mamadou"),
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:mamadou@micromethod.com"),
TSIP_STACK_SET_PRIVATE_IDENTITY("mamadou@micromethod.com"),
TSIP_STACK_SET_PUBLIC_IDENTITY("sip:mamadou@"DOMAIN),
TSIP_STACK_SET_PRIVATE_IDENTITY("mamadou@"DOMAIN),
TSIP_STACK_SET_PASSWORD("mamadou"),
TSIP_STACK_SET_REALM("sip:micromethod.com"), // FIXME: without sip:
TSIP_STACK_SET_REALM("sip:"DOMAIN), // FIXME: without sip:
TSIP_STACK_SET_LOCAL_IP(LOCAL_IP),
//TSIP_STACK_SET_DISCOVERY_NAPTR(1),
TSIP_STACK_SET_PROXY_CSCF("192.168.16.104", "udp", 0),
@ -292,7 +297,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_SET_PRIVACY("header;id"),
*/
TSIP_STACK_SET_NULL());
tsip_operation_handle_t *op = TSIP_OPERATION_CREATE(stack,
@ -329,7 +334,7 @@ void test_stack()
/* MESSAGE */
//{
// tsip_operation_handle_t *op3 = TSIP_OPERATION_CREATE(stack,
// TSIP_OPERATION_SET_HEADER("to", "sip:laurent@micromethod.com"),
// TSIP_OPERATION_SET_HEADER("to", "sip:alice@"DOMAIN),
// TSIP_OPERATION_SET_HEADER("Accept-Contact", "*;+g.oma.sip-im"),
// TSIP_OPERATION_SET_HEADER("Content-Type", "text/plain"),
@ -343,7 +348,7 @@ void test_stack()
{
tsip_operation_handle_t *op4 = TSIP_OPERATION_CREATE(stack,
TSIP_OPERATION_SET_HEADER("expires", "30"),
TSIP_OPERATION_SET_HEADER("to", "sip:mamadou@micromethod.com"),
TSIP_OPERATION_SET_HEADER("to", "sip:mamadou@"DOMAIN),
TSIP_OPERATION_SET_HEADER("Content-Type", "application/pidf+xml"),
TSIP_OPERATION_SET_HEADER("Accept-Contact", "*;+g.oma.sip-im"),
TSIP_OPERATION_SET_HEADER("Event", "presence"),

View File

@ -809,6 +809,10 @@
RelativePath=".\src\transports\tsip_transport_layer.c"
>
</File>
<File
RelativePath=".\src\transports\tsip_transport_tls.c"
>
</File>
</Filter>
<Filter
Name="dialogs"
@ -1371,6 +1375,10 @@
RelativePath=".\include\tinysip\transports\tsip_transport_layer.h"
>
</File>
<File
RelativePath=".\include\tinysip\transports\tsip_transport_tls.h"
>
</File>
</Filter>
<Filter
Name="dialogs"