diff options
Diffstat (limited to 'branches/1.0/tinyNET/test')
-rw-r--r-- | branches/1.0/tinyNET/test/droid-makefile | 28 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/stdafx.c | 26 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/stdafx.h | 38 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/targetver.h | 15 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test.c | 116 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test.vcproj | 414 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test_auth.h | 31 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test_dhcp.h | 121 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test_dhcp6.h | 51 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test_dns.h | 227 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test_ifaces.h | 102 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test_nat.h | 219 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test_sockets.h | 64 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test_stun.h | 112 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test_tls.h | 108 | ||||
-rw-r--r-- | branches/1.0/tinyNET/test/test_transport.h | 222 |
16 files changed, 0 insertions, 1894 deletions
diff --git a/branches/1.0/tinyNET/test/droid-makefile b/branches/1.0/tinyNET/test/droid-makefile deleted file mode 100644 index 26651a2..0000000 --- a/branches/1.0/tinyNET/test/droid-makefile +++ /dev/null @@ -1,28 +0,0 @@ -APP := test
-
-CFLAGS := $(CFLAGS_COMMON) -I../src -I../../tinySAK/src
-LDFLAGS := $(LDFLAGS_COMMON) -Wl,-Bsymbolic,--whole-archive -l$(PROJECT) -ltinySAK -Wl,--entry=main
-
-all: $(APP)
-
-OBJS += $(APP).o
-
-$(APP): $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $^
-
-%.o: %.c
- $(CC) -c $(INCLUDE) $(CFLAGS) $< -o $@
-
-install: $(APP)
- $(ANDROID_SDK_ROOT)/tools/adb push $(APP) $(EXEC_DIR)/$(APP)
- $(ANDROID_SDK_ROOT)/tools/adb shell chmod 777 $(EXEC_DIR)/$(APP)
-
-run:
- $(ANDROID_SDK_ROOT)/tools/adb shell $(EXEC_DIR)/$(APP)
-
-#dbg:
-# $(MAKE) $(MAKEFILE) DEBUG="-g -DDEBUG"
-# $(MAKE) $(MAKEFILE) install
-
-clean:
- @rm -f $(OBJS) $(APP)
\ No newline at end of file diff --git a/branches/1.0/tinyNET/test/stdafx.c b/branches/1.0/tinyNET/test/stdafx.c deleted file mode 100644 index df71e1b..0000000 --- a/branches/1.0/tinyNET/test/stdafx.c +++ /dev/null @@ -1,26 +0,0 @@ -/*
-* Copyright (C) 2009 Mamadou Diop.
-*
-* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
-*
-* 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.
-*
-*/
-
-#include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/branches/1.0/tinyNET/test/stdafx.h b/branches/1.0/tinyNET/test/stdafx.h deleted file mode 100644 index b1200be..0000000 --- a/branches/1.0/tinyNET/test/stdafx.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -* Copyright (C) 2009 Mamadou Diop. -* -* Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* -* 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_TNET_STDAFX_H -#define TEST_TNET_STDAFX_H - -#ifdef WIN32 -#include "targetver.h" -#endif - -#include <stdio.h> -#include <string.h> -//#include <tchar.h> - - - -// TODO: reference additional headers your program requires here - -#endif /* TEST_TNET_STDAFX_H */ diff --git a/branches/1.0/tinyNET/test/targetver.h b/branches/1.0/tinyNET/test/targetver.h deleted file mode 100644 index 08a10a4..0000000 --- a/branches/1.0/tinyNET/test/targetver.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef TNET_TEST_TARGETVER_H
-#define TNET_TEST_TARGETVER_H
-
-// The following macros define the minimum required platform. The minimum required platform
-// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
-// your application. The macros work by enabling all features available on platform versions up to and
-// including the version specified.
-
-// Modify the following defines if you have to target a platform prior to the ones specified below.
-// Refer to MSDN for the latest info on corresponding values for different platforms.
-#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
-#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
-#endif
-
-#endif /* TNET_TEST_TARGETVER_H */
\ No newline at end of file diff --git a/branches/1.0/tinyNET/test/test.c b/branches/1.0/tinyNET/test/test.c deleted file mode 100644 index f27e05c..0000000 --- a/branches/1.0/tinyNET/test/test.c +++ /dev/null @@ -1,116 +0,0 @@ -/* -* Copyright (C) 2009 Mamadou Diop. -* -* Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* -* 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. -* -*/ -#include "stdafx.h" - -#include "tsk.h" - -#include "tinynet.h" - -#include "test_sockets.h" -#include "test_transport.h" -#include "test_auth.h" -#include "test_stun.h" -#include "test_nat.h" -#include "test_ifaces.h" -#include "test_dns.h" -#include "test_dhcp.h" -#include "test_dhcp6.h" -#include "test_tls.h" - -#define RUN_TEST_LOOP 1 - -#define RUN_TEST_ALL 0 -#define RUN_TEST_SOCKETS 0 /* FIXME: Android */ -#define RUN_TEST_TRANSPORT 0 -#define RUN_TEST_AUTH 0 -#define RUN_TEST_STUN 0 -#define RUN_TEST_NAT 1 -#define RUN_TEST_IFACES 0 -#define RUN_TEST_DNS 0 -#define RUN_TEST_DHCP 0 -#define RUN_TEST_DHCP6 0 -#define RUN_TEST_TLS 0 - -#ifdef _WIN32_WCE -int _tmain(int argc, _TCHAR* argv[]) -#else -int main() -#endif -{ - /* Startup the network stack. */ - if(tnet_startup()){ - return -1; - } - -#if RUN_TEST_LOOP - for(;;) -#endif - { - -#if RUN_TEST_ALL || RUN_TEST_SOCKETS - test_sockets(); -#endif - -#if RUN_TEST_ALL || RUN_TEST_TRANSPORT - test_transport(); -#endif - -#if RUN_TEST_ALL || RUN_TEST_AUTH - test_auth(); -#endif - -#if RUN_TEST_ALL || RUN_TEST_STUN - test_stun(); -#endif - -#if RUN_TEST_ALL || RUN_TEST_NAT - test_nat(); -#endif - -#if RUN_TEST_ALL || RUN_TEST_IFACES - test_ifaces(); -#endif - -#if RUN_TEST_ALL || RUN_TEST_DNS - test_dns(); -#endif - -#if RUN_TEST_ALL || RUN_TEST_DHCP - test_dhcp(); -#endif - -#if RUN_TEST_ALL || RUN_TEST_DHCP6 - test_dhcp6(); -#endif - -#if RUN_TEST_ALL || RUN_TEST_TLS - test_tls(); -#endif - - } - - /* Cleanup the network stack */ - tnet_cleanup(); - - return 0; -} - diff --git a/branches/1.0/tinyNET/test/test.vcproj b/branches/1.0/tinyNET/test/test.vcproj deleted file mode 100644 index fcf6413..0000000 --- a/branches/1.0/tinyNET/test/test.vcproj +++ /dev/null @@ -1,414 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="test"
- ProjectGUID="{2189FB5C-B2B2-4ED2-8A78-64853B55DAD5}"
- RootNamespace="test"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""$(DOUBANGO_HOME)\thirdparties\win32\include";"$(SolutionDir)\src";"$(DOUBANGO_HOME)\tinySAK\src""
- PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- WarnAsError="true"
- DebugInformationFormat="4"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib ws2_32.lib"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
- OutputDirectory=""$(SolutionDir)$(ConfigurationName)\wce""
- IntermediateDirectory=""$(SolutionDir)$(ConfigurationName)""
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="0"
- AdditionalIncludeDirectories=""$(DOUBANGO_HOME)\thirdparties\win32\include";"$(SolutionDir)\src";"$(DOUBANGO_HOME)\tinySAK\src""
- PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;_CONSOLE;_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;$(ARCHFAM);$(_ARCHFAM_)"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinyNET.lib"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="8"
- EntryPointSymbol="mainWCRTStartup"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
- OutputDirectory="$(SolutionDir)Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
- IntermediateDirectory="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)\$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="1"
- />
- <Tool
- Name="VCCLCompilerTool"
- ExecutionBucket="7"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- CompileAs="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="0"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCCodeSignTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- <DeploymentTool
- ForceDirty="-1"
- RemoteDirectory=""
- RegisterOutput="0"
- AdditionalFiles=""
- />
- <DebuggerTool
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\stdafx.c"
- >
- </File>
- <File
- RelativePath=".\test.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\stdafx.h"
- >
- </File>
- <File
- RelativePath=".\targetver.h"
- >
- </File>
- </Filter>
- <Filter
- Name="tests"
- >
- <File
- RelativePath=".\test_auth.h"
- >
- </File>
- <File
- RelativePath=".\test_dhcp.h"
- >
- </File>
- <File
- RelativePath=".\test_dhcp6.h"
- >
- </File>
- <File
- RelativePath=".\test_dns.h"
- >
- </File>
- <File
- RelativePath=".\test_ifaces.h"
- >
- </File>
- <File
- RelativePath=".\test_nat.h"
- >
- </File>
- <File
- RelativePath=".\test_sockets.h"
- >
- </File>
- <File
- RelativePath=".\test_stun.h"
- >
- </File>
- <File
- RelativePath=".\test_tls.h"
- >
- </File>
- <File
- RelativePath=".\test_transport.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/branches/1.0/tinyNET/test/test_auth.h b/branches/1.0/tinyNET/test/test_auth.h deleted file mode 100644 index 20e96af..0000000 --- a/branches/1.0/tinyNET/test/test_auth.h +++ /dev/null @@ -1,31 +0,0 @@ -/*
-* Copyright (C) 2009 Mamadou Diop.
-*
-* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
-*
-* 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 TNET_TEST_AUTH_H
-#define TNET_TEST_AUTH_H
-
-void test_auth()
-{
-
-}
-
-#endif /* TNET_TEST_AUTH_H */
-
diff --git a/branches/1.0/tinyNET/test/test_dhcp.h b/branches/1.0/tinyNET/test/test_dhcp.h deleted file mode 100644 index 6b976aa..0000000 --- a/branches/1.0/tinyNET/test/test_dhcp.h +++ /dev/null @@ -1,121 +0,0 @@ -/*
-* Copyright (C) 2009 Mamadou Diop.
-*
-* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
-*
-* 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 TNET_TEST_DHCP_H
-#define TNET_TEST_DHCP_H
-
-
-
-void test_dhcp_discover(tnet_dhcp_ctx_t *ctx)
-{
-}
-
-void test_dhcp_offer(tnet_dhcp_ctx_t *ctx)
-{
-}
-
-void test_dhcp_request(tnet_dhcp_ctx_t *ctx)
-{
-}
-
-void test_dhcp_inform(tnet_dhcp_ctx_t *ctx)
-{
- tnet_dhcp_params_t *params = tsk_null;
- tnet_dhcp_reply_t *reply = tsk_null;
-
- params = tnet_dhcp_params_create();
- tnet_dhcp_params_add_code(params, dhcp_code_SIP_Servers_DHCP_Option); /* SIP Servers */
- tnet_dhcp_params_add_code(params, dhcp_code_Domain_Server); /* DNS Server */
-
- reply = tnet_dhcp_query_inform(ctx, params);
-
- if(reply && !TNET_DHCP_MESSAGE_IS_REPLY(reply)){
- TSK_DEBUG_ERROR("DHCP request is not expected in response to a request.");
- goto bail;
- }
-
- if(reply){
- switch(reply->type)
- {
- case dhcp_type_ack:
- {
- tsk_list_item_t *item;
- TSK_DEBUG_INFO("DHCP response type ==> ACK.");
-
- tsk_list_foreach(item, reply->options)
- {
- const tnet_dhcp_option_t *option = item->data;
-
- /* SIP SERVERS */
- if(option->code == dhcp_code_SIP_Servers_DHCP_Option)
- {
- tsk_list_item_t *item2;
- const tnet_dhcp_option_sip_t *option_sip4 = (const tnet_dhcp_option_sip_t*)option;;
- tsk_list_foreach(item2, option_sip4->servers)
- {
- const tsk_string_t *str = item2->data;
- TSK_DEBUG_INFO("DHCP-SIP_SERVER ==>%s", str->value);
- }
- }
-
- /* DNS SERVERS */
- if(option->code == dhcp_code_Domain_Server)
- {
- tsk_list_item_t *item2;
- const tnet_dhcp_option_dns_t *option_dns = (const tnet_dhcp_option_dns_t*)option;;
- tsk_list_foreach(item2, option_dns->servers)
- {
- const tsk_string_t *str = item2->data;
- TSK_DEBUG_INFO("DHCP-DNS_SERVER ==>%s", str->value);
- }
- }
- }
- break;
- }
-
- default:
- {
- break;
- }
- }
- }
- else
- {
- TSK_DEBUG_ERROR("DHCP reply is NULL.");
- goto bail;
- }
-
-bail:
- TSK_OBJECT_SAFE_FREE(reply);
- TSK_OBJECT_SAFE_FREE(params);
-
- //tsk_thread_sleep(1000);
-}
-
-void test_dhcp()
-{
- tnet_dhcp_ctx_t *ctx = tnet_dhcp_ctx_create();
- test_dhcp_inform(ctx);
-
- TSK_OBJECT_SAFE_FREE(ctx);
-}
-
-#endif /* TNET_TEST_DHCP_H */
diff --git a/branches/1.0/tinyNET/test/test_dhcp6.h b/branches/1.0/tinyNET/test/test_dhcp6.h deleted file mode 100644 index a132cca..0000000 --- a/branches/1.0/tinyNET/test/test_dhcp6.h +++ /dev/null @@ -1,51 +0,0 @@ -/*
-* Copyright (C) 2009 Mamadou Diop.
-*
-* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
-*
-* 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 TNET_TEST_DHCP6_H
-#define TNET_TEST_DHCP6_H
-
-
-
-void test_dhcp6_requestinfo(tnet_dhcp6_ctx_t *ctx)
-{
- tnet_dhcp6_option_orequest_t *orequest = tnet_dhcp6_option_orequest_create_null();
- tnet_dhcp6_reply_t* reply = 0;
-
- tnet_dhcp6_option_orequest_add_code(orequest, 24);
- tnet_dhcp6_option_orequest_add_code(orequest, 23);
- tnet_dhcp6_option_orequest_add_code(orequest, 21); /* SIP Servers Domain Name List */
- tnet_dhcp6_option_orequest_add_code(orequest, 22); /* SIP Servers IPv6 Address List */
-
- reply = tnet_dhcp6_requestinfo(ctx, orequest);
-
- TSK_OBJECT_SAFE_FREE(orequest);
- TSK_OBJECT_SAFE_FREE(reply);
-}
-
-void test_dhcp6()
-{
- tnet_dhcp6_ctx_t *ctx = tnet_dhcp6_ctx_create();
- test_dhcp6_requestinfo(ctx);
-
- TSK_OBJECT_SAFE_FREE(ctx);
-}
-
-#endif /* TNET_TEST_DHCP6_H */
diff --git a/branches/1.0/tinyNET/test/test_dns.h b/branches/1.0/tinyNET/test/test_dns.h deleted file mode 100644 index b7990b5..0000000 --- a/branches/1.0/tinyNET/test/test_dns.h +++ /dev/null @@ -1,227 +0,0 @@ -/* -* Copyright (C) 2009 Mamadou Diop. -* -* Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* -* 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 TNET_TEST_DNS_H -#define TNET_TEST_DNS_H - -//#include "tnet_utils.h" /* tnet_address_t */ - -void test_dns_query() -{ - tnet_dns_ctx_t *ctx = tnet_dns_ctx_create(); - tnet_dns_response_t *response = tsk_null; - const tsk_list_item_t* item; - const tnet_dns_rr_t* rr; - - //if((response = tnet_dns_resolve(ctx, "_sip._udp.sip2sip.info", qclass_in, qtype_srv))) - if((response = tnet_dns_resolve(ctx, "sip2sip.info", qclass_in, qtype_naptr))) - { - if(TNET_DNS_RESPONSE_IS_SUCCESS(response)){ - TSK_DEBUG_INFO("We got a success response from the DNS server."); - // loop through the answers - tsk_list_foreach(item, response->Answers){ - rr = item->data; - if(rr->qtype == qtype_naptr){ - const tnet_dns_naptr_t *naptr = (const tnet_dns_naptr_t*)rr; - - TSK_DEBUG_INFO("order=%u pref=%u flags=%s services=%s regexp=%s replacement=%s", - naptr->order, - naptr->preference, - naptr->flags, - naptr->services, - naptr->regexp, - naptr->replacement); - } - } - } - else{ - TSK_DEBUG_ERROR("We got an error response from the DNS server. Erro code: %u", response->Header.RCODE); - } - } - - tnet_dns_cache_clear(ctx); - - TSK_OBJECT_SAFE_FREE(response); - TSK_OBJECT_SAFE_FREE(ctx); - - - tsk_thread_sleep(2000); -} - -void test_dns_srv() -{ - tnet_dns_ctx_t *ctx = tnet_dns_ctx_create(); - char* hostname = 0; - tnet_port_t port = 0; - - if(!tnet_dns_query_srv(ctx, "_sip._udp.sip2sip.info", &hostname, &port)){ - TSK_DEBUG_INFO("DNS SRV succeed ==> hostname=%s and port=%u", hostname, port); - } - - TSK_FREE(hostname); - TSK_OBJECT_SAFE_FREE(ctx); - - tsk_thread_sleep(2000); -} - -void test_dns_naptr_srv() -{ - tnet_dns_ctx_t *ctx = tnet_dns_ctx_create(); - char* hostname = tsk_null; - tnet_port_t port = 0; - - if(!tnet_dns_query_naptr_srv(ctx, "sip2sip.info", "SIP+D2U", &hostname, &port)){ - TSK_DEBUG_INFO("DNS NAPTR+SRV succeed ==> hostname=%s and port=%u", hostname, port); - } - - TSK_FREE(hostname); - TSK_OBJECT_SAFE_FREE(ctx); - - tsk_thread_sleep(2000); -} - -void test_enum() -{ - tnet_dns_ctx_t *ctx = tnet_dns_ctx_create(); - tnet_dns_response_t* response = tsk_null; -// const tsk_list_item_t* item; -// const tnet_dns_naptr_t* record; - char* uri = tsk_null; - const char* e164num = "+1-800-555-5555"; - //const char* e164num = "+33660188661"; - - //tnet_dns_add_server(ctx, "192.168.16.9"); - - //if((uri = tnet_dns_enum_2(ctx, "E2U+SIP", e164num, "e164.org"))){ - if((uri = tnet_dns_enum_2(ctx, "E2U+SIP", e164num, "e164.org"))){ - TSK_DEBUG_INFO("URI=%s", uri); - TSK_FREE(uri); - } - else{ - TSK_DEBUG_ERROR("ENUM(%s) failed", e164num); - } - - /*if((response = tnet_dns_enum(ctx, "+1-800-555-5555", "e164.org"))){ - if(TNET_DNS_RESPONSE_IS_SUCCESS(response)){ - TSK_DEBUG_INFO("We got a success response from the DNS server."); - // loop through the answers - tsk_list_foreach(item, response->Answers){ - record = item->data; - - TSK_DEBUG_INFO("order=%u pref=%u flags=%s services=%s regexp=%s replacement=%s", - record->order, - record->preference, - record->flags, - record->services, - record->regexp, - record->replacement); - } - } - else{ - TSK_DEBUG_ERROR("We got an error response from the DNS server. Erro code: %u", response->Header.RCODE); - } - }*/ - - - TSK_OBJECT_SAFE_FREE(response); - TSK_OBJECT_SAFE_FREE(ctx); - - tsk_thread_sleep(2000); -} - - -typedef struct regexp_test_s{ - const char* e164num; - const char* regexp; - const char* xres; -} -regexp_test_t; - -regexp_test_t regexp_tests[] = { - "+18005551234", "!^.*$!sip:customer-service@example.com!i", "sip:customer-service@example.com", - "+18005551234", "!^.*$!mailto:information@example.com!i", "mailto:information@example.com", - - "+18005555555", "!^\\+1800(.*)$!sip:1641641800\\1@tollfree.sip-happens.com!", "sip:16416418005555555@tollfree.sip-happens.com", - "+18005555555", "!^\\+1800(.*)$!sip:1641641800\\1@sip.tollfreegateway.com!", "sip:16416418005555555@sip.tollfreegateway.com", - - "+468971234", "!^+46(.*)$!ldap://ldap.telco.se/cn=0\\1!", "ldap://ldap.telco.se/cn=08971234", - "+468971234", "!^+46(.*)$!mailto:spam@paf.se!", "mailto:spam@paf.se", - - "urn:cid:199606121851.1@bar.example.com", "!!^urn:cid:.+@([^\\.]+\\.)(.*)$!\\2!i", "example.com", -}; - -void test_regex() -{ - char* ret; - size_t i; - - for(i=0; i< sizeof(regexp_tests)/sizeof(regexp_test_t); i++) - { - if((ret = tnet_dns_regex_parse(regexp_tests[i].e164num, regexp_tests[i].regexp))){ - TSK_DEBUG_INFO("ENUM(%s) = %s", regexp_tests[i].e164num, ret); - if(!tsk_strequals(ret, regexp_tests[i].xres)){ - TSK_DEBUG_ERROR("Failed to match ENUM(%s)", regexp_tests[i].e164num); - } - TSK_FREE(ret); - } - else{ - TSK_DEBUG_ERROR("Failed to parse ENUM(%s)", regexp_tests[i].e164num); - } - - TSK_DEBUG_INFO("---------"); - } -} - -void test_resolvconf() -{ - tnet_addresses_L_t * servers; - const tnet_address_t* address; - const tsk_list_item_t* item; - const char* path = "C:\\tmp\\resolv32.conf"; - //const char* path = "C:\\tmp\\resolv.conf"; - //const char* path = "/etc/resolv.conf"; - - if((servers = tnet_dns_resolvconf_parse(path))){ - tsk_list_foreach(item, servers){ - address = item->data; - - TSK_DEBUG_INFO("DNS Server host=%s Family=%d", address->ip, address->family); - } - - TSK_OBJECT_SAFE_FREE(servers); - } - else{ - TSK_DEBUG_ERROR("Failed to parse DNS servers from %s.", path); - } -} - -void test_dns() -{ - //test_dns_naptr_srv(); - //test_dns_srv(); - //test_dns_query(); - test_enum(); - //test_regex(); - //test_resolvconf(); -} - - -#endif /* TNET_TEST_DNS_H */ diff --git a/branches/1.0/tinyNET/test/test_ifaces.h b/branches/1.0/tinyNET/test/test_ifaces.h deleted file mode 100644 index a3bb411..0000000 --- a/branches/1.0/tinyNET/test/test_ifaces.h +++ /dev/null @@ -1,102 +0,0 @@ -/*
-* 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 TNET_TEST_IFACES_H
-#define TNET_TEST_IFACES_H
-
-void test_faces_bestsource()
-{
- tnet_ip_t source;
-
- // IPv6
- if(!tnet_getbestsource("fe80::fe4c:3ea1", 5060, tnet_socket_type_udp_ipv6, &source)){
- TSK_DEBUG_INFO("Best IPv6 source is [%s]", source);
- }
- else{
- TSK_DEBUG_ERROR("Failed to get best IPv6 source.");
- }
- // IPv6
- if(!tnet_getbestsource("2a01:e35:8b32:7050:212:f0ff:fe4c:3ea1", 5060, tnet_socket_type_udp_ipv6, &source)){
- TSK_DEBUG_INFO("Best IPv6 source is [%s]", source);
- }
- else{
- TSK_DEBUG_ERROR("Failed to get best IPv6 source.");
- }
- // IPv4
- if(!tnet_getbestsource("192.168.0.11", 5060, tnet_socket_type_udp_ipv4, &source)){
- TSK_DEBUG_INFO("Best IPv4 source is [%s]", source);
- }
- else{
- TSK_DEBUG_ERROR("Failed to get best IPv4 source.");
- }
-}
-
-void test_ifaces_dump_ifaces()
-{
- tnet_interfaces_L_t* ifaces = tnet_get_interfaces();
- tsk_list_item_t *item;
-
- tsk_list_foreach(item, ifaces)
- {
- const tnet_interface_t *iface = item->data;
- TSK_DEBUG_INFO("Interface: %s", iface->description);
- }
-
- TSK_OBJECT_SAFE_FREE(ifaces);
-}
-
-void test_ifaces_dump_addresses()
-{
- tnet_addresses_L_t* addresses = tnet_get_addresses_all();
- tsk_list_item_t *item;
-
- tsk_list_foreach(item, addresses)
- {
- const tnet_address_t *address = item->data;
- if(address->anycast)
- {
- TSK_DEBUG_INFO("ANYCAST address: %s", address->ip);
- }
- else if(address->unicast)
- {
- TSK_DEBUG_INFO("UNICAST address: %s", address->ip);
- }
- else if(address->multicast)
- {
- TSK_DEBUG_INFO("MULTICAST address: %s", address->ip);
- }
- else if(address->dnsserver)
- {
- TSK_DEBUG_INFO("DNSSERVER address: %s", address->ip);
- }
- }
-
- TSK_OBJECT_SAFE_FREE(addresses);
-}
-
-void test_ifaces()
-{
- test_faces_bestsource();
- test_ifaces_dump_ifaces();
- test_ifaces_dump_addresses();
-}
-
-#endif /* TNET_TEST_IFACES_H */
diff --git a/branches/1.0/tinyNET/test/test_nat.h b/branches/1.0/tinyNET/test/test_nat.h deleted file mode 100644 index ac1e4cb..0000000 --- a/branches/1.0/tinyNET/test/test_nat.h +++ /dev/null @@ -1,219 +0,0 @@ -/*
-* Copyright (C) 2009 Mamadou Diop.
-*
-* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
-*
-* 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 TNET_TEST_NAT_H
-#define TNET_TEST_NAT_H
-
-//stun.ekiga.net
-//#define STUN_SERVER_IP "numb.viagenie.ca"
-#define STUN_SERVER_IP "numb.viagenie.ca"
-#define STUN_USERNAME "xxxxx"
-#define STUN_PASSWORD "xxxxx"
-#define STUN_SERVER_PORT TNET_STUN_TCP_UDP_DEFAULT_PORT
-#define STUN_SERVER_PROTO tnet_socket_type_udp_ipv4
-
-void test_nat_stun()
-{
- tnet_socket_t *socket1 = 0, *socket2 = 0;
- tnet_nat_context_handle_t *context = 0;
-
- tnet_stun_binding_id_t bind_id1, bind_id2;
-
- char* public_ip1 = 0, *public_ip2 = 0;
- tnet_port_t public_port1 = 0, public_port2 = 0;
-
- if(!(socket1 = tnet_socket_create(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, STUN_SERVER_PROTO))
- || !(socket2 = tnet_socket_create(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, STUN_SERVER_PROTO)))
- {
- goto bail;
- }
-
- context = tnet_nat_context_create(STUN_SERVER_PROTO, STUN_USERNAME, STUN_PASSWORD);
-
- if(tnet_nat_set_server_address(context, STUN_SERVER_IP))
- {
- TSK_DEBUG_ERROR("Failed to set STUN/TURN address.");
- goto bail;
- }
-
- /* == BIND
- */
- bind_id1 = tnet_nat_stun_bind(context, socket1->fd);
- bind_id2 = tnet_nat_stun_bind(context, socket2->fd);
-
- if(!TNET_STUN_IS_VALID_BINDING_ID(bind_id1) ||!TNET_STUN_IS_VALID_BINDING_ID(bind_id2))
- {
- TSK_DEBUG_ERROR("Failed to get public IP/port using stun");
- goto bail;
- }
-
- if(!tnet_nat_stun_get_reflexive_address(context, bind_id1, &public_ip1, &public_port1))
- {
- TSK_DEBUG_INFO("Public IP1/Port1 ==> %s:%u", public_ip1, public_port1);
- }
-
- if(!tnet_nat_stun_get_reflexive_address(context, bind_id2, &public_ip2, &public_port2))
- {
- TSK_DEBUG_INFO("Public IP2/Port2 ==> %s:%u", public_ip2, public_port2);
- }
-
- /* == UNBIND
- */
- tnet_nat_stun_unbind(context, bind_id1);
- tnet_nat_stun_unbind(context, bind_id2);
-
-bail:
- TSK_OBJECT_SAFE_FREE(socket1);
- TSK_OBJECT_SAFE_FREE(socket2);
-
- TSK_FREE(public_ip1);
- TSK_FREE(public_ip1);
-
- TSK_OBJECT_SAFE_FREE(context);
-}
-
-void test_nat_turn()
-{
- tnet_socket_t *socket1 = 0, *socket2 = 0;
- tnet_nat_context_handle_t *context = 0;
- tnet_turn_allocation_id_t alloc_id1, alloc_id2;
-
- char* public_ip1 = 0, *public_ip2 = 0;
- tnet_port_t public_port1 = 0, public_port2 = 0;
-
- tnet_turn_channel_binding_id_t channel_id;
-
- int ret;
-
- if(!(socket1 = tnet_socket_create(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, STUN_SERVER_PROTO))
- || !(socket2 = tnet_socket_create(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, STUN_SERVER_PROTO)))
- {
- goto bail;
- }
-
- context = tnet_nat_context_create(STUN_SERVER_PROTO, STUN_USERNAME, STUN_PASSWORD);
-
- if(tnet_nat_set_server_address(context, STUN_SERVER_IP))
- {
- TSK_DEBUG_ERROR("Failed to set STUN/TURN address.");
- goto bail;
- }
-
- /* == ALLOC
- */
- alloc_id1 = tnet_nat_turn_allocate(context, socket1->fd);
- alloc_id2 = tnet_nat_turn_allocate(context, socket2->fd);
- if(!TNET_TURN_IS_VALID_ALLOCATION_ID(alloc_id1) || !TNET_TURN_IS_VALID_ALLOCATION_ID(alloc_id2))
- {
- TSK_DEBUG_ERROR("TURN allocation failed.");
- goto bail;
- }
- else
- {
- TSK_DEBUG_INFO("TURN allocation succeeded and id1=%llu and id2=%llu", alloc_id1, alloc_id2);
- }
-
- tsk_thread_sleep(2000);
-
- /* == RETRIEVE STUN SERVER REFLEXIVE ADDRESSES
- */
- if(!tnet_nat_turn_get_reflexive_address(context, alloc_id1, &public_ip1, &public_port1))
- {
- TSK_DEBUG_INFO("Public IP1/Port1 ==> %s:%u", public_ip1, public_port1);
- }
-
- if(!tnet_nat_turn_get_reflexive_address(context, alloc_id2, &public_ip2, &public_port2))
- {
- TSK_DEBUG_INFO("Public IP2/Port2 ==> %s:%u", public_ip2, public_port2);
- }
-
- /* == CREATE PERMISSION
- */
- //tnet_nat_turn_add_permission(context, alloc_id1, "192.168.0.11", 300);
-
- /* == CHANNEL BINDING
- */
- {
- /* Try to bind (channel binding) to the socket1 to socket2 */
- struct sockaddr_storage peer;
- if((ret = tnet_sockaddr_init(public_ip2, public_port2, STUN_SERVER_PROTO, &peer)))
- {
- TSK_DEBUG_ERROR("Failed to init peer with error code %d.", ret);
- }
- else
- {
- channel_id = tnet_nat_turn_channel_bind(context, alloc_id1,&peer);
- if(TNET_TURN_IS_VALID_CHANNEL_BINDING_ID(channel_id))
- {
- TSK_DEBUG_INFO("TURN channel binding succeeded.");
-
- /* Try to send data using the newly create channel */
- if(tnet_nat_turn_channel_senddata(context, channel_id, "Doubango", strlen("Doubango")))
- {
- TSK_DEBUG_ERROR("Failed to send data using channel id [%u].", channel_id);
- }
- else
- {
- TSK_DEBUG_INFO("Data successfuly sent using channel if[%u].", channel_id);
- }
- }
- else
- {
- TSK_DEBUG_ERROR("TURN channel binding failed.");
- }
- }
- }
-
- tsk_thread_sleep(2000);
-
- /* == UNALLOC
- */
- if((ret = tnet_nat_turn_unallocate(context, alloc_id1)) || (ret = tnet_nat_turn_unallocate(context, alloc_id2)))
- {
- TSK_DEBUG_ERROR("TURN unallocation failed with error code: %d.", ret);
- goto bail;
- }
- else
- {
- TSK_DEBUG_INFO("TURN unallocation succeeded.");
- }
-
-bail:
- TSK_OBJECT_SAFE_FREE(socket1);
- TSK_OBJECT_SAFE_FREE(socket2);
-
- TSK_FREE(public_ip1);
- TSK_FREE(public_ip1);
-
- TSK_OBJECT_SAFE_FREE(context);
-}
-
-
-void test_nat()
-{
- test_nat_stun();
- //test_nat_turn();
- //tsk_thread_sleep(1000);
-}
-
-
-
-#endif /* TNET_TEST_NAT_H */
diff --git a/branches/1.0/tinyNET/test/test_sockets.h b/branches/1.0/tinyNET/test/test_sockets.h deleted file mode 100644 index 32e1cca..0000000 --- a/branches/1.0/tinyNET/test/test_sockets.h +++ /dev/null @@ -1,64 +0,0 @@ -/*
-* Copyright (C) 2009 Mamadou Diop.
-*
-* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
-*
-* 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 TNET_TEST_SOCKETS_H
-#define TNET_TEST_SOCKETS_H
-
-void test_sockets()
-{
- int test;
- tnet_socket_tcp_t * tcp_socket;
- tnet_socket_type_t type = tnet_socket_type_udp_ipv4;
- struct sockaddr_storage to;
-
- TNET_SOCKET_TYPE_SET_IPV4(type);
- TNET_SOCKET_TYPE_SET_IPV6(type);
- TNET_SOCKET_TYPE_SET_IPV4Only(type);
- TNET_SOCKET_TYPE_SET_IPV6Only(type);
- TNET_SOCKET_TYPE_SET_IPV6Only(type);
- TNET_SOCKET_TYPE_SET_IPV4(type);
- TNET_SOCKET_TYPE_SET_IPV6(type);
-
- TNET_SOCKET_TYPE_SET_TLS(type);
- TNET_SOCKET_TYPE_SET_UDP(type);
- TNET_SOCKET_TYPE_SET_SCTP(type);
- TNET_SOCKET_TYPE_SET_TCP(type);
-
- tcp_socket = tnet_socket_create(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, type);
-
- if(!TNET_SOCKET_IS_VALID(tcp_socket))
- {
- TSK_OBJECT_SAFE_FREE(tcp_socket);
- return;
- }
-
- //if(!(test = tnet_sockaddr_init("www.google.com", 80, type, &to))){
- // test = tnet_sockfd_connetto(tcp_socket->fd, (const struct sockaddr_storage *)&to);
- //}
-
- if(!(test = tnet_sockaddr_init("ipv6.google.com", 80, type, &to))){
- test = tnet_sockfd_connectto(tcp_socket->fd, (const struct sockaddr_storage *)&to);
- }
-
- TSK_OBJECT_SAFE_FREE(tcp_socket);
-}
-
-#endif /* TNET_TEST_SOCKETS_H */
diff --git a/branches/1.0/tinyNET/test/test_stun.h b/branches/1.0/tinyNET/test/test_stun.h deleted file mode 100644 index 4209f03..0000000 --- a/branches/1.0/tinyNET/test/test_stun.h +++ /dev/null @@ -1,112 +0,0 @@ -/*
-* Copyright (C) 2009 Mamadou Diop.
-*
-* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
-*
-* 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 TNET_TEST_STUN_H
-#define TNET_TEST_STUN_H
-
-//#define STUN_SERVER_IP "numb.viagenie.ca"
-//#define STUN_SERVER_PORT TNET_STUN_TCP_UDP_DEFAULT_PORT
-//#define STUN_SERVER_PROTO tnet_socket_type_udp_ipv4
-
-// http://tools.ietf.org/html/draft-ietf-behave-stun-test-vectors-04
-
-void test_stun_dump_transacid(tnet_stun_transacid_t transcid)
-{
- char transac_idstriing[TNET_STUN_TRANSACID_SIZE*2+1];
- tsk_str_from_hex(transcid, TNET_STUN_TRANSACID_SIZE, transac_idstriing);
-
- transac_idstriing[sizeof(transac_idstriing)-1] = '\0';
-
- TSK_DEBUG_INFO("STUN transac id:%s", transac_idstriing);
-}
-
-void test_sun_sendMessage()
-{
- /*tnet_stun_message_handle_t *message = 0;
- tsk_buffer_t *buffer = 0;
- tnet_socket_t *socket = 0;
- struct sockaddr_storage to;
-
-
- message = TNET_STUN_MESSAGE_CREATE();
- tnet_stun_message_set_type(message, tsm_binding_request);
- tnet_stun_message_set_random_transacid(message);
-
- if(!(buffer = tnet_stun_message_serialize(message)))
- {
- goto bail;
- }
-
- // Create blocking socket and bind it
- socket = tnet_socket_create_EX(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, STUN_SERVER_PROTO, 0);
- if(!TNET_SOCKET_IS_VALID(socket))
- {
- goto bail;
- }
-
- // Create stun server's sockaddr structure
- if(tnet_sockaddr_init(STUN_SERVER_IP, STUN_SERVER_PORT, STUN_SERVER_PROTO, &to))
- {
- goto bail;
- }
-
- tnet_socket_sendto(socket, (struct sockaddr*)&to, buffer->data, buffer->size);
-
-bail:
- TSK_OBJECT_SAFE_FREE(message);
- TSK_OBJECT_SAFE_FREE(socket);
- TSK_OBJECT_SAFE_FREE(buffer);*/
-}
-
-void test_stun_context()
-{
-// tnet_socket_t *localSocket = 0;
-// tnet_stun_context_t *context = 0;
-//
-// /* Somewhere in Your application ==> Create and bind your local socket
-// */
-// if(!(localSocket = tnet_socket_create_EX(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, STUN_SERVER_PROTO, 0)))
-// {
-// goto bail;
-// }
-//
-// /* Create your STUN2 context
-// */
-// if(!(context = TNET_STUN_CONTEXT_CREATE("myusername", "mypassword", localSocket->fd)))
-// {
-// goto bail;
-// }
-//
-// tnet_stun_resolve(context, STUN_SERVER_IP, STUN_SERVER_PORT, STUN_SERVER_PROTO);
-//
-//bail:
-// TNET_OBJECT_SAFE_FREE(localSocket);
-// TNET_OBJECT_SAFE_FREE(context);
-}
-
-void test_stun()
-{
- //test_stun_transacid();
- //test_sun_sendMessage();
- test_stun_context();
-}
-
-#endif /* TNET_TEST_STUN_H */
diff --git a/branches/1.0/tinyNET/test/test_tls.h b/branches/1.0/tinyNET/test/test_tls.h deleted file mode 100644 index ff86823..0000000 --- a/branches/1.0/tinyNET/test/test_tls.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -* Copyright (C) 2009 Mamadou Diop. -* -* Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* -* 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 TNET_TEST_TLS_H -#define TNET_TEST_TLS_H - -#define TEST_TLS_REMOTE_IP "192.168.16.225" -#define TEST_TLS_REMOTE_PORT 4061 - -#define TLS_TEST_SIP_MESSAGE \ - "REGISTER sip:micromethod.com SIP/2.0\r\n" \ - "Via: SIP/2.0/%s %s:%d;rport;branch=z9hG4bK1245420841406%d\r\n" \ - "From: <sip:mamadou@micromethod.com>;tag=29358\r\n" \ - "To: <sip:mamadou@micromethod.com>\r\n" \ - "Call-ID: M-fa53180346f7f55ceb8d8670f9223dbb\r\n" \ - "CSeq: 201 REGISTER\r\n" \ - "Max-Forwards: 70\r\n" \ - "Contact: <sip:mamadou@%s:%d;transport=%s>\r\n" \ - "Expires: 10\r\n" \ - "\r\n" - -static int tnet_tls_cb(const tnet_transport_event_t* e) -{ - switch(e->type){ - case event_data: - { - TSK_DEBUG_INFO("--- TLS ---\n%s\n", (const char*)e->data); - break; - } - case event_closed: - case event_connected: - default: - { - break; - } - } - return 0; -} - - -void test_tls() -{ - tnet_transport_handle_t *transport = tnet_transport_create(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, tnet_socket_type_tls_ipv4, "TLS/IPV4 TRANSPORT"); - - tnet_ip_t ip; - tnet_port_t port; - tnet_fd_t fd = TNET_INVALID_FD; - - if(tnet_transport_start(transport)){ - TSK_DEBUG_ERROR("Failed to create %s.", tnet_transport_get_description(transport)); - return; - } - - /* Set our callback function */ - tnet_transport_set_callback(transport, tnet_tls_cb, "callbackdata"); - - - - /* Connect to the SIP Registrar */ - if((fd = tnet_transport_connectto_2(transport, TEST_TLS_REMOTE_IP, TEST_TLS_REMOTE_PORT)) == TNET_INVALID_FD){ - TSK_DEBUG_ERROR("Failed to connect %s.", tnet_transport_get_description(transport)); - return; - } - - if(tnet_sockfd_waitUntilWritable(fd, TNET_CONNECT_TIMEOUT)){ - TSK_DEBUG_ERROR("%d milliseconds elapsed and the socket is still not connected.", TNET_CONNECT_TIMEOUT); - tnet_transport_remove_socket(transport, &fd); - return; - } - - /* Send our SIP message */ - { - char* message = 0; - tnet_transport_get_ip_n_port(transport, fd, &ip, &port); - tsk_sprintf(&message, TLS_TEST_SIP_MESSAGE, "TLS", ip, port, port, ip, port, "tls"); - - if(!tnet_transport_send(transport, fd, message, strlen(message))) - { - TSK_DEBUG_ERROR("Failed to send data using TCP/IPv4 transport."); - TSK_FREE(message); - return; - } - TSK_FREE(message); - } - - TSK_OBJECT_SAFE_FREE(transport); -} - -#endif /* TNET_TEST_TLS_H */ - diff --git a/branches/1.0/tinyNET/test/test_transport.h b/branches/1.0/tinyNET/test/test_transport.h deleted file mode 100644 index 870c8b5..0000000 --- a/branches/1.0/tinyNET/test/test_transport.h +++ /dev/null @@ -1,222 +0,0 @@ -/* -* Copyright (C) 2009 Mamadou Diop. -* -* Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* -* 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 TNET_TEST_TRANSPORT_H -#define TNET_TEST_TRANSPORT_H - -//#define REMOTE_IP4 "proxy.sipthor.net"//"192.168.0.15" -#define REMOTE_IP4 "192.168.0.13" -#define REMOTE_IP6 "2a01:e35:8632:7050:6122:2706:2124:32cb" -#define REMOTE_IP REMOTE_IP4 -#define REMOTE_PORT 5083 - -#if defined(ANDROID) /* FIXME */ -# define LOCAL_IP4 "10.0.2.15" -#else -# define LOCAL_IP4 TNET_SOCKET_HOST_ANY -#endif -#define LOCAL_IP6 TNET_SOCKET_HOST_ANY - -#if defined(ANDROID) -# define LOCAL_PORT 5060 -#else -# define LOCAL_PORT TNET_SOCKET_PORT_ANY -#endif - -#define SIP_MESSAGE \ - "REGISTER sip:micromethod.com SIP/2.0\r\n" \ - "Via: SIP/2.0/%s %s:%d;rport;branch=z9hG4bK1245420841406%d\r\n" \ - "From: <sip:mamadou@micromethod.com>;tag=29358\r\n" \ - "To: <sip:mamadou@micromethod.com>\r\n" \ - "Call-ID: M-fa53180346f7f55ceb8d8670f9223dbb\r\n" \ - "CSeq: 201 REGISTER\r\n" \ - "Max-Forwards: 70\r\n" \ - "Contact: <sip:mamadou@%s:%d;transport=%s>\r\n" \ - "Expires: 10\r\n" \ - "\r\n" - - -static int tnet_tcp_cb(const tnet_transport_event_t* e) -{ - switch(e->type){ - case event_data: - { - TSK_DEBUG_INFO("--- TCP ---\n%s\n", (const char*)e->data); - break; - } - case event_closed: - case event_connected: - default: - { - break; - } - } - return 0; -} - -static int tnet_udp_cb(const tnet_transport_event_t* e) -{ - switch(e->type){ - case event_data: - { - TSK_DEBUG_INFO("--- UDP ---\n%s\n", (const char*)e->data); - break; - } - case event_closed: - case event_connected: - default: - { - break; - } - } - return 0; -} - -void test_transport_tcp_ipv4(tnet_transport_handle_t *transport) -{ - //tnet_socket_type_t type = tnet_socket_type_tcp_ipv4; - tnet_ip_t ip; - tnet_port_t port; - tnet_fd_t fd = TNET_INVALID_FD; - - /* Set our callback function */ - tnet_transport_set_callback(transport, tnet_tcp_cb, "callbackdata"); - - if(tnet_transport_start(transport)){ - TSK_DEBUG_ERROR("Failed to create %s.", tnet_transport_get_description(transport)); - return; - } - - /* Connect to the SIP Registrar */ - if((fd = tnet_transport_connectto_2(transport, REMOTE_IP, REMOTE_PORT)) == TNET_INVALID_FD){ - TSK_DEBUG_ERROR("Failed to connect %s.", tnet_transport_get_description(transport)); - return; - } - - if(tnet_sockfd_waitUntilWritable(fd, TNET_CONNECT_TIMEOUT)){ - TSK_DEBUG_ERROR("%d milliseconds elapsed and the socket is still not connected.", TNET_CONNECT_TIMEOUT); - tnet_transport_remove_socket(transport, &fd); - return; - } - - - /* Send our SIP message */ - { - char* message = 0; - tnet_transport_get_ip_n_port(transport, fd, &ip, &port); - tsk_sprintf(&message, SIP_MESSAGE, "TCP", ip, port, port, ip, port, "tcp"); - - if(!tnet_transport_send(transport, fd, message, strlen(message))) - { - TSK_DEBUG_ERROR("Failed to send data using %s.", tnet_transport_get_description(transport)); - TSK_FREE(message); - return; - } - TSK_FREE(message); - } - -} - - -int test_transport_udp_ipv4(tnet_transport_handle_t *transport) -{ - //tnet_socket_type_t type = tnet_socket_type_udp_ipv4; - tnet_ip_t ip; - tnet_port_t port; - tnet_fd_t fd = TNET_INVALID_FD; - - /* Set our callback function */ - tnet_transport_set_callback(transport, tnet_udp_cb, "callbackdata"); - - if(tnet_transport_start(transport)){ - TSK_DEBUG_ERROR("Failed to create %s.", tnet_transport_get_description(transport)); - return -1; - } - - /* Connect to our SIP REGISTRAR */ - if((fd = tnet_transport_connectto_2(transport, REMOTE_IP, REMOTE_PORT)) == TNET_INVALID_FD){ - TSK_DEBUG_ERROR("Failed to connect %s.", tnet_transport_get_description(transport)); - //tnet_transport_shutdown(transport); - return -2; - } - - if(tnet_sockfd_waitUntilWritable(fd, TNET_CONNECT_TIMEOUT)){ - TSK_DEBUG_ERROR("%d milliseconds elapsed and the socket is still not connected.", TNET_CONNECT_TIMEOUT); - tnet_transport_remove_socket(transport, &fd); - return -3; - } - - //tsk_thread_sleep(2000); - - /* Send our SIP message */ - /*while(1)*/{ - char* message = 0; - tnet_transport_get_ip_n_port(transport, fd, &ip, &port); - //memset(ip, 0, sizeof(ip)); - //memcpy(ip, "192.168.0.12", 12); - tsk_sprintf(&message, SIP_MESSAGE, "UDP", ip, port, port, ip, port, "udp"); - - if(!tnet_transport_send(transport, fd, message, strlen(message))) - { - TSK_DEBUG_ERROR("Failed to send data using %s.", tnet_transport_get_description(transport)); - //tnet_transport_shutdown(transport); - TSK_FREE(message); - return -4; - } - TSK_FREE(message); - } - - return 0; -} - -void test_transport() -{ -#define TEST_TCP 1 -#define TEST_UDP 0 - - -#if TEST_UDP - tnet_transport_handle_t *udp = tnet_transport_create(LOCAL_IP4, LOCAL_PORT, tnet_socket_type_udp_ipv4, "UDP/IPV4 TRANSPORT"); - test_transport_udp_ipv4(udp); -#endif - -#if TEST_TCP - tnet_transport_handle_t *tcp = tnet_transport_create(LOCAL_IP4, LOCAL_PORT, tnet_socket_type_tcp_ipv4, "TCP/IPV4 TRANSPORT"); - test_transport_tcp_ipv4(tcp); -#endif - -//#if defined(ANDROID) - tsk_thread_sleep(1000000); -//#else - getchar(); -//#endif - -#if TEST_UDP - TSK_OBJECT_SAFE_FREE(udp); -#endif - -#if TEST_TCP - TSK_OBJECT_SAFE_FREE(tcp); -#endif -} - - -#endif /* TNET_TEST_TRANSPORT_H*/ |