Add carbide.c projects
Update some functions for s60 Add support for socket polling Change timer manager Resolve bugs
This commit is contained in:
parent
e4e5f41e6c
commit
65fb889bdb
|
@ -0,0 +1,146 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject>
|
||||
<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="0" concurrentBuildJobs="4" defaultMMPChangedAction="0" infBuildComponents="" infFileLocation="group/bld.inf" macrosFile="" makeEngineToUse="make" manageDependencies="true" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideMakeEngine="false" overrideWorkspaceSettings="false" promptForMMPChangedAction="false" useConcurrentBuilding="true" useDebugMode="false" useIncrementalBuilder="false" useKeepGoing="false" useMMPMacros="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinyNET\group\bld.inf;C:\Projects\Doubango\tinyNET\group\tinyNET.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__CW32__;TINYNET_EXPORTS;__S60_50__;__WINSCW__;_UNICODE;__S60_3X__;__S60_5X__;_DEBUG;__SERIES60_3X__;__DLL__;__WINS__;" moduleId="configDataCache" sourcesCache="/tinyNET/src;/tinySAK/src;" timestampCache="1261732924220" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinyNET\group\bld.inf;C:\Projects\Doubango\tinyNET\group\tinyNET.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__ARMCC_2__;TINYNET_EXPORTS;__ARMCC__;__MARM__;__S60_50__;__S60_3X__;__ARMCC_2_2__;_UNICODE;__S60_5X__;_DEBUG;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinyNET/src;/tinySAK/src;" timestampCache="1261732924236" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinyNET\group\bld.inf;C:\Projects\Doubango\tinyNET\group\tinyNET.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__ARMCC_2__;NDEBUG;TINYNET_EXPORTS;__ARMCC__;__MARM__;__S60_50__;__S60_3X__;__ARMCC_2_2__;_UNICODE;__S60_5X__;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinyNET/src;/tinySAK/src;" timestampCache="1261732924236" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCEErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinyNET\group\bld.inf;C:\Projects\Doubango\tinyNET\group\tinyNET.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__GCCE__;TINYNET_EXPORTS;__MARM__;__S60_50__;_UNICODE;__S60_3X__;__S60_5X__;_DEBUG;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinyNET/src;/tinySAK/src;" timestampCache="1261732924251" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCEErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinyNET\group\bld.inf;C:\Projects\Doubango\tinyNET\group\tinyNET.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__GCCE__;NDEBUG;TINYNET_EXPORTS;__MARM__;__S60_50__;_UNICODE;__S60_3X__;__S60_5X__;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinyNET/src;/tinySAK/src;" timestampCache="1261732924267" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
</cproject>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>tinyNET</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,33 @@
|
|||
EXPORTS
|
||||
tnet_cleanup @ 1 NONAME
|
||||
tnet_freeaddrinfo @ 2 NONAME
|
||||
tnet_get_ip_n_port @ 3 NONAME
|
||||
tnet_getaddrinfo @ 4 NONAME
|
||||
tnet_gethostname @ 5 NONAME
|
||||
tnet_getlasterror @ 6 NONAME
|
||||
tnet_getnameinfo @ 7 NONAME
|
||||
tnet_sockaddr_init @ 8 NONAME
|
||||
tnet_sockaddrinfo_init @ 9 NONAME
|
||||
tnet_socket_def_t @ 10 NONAME
|
||||
tnet_socket_dgram_sendto @ 11 NONAME
|
||||
tnet_socket_stream_connectto @ 12 NONAME
|
||||
tnet_sockfd_close @ 13 NONAME
|
||||
tnet_sockfd_init @ 14 NONAME
|
||||
tnet_startup @ 15 NONAME
|
||||
tnet_transport_def_t @ 16 NONAME
|
||||
tnet_transport_get_description @ 17 NONAME
|
||||
tnet_transport_get_ip_n_port @ 18 NONAME
|
||||
tnet_transport_get_socket_type @ 19 NONAME
|
||||
tnet_transport_isready @ 20 NONAME
|
||||
tnet_transport_issecure @ 21 NONAME
|
||||
tnet_transport_set_callback @ 22 NONAME
|
||||
tnet_transport_shutdown @ 23 NONAME
|
||||
tnet_transport_start @ 24 NONAME
|
||||
tnet_transport_add_socket @ 25 NONAME
|
||||
tnet_transport_connectto @ 26 NONAME
|
||||
tnet_transport_isconnected @ 27 NONAME
|
||||
tnet_transport_send @ 28 NONAME
|
||||
tnet_transport_sendto @ 29 NONAME
|
||||
tnet_geterrno @ 30 NONAME
|
||||
tnet_sockfd_set_nonblocking @ 31 NONAME
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
@ECHO OFF
|
||||
|
||||
REM Bldmake-generated batch file - ABLD.BAT
|
||||
REM ** DO NOT EDIT **
|
||||
|
||||
perl -S ABLD.PL "\Projects\Doubango\tinyNET\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
if errorlevel==1 goto CheckPerl
|
||||
goto End
|
||||
|
||||
:CheckPerl
|
||||
perl -v >NUL
|
||||
if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?
|
||||
goto End
|
||||
|
||||
:End
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
============================================================================
|
||||
Name : bld.inf
|
||||
Author : Mamadou Diop
|
||||
Copyright : * 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.
|
||||
Description : This file provides the information required for building the
|
||||
whole of a tinyNET.
|
||||
============================================================================
|
||||
*/
|
||||
|
||||
PRJ_PLATFORMS
|
||||
DEFAULT
|
||||
|
||||
PRJ_EXPORTS
|
||||
|
||||
PRJ_MMPFILES
|
||||
tinyNET.mmp
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
============================================================================
|
||||
Name : tinyNET.mmp
|
||||
Author : Mamadou Diop
|
||||
Copyright : * 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.
|
||||
Description : This is the project specification file for tinyNET.
|
||||
============================================================================
|
||||
*/
|
||||
|
||||
TARGET tinyNET.dll
|
||||
TARGETTYPE dll
|
||||
UID 0x1000008d 0xEF621076
|
||||
|
||||
USERINCLUDE ..\..\tinySAK\src
|
||||
|
||||
SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis \epoc32\include\stdapis\sys
|
||||
|
||||
// In order to use .def files to freeze code you must use one or more DEFFILE lines;
|
||||
// see the ones commented out below for examples.
|
||||
// By default, the build tools look for the WINSCW def file in a BWINS directory
|
||||
// (at the same level as the directory containing the mmp file),
|
||||
// the GCC ARM def file in a BMARM directory, and the ARMV5 def file in a EABI directory.
|
||||
// If your .def files are stored in these default locations, you can simply specify the
|
||||
// .def filename(s) with no path. If you want to store .def files in non-default
|
||||
// locations, you will need to specify the paths in the DEFFILE statement(s).
|
||||
|
||||
//The following commented out code shows how the build system uses the implicit
|
||||
// location for defiles. To create the DEF files Choose Project > Freeze Exports from Carbide
|
||||
// or run 'abld freeze' from the command-line
|
||||
//#if defined (WINS)
|
||||
// DEFFILE ..\bwins\tinyNET.def
|
||||
//#elif defined (GCC32)
|
||||
// DEFFILE ..\bmarm\tinyNET.def
|
||||
//#else
|
||||
// DEFFILE ..\eabi\tinyNET.def
|
||||
//#endif
|
||||
|
||||
nostrictdef
|
||||
|
||||
LIBRARY euser.lib libc.lib tinySAK.lib
|
||||
|
||||
#ifdef ENABLE_ABIV2_MODE
|
||||
DEBUGGABLE_UDEBONLY
|
||||
#endif
|
||||
|
||||
MACRO TINYNET_EXPORTS
|
||||
|
||||
EPOCALLOWDLLDATA
|
||||
|
||||
SOURCEPATH ..\src
|
||||
SOURCE tnet.c tnet_socket.c tnet_transport.c tnet_transport_win32.c tnet_utils.c tnet_transport_poll.c tnet_poll.c
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -0,0 +1,21 @@
|
|||
; Installation file for tinyNET dll
|
||||
;
|
||||
; This is an auto-generated PKG file by Carbide.
|
||||
; This file uses variables specific to Carbide builds that will not work
|
||||
; on command-line builds. If you want to use this generated PKG file from the
|
||||
; command-line tools you will need to modify the variables with the appropriate
|
||||
; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
|
||||
|
||||
;
|
||||
; UID is the dll's UID
|
||||
;
|
||||
#{"tinyNET DLL"},(0xEF621076),1,0,0
|
||||
|
||||
|
||||
;Localised Vendor name
|
||||
%{"Vendor-EN"}
|
||||
|
||||
;Unique Vendor name
|
||||
:"Vendor"
|
||||
|
||||
"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\tinyNET.dll" -"!:\sys\bin\tinyNET.dll"
|
|
@ -69,4 +69,16 @@
|
|||
|
||||
#define TINYSAK_IMPORTS
|
||||
|
||||
#if (_WIN32_WINNT>=0x0600) || (0)
|
||||
# define TNET_HAVE_POLL 1
|
||||
#else
|
||||
# define TNET_HAVE_POLL 0
|
||||
#endif
|
||||
|
||||
#if TNET_UNDER_WINDOWS
|
||||
# define TNET_USE_POLL 0 /* Do not use WSAPoll event if under Vista. */
|
||||
#else
|
||||
# define TNET_USE_POLL 1
|
||||
#endif
|
||||
|
||||
#endif /* _TINYNET_H_ */
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
#include "tsk_debug.h"
|
||||
|
||||
static int __tnet_started = 0;
|
||||
|
||||
/**
|
||||
* @fn int tnet_startup()
|
||||
*
|
||||
|
@ -46,33 +48,39 @@
|
|||
int tnet_startup()
|
||||
{
|
||||
int err = 0;
|
||||
if(__tnet_started) goto bail;
|
||||
|
||||
#if TNET_UNDER_WINDOWS
|
||||
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 2);
|
||||
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
if (err != 0)
|
||||
{
|
||||
TSK_DEBUG_FATAL("WSAStartup failed with error: %d\n", err);
|
||||
return 1;
|
||||
}
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
|
||||
if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2)
|
||||
{
|
||||
TSK_DEBUG_FATAL("Could not find a usable version of Winsock.dll\n");
|
||||
tnet_cleanup();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
TSK_DEBUG_INFO("The Winsock 2.2 dll was found okay\n");
|
||||
wVersionRequested = MAKEWORD(2, 2);
|
||||
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
if (err != 0)
|
||||
{
|
||||
TSK_DEBUG_FATAL("WSAStartup failed with error: %d\n", err);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2)
|
||||
{
|
||||
TSK_DEBUG_FATAL("Could not find a usable version of Winsock.dll\n");
|
||||
tnet_cleanup();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
__tnet_started = 1;
|
||||
TSK_DEBUG_INFO("The Winsock 2.2 dll was found okay\n");
|
||||
}
|
||||
}
|
||||
#else
|
||||
__tnet_started = 1;
|
||||
#endif /* TSIP_UNDER_WINDOWS */
|
||||
|
||||
bail:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -90,9 +98,15 @@ int tnet_startup()
|
|||
**/
|
||||
int tnet_cleanup()
|
||||
{
|
||||
#if TNET_UNDER_WINDOWS
|
||||
return WSACleanup();
|
||||
#endif /* #if TNET_UNDER_WINDOWS */
|
||||
if(!__tnet_started) goto bail;
|
||||
|
||||
#if TNET_UNDER_WINDOWS
|
||||
__tnet_started = 0;
|
||||
return WSACleanup();
|
||||
#else
|
||||
__tnet_started = 0;
|
||||
#endif
|
||||
|
||||
bail:
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#include "tnet_poll.h"
|
||||
|
||||
#if TNET_USE_POLL
|
||||
|
||||
/**
|
||||
* @fn int tnet_poll(tnet_pollfd_t fds[ ], nfds_t nfds, int timeout)
|
||||
*
|
||||
* @brief poll() method implementation for multiplexing network sockets.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop /
|
||||
*
|
||||
* @param fds An array of pollfd structures.
|
||||
* @param nfds The number of file descriptors set in fds[ ].
|
||||
* @param timeout How long poll() should wait for an event to occur (in milliseconds).
|
||||
*
|
||||
* @return The number of elements in fdarray for which an revents member of the POLLFD structure is nonzero.
|
||||
* If the the returned value if <0 this mean that error occurred.
|
||||
**/
|
||||
|
||||
int tnet_poll(tnet_pollfd_t fds[ ], tnet_nfds_t nfds, int timeout)
|
||||
{
|
||||
size_t i;
|
||||
int ret;
|
||||
int highest_fd = -1;
|
||||
|
||||
fd_set readfds;
|
||||
fd_set writefds;
|
||||
fd_set exceptfds;
|
||||
struct timeval timetowait;
|
||||
|
||||
/*
|
||||
* cleanup fd_sets
|
||||
*/
|
||||
FD_ZERO(&readfds);
|
||||
FD_ZERO(&writefds);
|
||||
FD_ZERO(&exceptfds);
|
||||
|
||||
/*
|
||||
* set timeout
|
||||
*/
|
||||
if(timeout >=0)
|
||||
{
|
||||
timetowait.tv_sec = (timeout/1000);
|
||||
timetowait.tv_usec = (timeout%1000) * 1000;
|
||||
}
|
||||
|
||||
/*
|
||||
* add descriptors to the fd_sets
|
||||
*/
|
||||
for(i = 0; i<nfds; i++)
|
||||
{
|
||||
if(fds[i].fd != TNET_INVALID_FD)
|
||||
{
|
||||
if(fds[i].events & TNET_POLLIN)
|
||||
{
|
||||
FD_SET(fds[i].fd, &readfds);
|
||||
}
|
||||
if(fds[i].events & TNET_POLLOUT)
|
||||
{
|
||||
FD_SET(fds[i].fd, &writefds);
|
||||
}
|
||||
if(fds[i].events & TNET_POLLPRI)
|
||||
{
|
||||
FD_SET(fds[i].fd, &exceptfds);
|
||||
}
|
||||
}
|
||||
|
||||
highest_fd = (highest_fd < fds[i].fd) ? fds[i].fd : highest_fd;
|
||||
}
|
||||
|
||||
/*======================================
|
||||
* select
|
||||
*/
|
||||
if((ret = select(highest_fd + 1, &readfds, &writefds, &exceptfds, (timeout >=0) ? &timetowait : 0)) >= 0)
|
||||
{
|
||||
for(i = 0; i<nfds; i++)
|
||||
{
|
||||
if(fds[i].fd != TNET_INVALID_FD)
|
||||
{
|
||||
fds[i].revents = 0;
|
||||
|
||||
if(FD_ISSET(fds[i].fd, &readfds))
|
||||
{
|
||||
fds[i].revents |= TNET_POLLIN;
|
||||
}
|
||||
if(FD_ISSET(fds[i].fd, &writefds))
|
||||
{
|
||||
fds[i].revents |= TNET_POLLOUT;
|
||||
}
|
||||
if(FD_ISSET(fds[i].fd, &exceptfds))
|
||||
{
|
||||
fds[i].revents |= TNET_POLLPRI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* TNET_USE_POLL */
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* 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 tnet_poll.h
|
||||
* @brief poll() method implementation for multiplexing network sockets.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#ifndef TNET_POLL_H
|
||||
#define TNET_POLL_H
|
||||
|
||||
#include "tinyNET_config.h"
|
||||
|
||||
#if TNET_USE_POLL
|
||||
|
||||
#include "tnet_types.h"
|
||||
|
||||
typedef unsigned long tnet_nfds_t;
|
||||
|
||||
#if TNET_HAVE_POLL
|
||||
|
||||
typedef struct pollfd tnet_pollfd_t;
|
||||
|
||||
#define TNET_POLLRDNORM POLLRDNORM
|
||||
#define TNET_POLLRDBAND POLLRDBAND
|
||||
#define TNET_POLLIN POLLIN
|
||||
#define TNET_POLLPRI POLLPRI
|
||||
|
||||
#define TNET_POLLWRNORM POLLWRNORM
|
||||
#define TNET_POLLOUT POLLOUT
|
||||
#define TNET_POLLWRBAND POLLWRBAND
|
||||
|
||||
#define TNET_POLLERR POLLERR
|
||||
#define TNET_POLLHUP POLLHUP
|
||||
#define TNET_POLLNVAL POLLNVAL
|
||||
|
||||
#if TNET_UNDER_WINDOWS
|
||||
# define tnet_poll WSAPoll
|
||||
#else
|
||||
# define tnet_poll poll
|
||||
#endif /* TNET_UNDER_WINDOWS */
|
||||
|
||||
#else
|
||||
|
||||
typedef struct tnet_pollfd_s
|
||||
{
|
||||
tnet_fd_t fd;
|
||||
short events;
|
||||
short revents;
|
||||
}
|
||||
tnet_pollfd_t;
|
||||
|
||||
#define TNET_POLLRDNORM 0x0100
|
||||
#define TNET_POLLRDBAND 0x0200
|
||||
#define TNET_POLLIN (TNET_POLLRDNORM | TNET_POLLRDBAND)
|
||||
#define TNET_POLLPRI 0x0400
|
||||
|
||||
#define TNET_POLLWRNORM 0x0010
|
||||
#define TNET_POLLOUT (TNET_POLLWRNORM)
|
||||
#define TNET_POLLWRBAND 0x0020
|
||||
|
||||
#define TNET_POLLERR 0x0001
|
||||
#define TNET_POLLHUP 0x0002
|
||||
#define TNET_POLLNVAL 0x0004
|
||||
|
||||
int tnet_poll(tnet_pollfd_t fds[ ], tnet_nfds_t nfds, int timeout);
|
||||
|
||||
#endif /* TNET_HAVE_POLL */
|
||||
|
||||
#endif /* TNET_USE_POLL */
|
||||
|
||||
#endif /* TNET_POLL_H */
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include "tnet_socket.h"
|
||||
|
||||
#include "tnet_utils.h"
|
||||
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
|
@ -74,7 +76,7 @@ int tnet_socket_stream_connectto(tnet_socket_tcp_t *sock, const char* host, tnet
|
|||
hints.ai_protocol = TNET_SOCKET_TYPE_IS_STREAM(sock->type) ? IPPROTO_TCP : IPPROTO_UDP;
|
||||
|
||||
|
||||
if(status = tnet_getaddrinfo(host, _port, &hints, &result))
|
||||
if((status = tnet_getaddrinfo(host, _port, &hints, &result)))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
goto bail;
|
||||
|
@ -84,7 +86,7 @@ int tnet_socket_stream_connectto(tnet_socket_tcp_t *sock, const char* host, tnet
|
|||
{
|
||||
if(ptr->ai_family == hints.ai_family && ptr->ai_socktype == hints.ai_socktype && ptr->ai_protocol == hints.ai_protocol)
|
||||
{
|
||||
if(status = connect(sock->fd, ptr->ai_addr, ptr->ai_addrlen))
|
||||
if((status = connect(sock->fd, ptr->ai_addr, ptr->ai_addrlen)))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
goto bail;
|
||||
|
@ -143,7 +145,7 @@ static void* tnet_socket_create(void * self, va_list * app)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(status = tnet_gethostname(&local_hostname))
|
||||
if((status = tnet_gethostname(&local_hostname)))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
goto bail;
|
||||
|
@ -158,7 +160,7 @@ static void* tnet_socket_create(void * self, va_list * app)
|
|||
hints.ai_flags = AI_PASSIVE; /* Bind to the local machine. */
|
||||
|
||||
/* Performs getaddrinfo */
|
||||
if(status = tnet_getaddrinfo(local_hostname, port, &hints, &result))
|
||||
if((status = tnet_getaddrinfo(local_hostname, port, &hints, &result)))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
goto bail;
|
||||
|
@ -171,7 +173,7 @@ static void* tnet_socket_create(void * self, va_list * app)
|
|||
{
|
||||
sock->fd = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
|
||||
/* Get local IP string. */
|
||||
if(status = tnet_getnameinfo(ptr->ai_addr, ptr->ai_addrlen, sock->ip, sizeof(sock->ip), 0, 0, NI_NUMERICHOST))
|
||||
if((status = tnet_getnameinfo(ptr->ai_addr, ptr->ai_addrlen, sock->ip, sizeof(sock->ip), 0, 0, NI_NUMERICHOST)))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
tnet_socket_close(sock);
|
||||
|
@ -179,7 +181,7 @@ static void* tnet_socket_create(void * self, va_list * app)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(status = bind(sock->fd, ptr->ai_addr, ptr->ai_addrlen))
|
||||
if((status = bind(sock->fd, ptr->ai_addr, ptr->ai_addrlen)))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
tnet_socket_close(sock);
|
||||
|
@ -219,6 +221,14 @@ static void* tnet_socket_create(void * self, va_list * app)
|
|||
}
|
||||
}
|
||||
|
||||
/* Sets the socket to nonblocking mode */
|
||||
#if TNET_USE_POLL
|
||||
if((status = tnet_sockfd_set_nonblocking(sock->fd)))
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
#endif
|
||||
|
||||
bail:
|
||||
/* Free addrinfo */
|
||||
tnet_freeaddrinfo(result);
|
||||
|
@ -252,4 +262,4 @@ static const tsk_object_def_t tnet_socket_def_s =
|
|||
tnet_socket_destroy,
|
||||
0,
|
||||
};
|
||||
const void *tnet_socket_def_t = &tnet_socket_def_s;
|
||||
const void *tnet_socket_def_t = &tnet_socket_def_s;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#define TNET_SOCKET_H
|
||||
|
||||
#include "tinyNET_config.h"
|
||||
#include "tnet_utils.h"
|
||||
#include "tnet_types.h"
|
||||
|
||||
#include "tsk_list.h"
|
||||
|
||||
|
|
|
@ -48,12 +48,12 @@ int tnet_transport_start(tnet_transport_handle_t* handle)
|
|||
tnet_transport_t *transport = handle;
|
||||
|
||||
TSK_RUNNABLE(transport)->run = run;
|
||||
if(ret = tsk_runnable_start(TSK_RUNNABLE(transport), tsk_buffer_def_t))
|
||||
if((ret = tsk_runnable_start(TSK_RUNNABLE(transport), tsk_buffer_def_t)))
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(ret = tsk_thread_create(&(transport->mainThreadId[0]), tnet_transport_mainthread, transport))
|
||||
if((ret = tsk_thread_create(&(transport->mainThreadId[0]), tnet_transport_mainthread, transport)))
|
||||
{
|
||||
tsk_runnable_stop(TSK_RUNNABLE(transport));
|
||||
return ret;
|
||||
|
@ -81,6 +81,23 @@ int tnet_transport_isready(const tnet_transport_handle_t *handle)
|
|||
}
|
||||
}
|
||||
|
||||
int tnet_transport_issecure(const tnet_transport_handle_t *handle)
|
||||
{
|
||||
if(handle)
|
||||
{
|
||||
const tnet_transport_t *transport = handle;
|
||||
if(transport->master)
|
||||
{
|
||||
return TNET_SOCKET_TYPE_IS_SECURE(transport->master->type);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TSK_DEBUG_ERROR("NULL transport object.");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* tnet_transport_get_description(const tnet_transport_handle_t *handle)
|
||||
{
|
||||
if(handle)
|
||||
|
@ -114,7 +131,7 @@ tnet_socket_type_t tnet_transport_get_socket_type(const tnet_transport_handle_t
|
|||
if(handle)
|
||||
{
|
||||
const tnet_transport_t *transport = handle;
|
||||
transport->master->type;
|
||||
return transport->master->type;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -123,7 +140,7 @@ tnet_socket_type_t tnet_transport_get_socket_type(const tnet_transport_handle_t
|
|||
return tnet_socket_type_invalid;
|
||||
}
|
||||
|
||||
int tnet_transport_set_callback(const tnet_transport_handle_t *handle, tnet_transport_data_read callback)
|
||||
int tnet_transport_set_callback(const tnet_transport_handle_t *handle, tnet_transport_data_read callback, const void* callback_data)
|
||||
{
|
||||
tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
int ret = -1;
|
||||
|
@ -135,6 +152,7 @@ int tnet_transport_set_callback(const tnet_transport_handle_t *handle, tnet_tran
|
|||
}
|
||||
|
||||
transport->callback = callback;
|
||||
transport->callback_data = callback_data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -166,13 +184,13 @@ void *run(void* self)
|
|||
|
||||
TSK_RUNNABLE_RUN_BEGIN(transport);
|
||||
|
||||
if(curr = TSK_RUNNABLE_POP_FIRST(transport))
|
||||
if((curr = TSK_RUNNABLE_POP_FIRST(transport)))
|
||||
{
|
||||
const tsk_buffer_t *buffer = (const tsk_buffer_t*)curr->data;
|
||||
|
||||
if(transport->callback)
|
||||
{
|
||||
transport->callback(TSK_BUFFER_DATA(buffer), TSK_BUFFER_SIZE(buffer));
|
||||
transport->callback(transport->callback_data, TSK_BUFFER_DATA(buffer), TSK_BUFFER_SIZE(buffer));
|
||||
}
|
||||
tsk_object_unref(curr);
|
||||
}
|
||||
|
@ -228,559 +246,4 @@ static const tsk_object_def_t tnet_transport_def_s =
|
|||
tnet_transport_destroy,
|
||||
0,
|
||||
};
|
||||
const void *tnet_transport_def_t = &tnet_transport_def_s;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if HAVE_POLL
|
||||
/*****************************************************
|
||||
*
|
||||
* Network manager thread using POLL.
|
||||
*
|
||||
*****************************************************/
|
||||
|
||||
|
||||
#elif(TNET_UNDER_WINDOWS) /* !HAVE_POLL */
|
||||
///*****************************************************
|
||||
//*
|
||||
//* Network manager thread using WIN32 WSA* functions.
|
||||
//*
|
||||
//*****************************************************/
|
||||
//
|
||||
///*== Socket description */
|
||||
//typedef struct tnet_socket_desc_s
|
||||
//{
|
||||
// WSABUF wsaBuffer;
|
||||
// tnet_fd_t fd;
|
||||
// unsigned connected:1;
|
||||
//
|
||||
// tnet_transport_data_read callback;
|
||||
//
|
||||
// DWORD readCount;
|
||||
// DWORD writeCount;
|
||||
//}
|
||||
//tnet_socket_desc_t;
|
||||
//
|
||||
///*== Transport context structure definition */
|
||||
//typedef struct tnet_transport_ctx_s
|
||||
//{
|
||||
// size_t eventsCount;
|
||||
// WSAEVENT events[WSA_MAXIMUM_WAIT_EVENTS];
|
||||
// tnet_socket_desc_t* sockets[WSA_MAXIMUM_WAIT_EVENTS];
|
||||
//}
|
||||
//tnet_transport_ctx_t;
|
||||
//
|
||||
///*== Add socket */
|
||||
//static void tnet_socket_desc_add(tnet_fd_t fd, tnet_transport_ctx_t *context)
|
||||
//{
|
||||
// // FIXME: LOCK
|
||||
// tnet_socket_desc_t *socket_desc = tsk_calloc(1, sizeof(tnet_socket_desc_t));
|
||||
// socket_desc->fd = fd;
|
||||
//
|
||||
// context->events[context->eventsCount] = WSACreateEvent();
|
||||
// context->sockets[context->eventsCount] = socket_desc;
|
||||
//
|
||||
// context->eventsCount++;
|
||||
//}
|
||||
//
|
||||
///*== Remove socket */
|
||||
//static void tnet_socket_desc_remove(int index, tnet_transport_ctx_t *context)
|
||||
//{
|
||||
// // FIXME: LOCK
|
||||
//
|
||||
//}
|
||||
//
|
||||
///*== Set callback */
|
||||
//static int tnet_socket_desc_setcb(tnet_transport_ctx_t *context, tnet_fd_t fd, tnet_transport_data_read cb)
|
||||
//{
|
||||
// // FIXME: LOCK
|
||||
// size_t i;
|
||||
// for(i=0; i<context->eventsCount; i++)
|
||||
// {
|
||||
// if(context->sockets[i]->fd == fd)
|
||||
// {
|
||||
// context->sockets[i]->callback = cb;
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
//
|
||||
///*=== */
|
||||
//int CALLBACK AcceptCondFunc(LPWSABUF lpCallerId, LPWSABUF lpCallerData, LPQOS lpSQos, LPQOS lpGQos, LPWSABUF lpCalleeId, LPWSABUF lpCalleeData, GROUP FAR *Group, DWORD CallbackData)
|
||||
//{
|
||||
// tnet_transport_ctx_t *context = (tnet_transport_ctx_t*)CallbackData;
|
||||
// return context->eventsCount < WSA_MAXIMUM_WAIT_EVENTS ? CF_ACCEPT : CF_REJECT;
|
||||
//}
|
||||
//
|
||||
//
|
||||
///* == Register new socket */
|
||||
//int tnet_transport_add_socket(const tnet_transport_handle_t *handle, tnet_fd_t fd)
|
||||
//{
|
||||
// tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
// tnet_transport_ctx_t *context;
|
||||
// int ret = -1;
|
||||
//
|
||||
// if(!transport)
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("Invalid server handle.");
|
||||
// return ret;
|
||||
// }
|
||||
//
|
||||
// context = (tnet_transport_ctx_t*)transport->context;
|
||||
// tnet_socket_desc_add(fd, context);
|
||||
// if(WSAEventSelect(fd, context->events[context->eventsCount - 1], FD_ALL_EVENTS/*FD_READ | FD_CONNECT | FD_CLOSE*/) == SOCKET_ERROR)
|
||||
// {
|
||||
// tnet_socket_desc_remove((context->eventsCount - 1), context);
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// return -1;
|
||||
// }
|
||||
//
|
||||
// /* Signal */
|
||||
// WSASetEvent(context->events[0]);
|
||||
//
|
||||
// return 0;
|
||||
//}
|
||||
//
|
||||
///*== Connect stream/datagram socket to the specified destination. */
|
||||
//tnet_fd_t tnet_transport_connectto(const tnet_transport_handle_t *handle, const char* host, tnet_port_t port)
|
||||
//{
|
||||
// tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
// struct sockaddr_storage to;
|
||||
// int status = -1;
|
||||
// tnet_fd_t fd = INVALID_SOCKET;
|
||||
//
|
||||
// if(!transport)
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("Invalid server handle.");
|
||||
// goto bail;
|
||||
// }
|
||||
//
|
||||
// /* Init destination sockaddr fields */
|
||||
// if(status = tnet_sockaddr_init(host, port, transport->master->type, &to))
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("Invalid HOST/PORT.");
|
||||
// goto bail;
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * STREAM ==> create new socket add connect it to the remote host.
|
||||
// * DGRAM ==> connect the master to the remote host.
|
||||
// */
|
||||
// if(TNET_SOCKET_TYPE_IS_STREAM(transport->master->type))
|
||||
// {
|
||||
// /* Create socket descriptor. */
|
||||
// if(status = tnet_sockfd_init(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, transport->master->type, &fd))
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("Failed to create new sockfd.");
|
||||
//
|
||||
// goto bail;
|
||||
// }
|
||||
//
|
||||
// /* Add the socket */
|
||||
// if(status = tnet_transport_add_socket(handle, fd))
|
||||
// {
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
//
|
||||
// tnet_sockfd_close(&fd);
|
||||
// goto bail;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// fd = transport->master->fd;
|
||||
// }
|
||||
//
|
||||
// if((status = WSAConnect(fd, (LPSOCKADDR)&to, sizeof(to), NULL, NULL, NULL, NULL)) == SOCKET_ERROR)
|
||||
// {
|
||||
// if((status = WSAGetLastError()) == WSAEWOULDBLOCK)
|
||||
// {
|
||||
// TSK_DEBUG_INFO("WSAEWOULDBLOCK error for WSAConnect operation");
|
||||
// status = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
//
|
||||
// tnet_sockfd_close(&fd);
|
||||
// goto bail;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//bail:
|
||||
// return fd;
|
||||
//}
|
||||
//
|
||||
///*== send stream data to the remote peer*/
|
||||
//size_t tnet_transport_send(const tnet_transport_handle_t *handle, tnet_fd_t from, const void* buf, size_t size)
|
||||
//{
|
||||
// tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
// int ret = -1;
|
||||
// WSABUF wsaBuffer;
|
||||
// DWORD numberOfBytesSent = 0;
|
||||
//
|
||||
// if(!transport)
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("Invalid transport handle.");
|
||||
// goto bail;
|
||||
// }
|
||||
//
|
||||
// wsaBuffer.buf = (CHAR*)buf;
|
||||
// wsaBuffer.len = size;
|
||||
//
|
||||
// if((ret = WSASend(from, &wsaBuffer, 1, &numberOfBytesSent, 0, NULL, NULL)) == SOCKET_ERROR)
|
||||
// {
|
||||
// if((ret = WSAGetLastError()) == WSAEWOULDBLOCK)
|
||||
// {
|
||||
// TSK_DEBUG_INFO("WSAEWOULDBLOCK error for WSASend operation");
|
||||
// ret = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
//
|
||||
// //tnet_sockfd_close(&from);
|
||||
// goto bail;
|
||||
// }
|
||||
// }
|
||||
// else ret = 0;
|
||||
//
|
||||
//bail:
|
||||
// return numberOfBytesSent;
|
||||
//}
|
||||
//
|
||||
///*== send dgarm to the specified destionation */
|
||||
//size_t tnet_transport_sendto(const tnet_transport_handle_t *handle, tnet_fd_t from, const struct sockaddr *to, const void* buf, size_t size)
|
||||
//{
|
||||
// tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
// WSABUF wsaBuffer;
|
||||
// DWORD numberOfBytesSent = 0;
|
||||
// int ret = -1;
|
||||
//
|
||||
// if(!transport)
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("Invalid server handle.");
|
||||
// return ret;
|
||||
// }
|
||||
//
|
||||
// if(!TNET_SOCKET_TYPE_IS_DGRAM(transport->master->type))
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("In order to use WSASendTo you must use an udp transport.");
|
||||
// return ret;
|
||||
// }
|
||||
//
|
||||
// wsaBuffer.buf = (CHAR*)buf;
|
||||
// wsaBuffer.len = size;
|
||||
//
|
||||
// if((ret = WSASendTo(from, &wsaBuffer, 1, &numberOfBytesSent, 0, to, sizeof(*to), 0, 0)) == SOCKET_ERROR)
|
||||
// {
|
||||
// if((ret = WSAGetLastError()) == WSAEWOULDBLOCK)
|
||||
// {
|
||||
// TSK_DEBUG_INFO("WSAEWOULDBLOCK error for WSASendTo operation");
|
||||
// ret = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// return ret;
|
||||
// }
|
||||
// } else ret = 0;
|
||||
//
|
||||
// //TSK_DEBUG_INFO("[%s] %d bytes have been sent using WSASendTo", transport->description, numberOfBytesSent);
|
||||
//
|
||||
// return numberOfBytesSent;
|
||||
//}
|
||||
//
|
||||
///*=== Sets callback function to call when data arrive on the specified sockfd. */
|
||||
//int tnet_transport_set_callback(const tnet_transport_handle_t *handle, tnet_fd_t fd, tnet_transport_data_read callback)
|
||||
//{
|
||||
// tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
// int ret = -1;
|
||||
//
|
||||
// if(!transport)
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("Invalid server handle.");
|
||||
// return ret;
|
||||
// }
|
||||
//
|
||||
// return tnet_socket_desc_setcb(transport->context, fd, callback);
|
||||
//}
|
||||
|
||||
///*=== Main thread */
|
||||
//static void *tnet_transport_thread(void *param)
|
||||
//{
|
||||
// tnet_transport_t *transport = param;
|
||||
// tnet_transport_ctx_t *context;
|
||||
// DWORD evt;
|
||||
// WSANETWORKEVENTS networkEvents;
|
||||
// DWORD flags = 0;
|
||||
// int ret;
|
||||
//
|
||||
// context = (tnet_transport_ctx_t*)tsk_calloc(1, sizeof(tnet_transport_ctx_t));
|
||||
// transport->context = context;
|
||||
//
|
||||
// /* Start listening */
|
||||
// if(TNET_SOCKET_TYPE_IS_STREAM(transport->master->type))
|
||||
// {
|
||||
// if(listen(transport->master->fd, WSA_MAXIMUM_WAIT_EVENTS))
|
||||
// {
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// goto bail;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /* Add the current the transport socket to the context. */
|
||||
// tnet_socket_desc_add(transport->master->fd, context);
|
||||
// if(ret = WSAEventSelect(transport->master->fd, context->events[context->eventsCount - 1], TNET_SOCKET_TYPE_IS_DGRAM(transport->master->type) ? FD_READ : FD_ALL_EVENTS/*FD_ACCEPT | FD_READ | FD_CONNECT | FD_CLOSE*/) == SOCKET_ERROR)
|
||||
// {
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// goto bail;
|
||||
// }
|
||||
//
|
||||
// TSK_DEBUG_INFO("Starting [%s] server with IP {%s} on port {%d}...", transport->description, transport->master->ip, transport->master->port);
|
||||
// transport->running = 1;
|
||||
//
|
||||
// while(transport->running)
|
||||
// {
|
||||
// WSAEVENT active_event;
|
||||
// tnet_socket_desc_t* active_socket;
|
||||
// int index;
|
||||
//
|
||||
// /* Wait for multiple events */
|
||||
// if((evt = WSAWaitForMultipleEvents(context->eventsCount, context->events, FALSE, WSA_INFINITE, FALSE)) == WSA_WAIT_FAILED)
|
||||
// {
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// goto bail;
|
||||
// }
|
||||
//
|
||||
// if(!transport->running)
|
||||
// {
|
||||
// goto bail;
|
||||
// }
|
||||
//
|
||||
// /* Get active event and socket */
|
||||
// index = (evt - WSA_WAIT_EVENT_0);
|
||||
// active_event = context->events[index];
|
||||
// active_socket = context->sockets[index];
|
||||
//
|
||||
// /* Get the network events flags */
|
||||
// if (WSAEnumNetworkEvents(active_socket->fd, active_event, &networkEvents) == SOCKET_ERROR)
|
||||
// {
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// goto bail;
|
||||
// }
|
||||
//
|
||||
// /*================== FD_ACCEPT ==================*/
|
||||
// if(networkEvents.lNetworkEvents & FD_ACCEPT)
|
||||
// {
|
||||
// tnet_fd_t fd;
|
||||
//
|
||||
// TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- FD_ACCEPT", transport->description);
|
||||
//
|
||||
// if(networkEvents.iErrorCode[FD_ACCEPT_BIT])
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("ACCEPT FAILED.");
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// /* Accept the connection */
|
||||
// if((fd = WSAAccept(active_socket->fd, NULL, NULL, AcceptCondFunc, (DWORD_PTR)context)) != INVALID_SOCKET)
|
||||
// {
|
||||
// /* Add the new fd to the server context */
|
||||
// tnet_socket_desc_add(fd, context);
|
||||
// if(WSAEventSelect(fd, context->events[context->eventsCount - 1], FD_READ | FD_WRITE | FD_CLOSE) == SOCKET_ERROR)
|
||||
// {
|
||||
// tnet_socket_desc_remove((context->eventsCount - 1), context);
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("ACCEPT FAILED.");
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /*================== FD_CONNECT ==================*/
|
||||
// if(networkEvents.lNetworkEvents & FD_CONNECT)
|
||||
// {
|
||||
// //tnet_fd_t fd;
|
||||
//
|
||||
// TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- FD_CONNECT", transport->description);
|
||||
//
|
||||
// if(networkEvents.iErrorCode[FD_CONNECT_BIT])
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("CONNECT FAILED.");
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// continue;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// active_socket->connected = 1;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /*================== FD_READ ==================*/
|
||||
// if(networkEvents.lNetworkEvents & FD_READ)
|
||||
// {
|
||||
// TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- FD_READ", transport->description);
|
||||
//
|
||||
// if(networkEvents.iErrorCode[FD_READ_BIT])
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("READ FAILED.");
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// /* Create socket's internal buffer. */
|
||||
// if(!active_socket->wsaBuffer.buf)
|
||||
// {
|
||||
// size_t max_buffer_size = TNET_SOCKET_TYPE_IS_DGRAM(transport->master->type) ? DGRAM_MAX_SIZE : STREAM_MAX_SIZE;
|
||||
// active_socket->wsaBuffer.buf = tsk_calloc(max_buffer_size, sizeof(char));
|
||||
// active_socket->wsaBuffer.len = max_buffer_size;
|
||||
// }
|
||||
//
|
||||
// /* Receive the waiting data. */
|
||||
// if(WSARecv(active_socket->fd, &(active_socket->wsaBuffer), 1, &(active_socket->readCount), &flags, 0, 0) == SOCKET_ERROR)
|
||||
// {
|
||||
// if(WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
// {
|
||||
// TSK_DEBUG_INFO("WSAEWOULDBLOCK error for READ operation");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// tnet_socket_desc_remove(index, context);
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //TSK_DEBUG_INFO("WSARecv(%d bytes) success on [%s]\n%s\n", active_socket->readCount, transport->description, active_socket->wsaBuffer.buf);
|
||||
// if(active_socket->callback)
|
||||
// {
|
||||
// active_socket->callback(active_socket->fd, active_socket->wsaBuffer.buf, active_socket->readCount);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /*================== FD_WRITE ==================*/
|
||||
// if(networkEvents.lNetworkEvents & FD_WRITE)
|
||||
// {
|
||||
// TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- FD_WRITE", transport->description);
|
||||
//
|
||||
// if(networkEvents.iErrorCode[FD_WRITE_BIT])
|
||||
// {
|
||||
// TSK_DEBUG_ERROR("WRITE FAILED.");
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// /*{
|
||||
// int test = 10;
|
||||
// WSAOVERLAPPED RecvOverlapped = {0};
|
||||
// RecvOverlapped.hEvent = active_event;
|
||||
//
|
||||
//
|
||||
//
|
||||
// //* Create socket's internal buffer.
|
||||
// if(!active_socket->wsaBuffer.buf)
|
||||
// {
|
||||
// size_t max_buffer_size = TNET_SOCKET_TYPE_IS_DGRAM(transport->master->type) ? DGRAM_MAX_SIZE : STREAM_MAX_SIZE;
|
||||
// active_socket->wsaBuffer.buf = tsk_calloc(max_buffer_size, sizeof(char));
|
||||
// active_socket->wsaBuffer.len = max_buffer_size;
|
||||
// }
|
||||
// while(test--)
|
||||
// {
|
||||
//
|
||||
// //* Receive the waiting data.
|
||||
// if(WSARecv(active_socket->fd, &(active_socket->wsaBuffer), 1, &(active_socket->readCount), &flags, &RecvOverlapped, NULL) == SOCKET_ERROR)
|
||||
// {
|
||||
// if(WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
// {
|
||||
// TSK_DEBUG_INFO("WSAEWOULDBLOCK error for READ operation");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// tnet_socket_desc_remove(index, context);
|
||||
// TNET_PRINT_LAST_ERROR();
|
||||
// //continue;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// TSK_DEBUG_INFO("WSARecv(%d bytes) success on [%s]", active_socket->readCount, transport->description);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //ret = WSAGetOverlappedResult(active_socket->fd, &RecvOverlapped, &active_socket->readCount, FALSE, &flags);
|
||||
// WSAEventSelect(active_socket->fd, active_event, FD_READ | FD_WRITE | FD_CLOSE);
|
||||
// WaitForSingleObject( active_event, INFINITE );
|
||||
// }*/
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /*================== FD_CLOSE ==================*/
|
||||
// if(networkEvents.lNetworkEvents & FD_CLOSE)
|
||||
// {
|
||||
// TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- FD_CLOSE", transport->description);
|
||||
// }
|
||||
//
|
||||
// /* Reset event */
|
||||
// WSAResetEvent(active_event);
|
||||
//
|
||||
// } /* while(transport->running) */
|
||||
//
|
||||
//
|
||||
//bail:
|
||||
// //WSACloseEvent
|
||||
// transport->running = 0;
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
|
||||
#else
|
||||
#error "You MUST use Poll or WSA* functions to handle network operations"
|
||||
#endif /* HAVE_POLL */
|
||||
const void *tnet_transport_def_t = &tnet_transport_def_s;
|
|
@ -42,21 +42,25 @@
|
|||
#define TNET_TRANSPORT_CREATE(host, port, type, description) tsk_object_new(tnet_transport_def_t, (const char*)host, (tnet_port_t)port, (tnet_socket_type_t)type, (const char*) description)
|
||||
#define TNET_TRANSPORT_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
#define TNET_TRANSPORT_DATA_READ(callback) ((tnet_transport_data_read)callback)
|
||||
|
||||
typedef void tnet_transport_handle_t;
|
||||
|
||||
typedef int (*tnet_transport_data_read)(const void* data, size_t size);
|
||||
typedef int (*tnet_transport_data_read)(const void *callback_data, const void* data, size_t size);
|
||||
|
||||
TINYNET_API int tnet_transport_start(tnet_transport_handle_t* transport);
|
||||
TINYNET_API int tnet_transport_isready(const tnet_transport_handle_t *handle);
|
||||
TINYNET_API int tnet_transport_issecure(const tnet_transport_handle_t *handle);
|
||||
TINYNET_API const char* tnet_transport_get_description(const tnet_transport_handle_t *handle);
|
||||
TINYNET_API int tnet_transport_get_ip_n_port(const tnet_transport_handle_t *handle, tnet_fd_t fd, tnet_ip_t *ip, tnet_port_t *port);
|
||||
|
||||
TINYNET_API int tnet_transport_isconnected(const tnet_transport_handle_t *handle, tnet_fd_t fd);
|
||||
TINYNET_API int tnet_transport_add_socket(const tnet_transport_handle_t *handle, tnet_fd_t fd);
|
||||
TINYNET_API tnet_fd_t tnet_transport_connectto(const tnet_transport_handle_t *handle, const char* host, tnet_port_t port);
|
||||
TINYNET_API size_t tnet_transport_send(const tnet_transport_handle_t *handle, tnet_fd_t from, const void* buf, size_t size);
|
||||
TINYNET_API size_t tnet_transport_sendto(const tnet_transport_handle_t *handle, tnet_fd_t from, const struct sockaddr *to, const void* buf, size_t size);
|
||||
|
||||
TINYNET_API int tnet_transport_set_callback(const tnet_transport_handle_t *handle, tnet_transport_data_read callback);
|
||||
TINYNET_API int tnet_transport_set_callback(const tnet_transport_handle_t *handle, tnet_transport_data_read callback, const void* callback_data);
|
||||
|
||||
TINYNET_API tnet_socket_type_t tnet_transport_get_socket_type(const tnet_transport_handle_t *handle);
|
||||
TINYNET_API int tnet_transport_shutdown(tnet_transport_handle_t* handle);
|
||||
|
@ -75,6 +79,7 @@ typedef struct tnet_transport_s
|
|||
char *description;
|
||||
|
||||
tnet_transport_data_read callback;
|
||||
const void* callback_data;
|
||||
}
|
||||
tnet_transport_t;
|
||||
|
||||
|
|
|
@ -0,0 +1,405 @@
|
|||
/*
|
||||
* 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 tnet_transport_32.c
|
||||
* @brief Network transport layer for WIN32 and WINCE systems.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tnet_transport.h"
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_debug.h"
|
||||
#include "tsk_thread.h"
|
||||
|
||||
#if TNET_USE_POLL
|
||||
|
||||
#include "tnet_poll.h"
|
||||
|
||||
#define TNET_MAX_FDS 64
|
||||
|
||||
/*== Socket description ==*/
|
||||
typedef struct transport_socket_s
|
||||
{
|
||||
char *buffer;
|
||||
size_t bufsize;
|
||||
tnet_fd_t fd;
|
||||
unsigned connected:1;
|
||||
}
|
||||
transport_socket_t;
|
||||
|
||||
/*== Transport context structure definition ==*/
|
||||
typedef struct transport_context_s
|
||||
{
|
||||
size_t count;
|
||||
short events;
|
||||
tnet_pollfd_t ufds[TNET_MAX_FDS];
|
||||
transport_socket_t* sockets[TNET_MAX_FDS];
|
||||
}
|
||||
transport_context_t;
|
||||
|
||||
static void transport_socket_add(tnet_fd_t fd, transport_context_t *context);
|
||||
static void transport_socket_set_connected(tnet_fd_t fd, transport_context_t *context, int connected);
|
||||
static void transport_socket_remove(int index, transport_context_t *context);
|
||||
|
||||
/* Checks if socket is connected */
|
||||
int tnet_transport_isconnected(const tnet_transport_handle_t *handle, tnet_fd_t fd)
|
||||
{
|
||||
tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
transport_context_t *context;
|
||||
size_t i;
|
||||
|
||||
if(!transport)
|
||||
{
|
||||
TSK_DEBUG_ERROR("Invalid server handle.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
context = (transport_context_t*)transport->context;
|
||||
for(i=0; i<context->count; i++)
|
||||
{
|
||||
const transport_socket_t* socket = context->sockets[i];
|
||||
if(socket->fd == fd)
|
||||
{
|
||||
return socket->connected;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tnet_transport_add_socket(const tnet_transport_handle_t *handle, tnet_fd_t fd)
|
||||
{
|
||||
tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
transport_context_t *context;
|
||||
int ret = -1;
|
||||
|
||||
if(!transport)
|
||||
{
|
||||
TSK_DEBUG_ERROR("Invalid server handle.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
context = (transport_context_t*)transport->context;
|
||||
transport_socket_add(fd, context);
|
||||
|
||||
// signal
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
tnet_fd_t tnet_transport_connectto(const tnet_transport_handle_t *handle, const char* host, tnet_port_t port)
|
||||
{
|
||||
tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
struct sockaddr_storage to;
|
||||
int status = -1;
|
||||
tnet_fd_t fd = TNET_INVALID_SOCKET;
|
||||
|
||||
if(!transport || !transport->master)
|
||||
{
|
||||
TSK_DEBUG_ERROR("Invalid transport handle.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Init destination sockaddr fields */
|
||||
if((status = tnet_sockaddr_init(host, port, transport->master->type, &to)))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Invalid HOST/PORT.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*
|
||||
* STREAM ==> create new socket add connect it to the remote host.
|
||||
* DGRAM ==> connect the master to the remote host.
|
||||
*/
|
||||
if(TNET_SOCKET_TYPE_IS_STREAM(transport->master->type))
|
||||
{
|
||||
/* Create client socket descriptor. */
|
||||
if((status = tnet_sockfd_init(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, transport->master->type, &fd)))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create new sockfd.");
|
||||
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Add the socket */
|
||||
if((status = tnet_transport_add_socket(handle, fd)))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
|
||||
tnet_sockfd_close(&fd);
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fd = transport->master->fd;
|
||||
}
|
||||
|
||||
if((status = connect(fd, (struct sockaddr*)&to, sizeof(to))))
|
||||
{
|
||||
status = tnet_geterrno();
|
||||
if(status == TNET_ERROR_WOULDBLOCK || status == TNET_ERROR_INPROGRESS)
|
||||
{
|
||||
TSK_DEBUG_INFO("TNET_ERROR_WOULDBLOCK/TNET_ERROR_INPROGRESS error for Connect operation");
|
||||
status = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
|
||||
tnet_sockfd_close(&fd);
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
|
||||
/* update connection status */
|
||||
transport_socket_set_connected(fd, transport->context, (status==0));
|
||||
|
||||
bail:
|
||||
return fd;
|
||||
}
|
||||
|
||||
size_t tnet_transport_send(const tnet_transport_handle_t *handle, tnet_fd_t from, const void* buf, size_t size)
|
||||
{
|
||||
tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
int numberOfBytesSent = 0;
|
||||
|
||||
if(!transport)
|
||||
{
|
||||
TSK_DEBUG_ERROR("Invalid transport handle.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if((numberOfBytesSent = send(from, buf, size, 0)) == 0)
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
|
||||
//tnet_sockfd_close(&from);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
bail:
|
||||
return numberOfBytesSent;
|
||||
}
|
||||
|
||||
size_t tnet_transport_sendto(const tnet_transport_handle_t *handle, tnet_fd_t from, const struct sockaddr *to, const void* buf, size_t size)
|
||||
{
|
||||
tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
int numberOfBytesSent = 0;
|
||||
|
||||
if(!transport)
|
||||
{
|
||||
TSK_DEBUG_ERROR("Invalid server handle.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if(!TNET_SOCKET_TYPE_IS_DGRAM(transport->master->type))
|
||||
{
|
||||
TSK_DEBUG_ERROR("In order to use WSASendTo you must use an udp transport.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if((numberOfBytesSent = sendto(from, buf, size, 0, to, sizeof(*to))) == 0)
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
goto bail;
|
||||
}
|
||||
|
||||
bail:
|
||||
return numberOfBytesSent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*== Add new socket ==*/
|
||||
void transport_socket_add(tnet_fd_t fd, transport_context_t *context)
|
||||
{
|
||||
transport_socket_t *sock = tsk_calloc(1, sizeof(transport_socket_t));
|
||||
sock->fd = fd;
|
||||
|
||||
context->ufds[context->count].fd = fd;
|
||||
context->ufds[context->count].events = context->events;
|
||||
context->sockets[context->count] = sock;
|
||||
|
||||
context->count++;
|
||||
}
|
||||
|
||||
/*== change connection state ==*/
|
||||
static void transport_socket_set_connected(tnet_fd_t fd, transport_context_t *context, int connected)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for(i=0; i<context->count; i++)
|
||||
{
|
||||
if(context->sockets[i]->fd == fd)
|
||||
{
|
||||
context->sockets[i]->connected = connected;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*== Remove socket ==*/
|
||||
void transport_socket_remove(int index, transport_context_t *context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int tnet_transport_stop(tnet_transport_t *transport)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(ret = tsk_runnable_stop(TSK_RUNNABLE(transport)))
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
//signal(...);
|
||||
return tsk_thread_join(transport->mainThreadId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*=== Main thread */
|
||||
void *tnet_transport_mainthread(void *param)
|
||||
{
|
||||
tnet_transport_t *transport = param;
|
||||
transport_context_t *context;
|
||||
int ret;
|
||||
size_t i;
|
||||
|
||||
transport_socket_t* active_socket;
|
||||
|
||||
context = (transport_context_t*)tsk_calloc(1, sizeof(transport_context_t));
|
||||
context->events = TNET_SOCKET_TYPE_IS_DGRAM(transport->master->type) ? TNET_POLLIN : TNET_POLLIN | TNET_POLLOUT | TNET_POLLPRI;
|
||||
transport->context = context;
|
||||
|
||||
/* Start listening */
|
||||
if(TNET_SOCKET_TYPE_IS_STREAM(transport->master->type))
|
||||
{
|
||||
if(listen(transport->master->fd, TNET_MAX_FDS))
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the current transport socket to the context. */
|
||||
transport_socket_add(transport->master->fd, context);
|
||||
|
||||
/* Set transport to active */
|
||||
transport->active = 1;
|
||||
|
||||
TSK_DEBUG_INFO("Starting [%s] server with IP {%s} on port {%d}...", transport->description, transport->master->ip, transport->master->port);
|
||||
|
||||
while(transport->running)
|
||||
{
|
||||
if((ret = tnet_poll(context->ufds, context->count, -1)) < 0)
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if(!transport->running)
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
for(i=0; i<context->count; i++)
|
||||
{
|
||||
if(!context->ufds[i].revents) continue;
|
||||
|
||||
/* Get active event and socket */
|
||||
active_socket = context->sockets[i];
|
||||
|
||||
/*================== POLLIN ==================*/
|
||||
if(context->ufds[i].revents & TNET_POLLIN)
|
||||
{
|
||||
int readCount;
|
||||
TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- TNET_POLLIN", transport->description);
|
||||
|
||||
/* Create socket's internal buffer. */
|
||||
if(!active_socket->buffer)
|
||||
{
|
||||
size_t max_buffer_size = TNET_SOCKET_TYPE_IS_DGRAM(transport->master->type) ? DGRAM_MAX_SIZE : STREAM_MAX_SIZE;
|
||||
active_socket->buffer = tsk_calloc(max_buffer_size, sizeof(char));
|
||||
active_socket->bufsize = max_buffer_size;
|
||||
}
|
||||
|
||||
/* Receive the waiting data. */
|
||||
if((readCount = recv(active_socket->fd, active_socket->buffer, active_socket->bufsize, 0)) < 0)
|
||||
{
|
||||
//if(tnet_geterrno() == TNET_ERROR_WOULDBLOCK)
|
||||
{
|
||||
//TSK_DEBUG_INFO("WSAEWOULDBLOCK error for READ operation");
|
||||
}
|
||||
//else
|
||||
{
|
||||
transport_socket_remove(i, context);
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TSK_RUNNABLE_ENQUEUE(TSK_RUNNABLE(transport), active_socket->buffer, readCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*================== TNET_POLLOUT ==================*/
|
||||
if(context->ufds[i].revents & TNET_POLLOUT)
|
||||
{
|
||||
TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- TNET_POLLOUT", transport->description);
|
||||
}
|
||||
|
||||
|
||||
/*================== TNET_POLLPRI ==================*/
|
||||
if(context->ufds[i].revents & TNET_POLLPRI)
|
||||
{
|
||||
TSK_DEBUG_INFO("NETWORK EVENT FOR SERVER [%s] -- TNET_POLLPRI", transport->description);
|
||||
}
|
||||
|
||||
|
||||
}/* for */
|
||||
}
|
||||
|
||||
bail:
|
||||
|
||||
transport->active = 0;
|
||||
|
||||
/* cleanup */
|
||||
while(context->count)
|
||||
{
|
||||
transport_socket_remove(0, context);
|
||||
}
|
||||
|
||||
TSK_DEBUG_INFO("Stopping [%s] server with IP {%s} on port {%d}...", transport->description, transport->master->ip, transport->master->port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_POLL_H */
|
|
@ -33,7 +33,7 @@
|
|||
#include "tsk_debug.h"
|
||||
#include "tsk_thread.h"
|
||||
|
||||
#if TNET_UNDER_WINDOWS
|
||||
#if TNET_UNDER_WINDOWS && !TNET_USE_POLL
|
||||
|
||||
/*== Socket description ==*/
|
||||
typedef struct transport_socket_s
|
||||
|
@ -56,6 +56,32 @@ transport_context_t;
|
|||
static void transport_socket_add(tnet_fd_t fd, transport_context_t *context);
|
||||
static void transport_socket_remove(int index, transport_context_t *context);
|
||||
|
||||
/* Checks if socket is connected */
|
||||
int tnet_transport_isconnected(const tnet_transport_handle_t *handle, tnet_fd_t fd)
|
||||
{
|
||||
tnet_transport_t *transport = (tnet_transport_t*)handle;
|
||||
transport_context_t *context;
|
||||
size_t i;
|
||||
|
||||
if(!transport)
|
||||
{
|
||||
TSK_DEBUG_ERROR("Invalid server handle.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
context = (transport_context_t*)transport->context;
|
||||
for(i=0; i<context->count; i++)
|
||||
{
|
||||
const transport_socket_t* socket = context->sockets[i];
|
||||
if(socket->fd == fd)
|
||||
{
|
||||
return socket->connected;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add new socket to the watcher.
|
||||
*/
|
||||
|
@ -96,9 +122,9 @@ tnet_fd_t tnet_transport_connectto(const tnet_transport_handle_t *handle, const
|
|||
int status = -1;
|
||||
tnet_fd_t fd = INVALID_SOCKET;
|
||||
|
||||
if(!transport)
|
||||
if(!transport || !transport->master)
|
||||
{
|
||||
TSK_DEBUG_ERROR("Invalid server handle.");
|
||||
TSK_DEBUG_ERROR("Invalid transport handle.");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
@ -115,7 +141,7 @@ tnet_fd_t tnet_transport_connectto(const tnet_transport_handle_t *handle, const
|
|||
*/
|
||||
if(TNET_SOCKET_TYPE_IS_STREAM(transport->master->type))
|
||||
{
|
||||
/* Create socket descriptor. */
|
||||
/* Create client socket descriptor. */
|
||||
if(status = tnet_sockfd_init(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, transport->master->type, &fd))
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create new sockfd.");
|
||||
|
@ -317,6 +343,10 @@ void *tnet_transport_mainthread(void *param)
|
|||
WSANETWORKEVENTS networkEvents;
|
||||
DWORD flags = 0;
|
||||
int ret;
|
||||
|
||||
WSAEVENT active_event;
|
||||
transport_socket_t* active_socket;
|
||||
int index;
|
||||
|
||||
context = (transport_context_t*)tsk_calloc(1, sizeof(transport_context_t));
|
||||
transport->context = context;
|
||||
|
@ -346,10 +376,6 @@ void *tnet_transport_mainthread(void *param)
|
|||
|
||||
while(transport->running)
|
||||
{
|
||||
WSAEVENT active_event;
|
||||
transport_socket_t* active_socket;
|
||||
int index;
|
||||
|
||||
/* Wait for multiple events */
|
||||
if((evt = WSAWaitForMultipleEvents(context->count, context->events, FALSE, WSA_INFINITE, FALSE)) == WSA_WAIT_FAILED)
|
||||
{
|
||||
|
|
|
@ -69,10 +69,18 @@ void tnet_getlasterror(tnet_error_t *error)
|
|||
}
|
||||
#else
|
||||
//strerror(errno);
|
||||
memcpy(*error, "Unknown error.", sizeof(Unknown error));
|
||||
memcpy(*error, "Unknown error.", sizeof("Unknown error"));
|
||||
#endif
|
||||
}
|
||||
|
||||
int tnet_geterrno()
|
||||
{
|
||||
#if TNET_UNDER_WINDOWS
|
||||
return WSAGetLastError();
|
||||
#else
|
||||
return errno;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn int tnet_getaddrinfo(const char *node, const char *service,
|
||||
|
@ -257,18 +265,25 @@ int tnet_sockfd_init(const char *host, tnet_port_t port, enum tnet_socket_type_e
|
|||
int status = -1;
|
||||
struct sockaddr_storage ai_addr;
|
||||
int ai_family, ai_socktype, ai_protocol;
|
||||
*fd = INVALID_SOCKET;
|
||||
*fd = TNET_INVALID_SOCKET;
|
||||
|
||||
if(status = tnet_sockaddrinfo_init(host, port, type, &ai_addr, &ai_family, &ai_socktype, &ai_protocol))
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if((*fd = socket(ai_family, ai_socktype, ai_protocol)) == INVALID_SOCKET)
|
||||
if((*fd = socket(ai_family, ai_socktype, ai_protocol)) == TNET_INVALID_SOCKET)
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
goto bail;
|
||||
}
|
||||
|
||||
#if TNET_USE_POLL
|
||||
if(status = tnet_sockfd_set_nonblocking(*fd))
|
||||
{
|
||||
goto bail;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(status = bind(*fd, (const struct sockaddr*)&ai_addr, sizeof(ai_addr)))
|
||||
{
|
||||
|
@ -279,7 +294,40 @@ int tnet_sockfd_init(const char *host, tnet_port_t port, enum tnet_socket_type_e
|
|||
}
|
||||
|
||||
bail:
|
||||
return (*fd == INVALID_SOCKET) ? status : 0;
|
||||
return (*fd == TNET_INVALID_SOCKET) ? status : 0;
|
||||
}
|
||||
|
||||
int tnet_sockfd_set_nonblocking(tnet_fd_t fd)
|
||||
{
|
||||
if(fd != TNET_INVALID_FD)
|
||||
{
|
||||
#if TNET_UNDER_WINDOWS
|
||||
ULONG nonBlocking = 1;
|
||||
if(ioctlsocket(fd, FIONBIO, &nonBlocking))
|
||||
//if(WSAIoctl(fd, FIONBIO, &nonblocking, sizeof(nonblocking), NULL, 0, NULL, NULL, NULL) == SOCKET_ERROR)
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
int flags;
|
||||
if((flags = fcntl(fd, F_GETFL, 0)) < 0)
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
return -1;
|
||||
}
|
||||
if(fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0)
|
||||
{
|
||||
TNET_PRINT_LAST_ERROR();
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// int on = 1;
|
||||
// ioctl(fd, FIONBIO, (char *)&on);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tnet_sockfd_close(tnet_fd_t *fd)
|
||||
|
@ -291,6 +339,6 @@ int tnet_sockfd_close(tnet_fd_t *fd)
|
|||
ret = close(*fd);
|
||||
#endif
|
||||
|
||||
*fd = INVALID_SOCKET;
|
||||
*fd = TNET_INVALID_SOCKET;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,30 +31,12 @@
|
|||
#define TNET_UTILS_H
|
||||
|
||||
#include "tinyNET_config.h"
|
||||
|
||||
#if TNET_UNDER_WINDOWS
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
typedef int32_t tnet_fd_t;
|
||||
typedef uint16_t tnet_port_t;
|
||||
typedef char tnet_host_t[NI_MAXHOST];
|
||||
typedef char tnet_ip_t[INET6_ADDRSTRLEN];
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
typedef TCHAR tnet_error_t[512];
|
||||
#else
|
||||
typedef char tnet_error_t[512];
|
||||
#endif
|
||||
#include "tnet_socket.h"
|
||||
#include "tnet_types.h"
|
||||
|
||||
TINYNET_API void tnet_getlasterror(tnet_error_t *error);
|
||||
TINYNET_API int tnet_geterrno();
|
||||
|
||||
|
||||
TINYNET_API int tnet_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
|
||||
TINYNET_API void tnet_freeaddrinfo(struct addrinfo *ai);
|
||||
|
@ -65,9 +47,10 @@ TINYNET_API int tnet_get_ip_n_port(tnet_fd_t fd, tnet_ip_t *ip, tnet_port_t *por
|
|||
TINYNET_API int tnet_getnameinfo(const struct sockaddr *sa, socklen_t salen, char* node, socklen_t nodelen, char* service, socklen_t servicelen, int flags);
|
||||
TINYNET_API int tnet_gethostname(tnet_host_t* result);
|
||||
|
||||
TINYNET_API int tnet_sockaddrinfo_init(const char *host, tnet_port_t port, enum tnet_socket_type_e type, struct sockaddr_storage *ai_addr, int *ai_family, int *ai_socktype, int *ai_protocol);
|
||||
TINYNET_API int tnet_sockaddr_init(const char *host, tnet_port_t port, enum tnet_socket_type_e type, struct sockaddr_storage *addr);
|
||||
TINYNET_API int tnet_sockfd_init(const char *host, tnet_port_t port, enum tnet_socket_type_e type, tnet_fd_t *fd);
|
||||
TINYNET_API int tnet_sockaddrinfo_init(const char *host, tnet_port_t port, tnet_socket_type_t type, struct sockaddr_storage *ai_addr, int *ai_family, int *ai_socktype, int *ai_protocol);
|
||||
TINYNET_API int tnet_sockaddr_init(const char *host, tnet_port_t port, tnet_socket_type_t type, struct sockaddr_storage *addr);
|
||||
TINYNET_API int tnet_sockfd_init(const char *host, tnet_port_t port, tnet_socket_type_t type, tnet_fd_t *fd);
|
||||
TINYNET_API int tnet_sockfd_set_nonblocking(tnet_fd_t fd);
|
||||
|
||||
TINYNET_API int tnet_sockfd_close(tnet_fd_t *fd);
|
||||
|
||||
|
@ -78,4 +61,7 @@ TINYNET_API int tnet_sockfd_close(tnet_fd_t *fd);
|
|||
TSK_DEBUG_ERROR("Network error --> %s", error); \
|
||||
}
|
||||
|
||||
#endif /* TNET_UTILS_H */
|
||||
|
||||
#include "tnet_socket.h"
|
||||
|
||||
#endif /* TNET_UTILS_H */
|
||||
|
|
|
@ -35,16 +35,14 @@
|
|||
"\r\n"
|
||||
|
||||
|
||||
static int tnet_tcp_data_read(const void* data, size_t size)
|
||||
static int tnet_tcp_data_read(const void *callback_data, const void* data, size_t size)
|
||||
{
|
||||
/* Do quick job. */
|
||||
TSK_DEBUG_INFO("--- TCP ---\n%s\n", data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tnet_udp_data_read(const void* data, size_t size)
|
||||
static int tnet_udp_data_read(const void *callback_data, const void* data, size_t size)
|
||||
{
|
||||
/* Do quick job. */
|
||||
TSK_DEBUG_INFO("--- UDP ---\n%s\n", data);
|
||||
return 0;
|
||||
}
|
||||
|
@ -70,16 +68,16 @@ void test_transport_tcp_ipv4(tnet_transport_handle_t *transport)
|
|||
//tsk_thread_sleep(500);
|
||||
|
||||
/* Connect to the SIP Registrar */
|
||||
if((fd = tnet_transport_connectto(transport, REMOTE_IPV4, 5060)) == INVALID_SOCKET)
|
||||
if((fd = tnet_transport_connectto(transport, REMOTE_IPV4, 4060)) == INVALID_SOCKET)
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to connect TCP/IPv4 transport.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set our callback function */
|
||||
tnet_transport_set_callback(transport, tnet_tcp_data_read);
|
||||
tnet_transport_set_callback(transport, tnet_tcp_data_read, "callbackdata");
|
||||
|
||||
//while(!tnet_transport_get_isconnected(transport))
|
||||
while(!tnet_transport_isconnected(transport, fd))
|
||||
{
|
||||
/* Connecto succeed but not connected yet.*/
|
||||
tsk_thread_sleep(500);
|
||||
|
@ -128,7 +126,7 @@ int test_transport_udp_ipv4(tnet_transport_handle_t *transport)
|
|||
//tsk_thread_sleep(2000);
|
||||
|
||||
/* Set our callback function */
|
||||
tnet_transport_set_callback(transport, tnet_udp_data_read);
|
||||
tnet_transport_set_callback(transport, tnet_udp_data_read, "callbackdata");
|
||||
|
||||
/* Send our SIP message */
|
||||
/*while(1)*/{
|
||||
|
|
|
@ -342,6 +342,10 @@
|
|||
RelativePath=".\src\tnet.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\tnet_poll.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\tnet_socket.c"
|
||||
>
|
||||
|
@ -350,6 +354,10 @@
|
|||
RelativePath=".\src\tnet_transport.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\tnet_transport_poll.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\tnet_transport_win32.c"
|
||||
>
|
||||
|
@ -370,6 +378,10 @@
|
|||
RelativePath=".\src\tnet.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\tnet_poll.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\tnet_socket.h"
|
||||
>
|
||||
|
@ -378,6 +390,10 @@
|
|||
RelativePath=".\src\tnet_transport.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\tnet_types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\tnet_utils.h"
|
||||
>
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject>
|
||||
<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="0" concurrentBuildJobs="4" defaultMMPChangedAction="0" infBuildComponents="" infFileLocation="group/bld.inf" macrosFile="" makeEngineToUse="make" manageDependencies="true" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideMakeEngine="false" overrideWorkspaceSettings="false" promptForMMPChangedAction="true" useConcurrentBuilding="true" useDebugMode="false" useIncrementalBuilder="false" useKeepGoing="false" useMMPMacros="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySAK\group\bld.inf;C:\Projects\Doubango\tinySAK\group\tinySAK.mmp;" includesCache="C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__CW32__;__S60_50__;__WINSCW__;_UNICODE;__S60_3X__;__S60_5X__;_DEBUG;__SERIES60_3X__;TINYSAK_EXPORTS;__DLL__;__WINS__;" moduleId="configDataCache" sourcesCache="/tinySAK/src;src;" timestampCache="1261708366332" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySAK\group\bld.inf;C:\Projects\Doubango\tinySAK\group\tinySAK.mmp;" includesCache="C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__ARMCC_2__;__ARMCC__;__MARM__;__S60_50__;__S60_3X__;__ARMCC_2_2__;_UNICODE;__S60_5X__;TINYSAK_EXPORTS;_DEBUG;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinySAK/src;src;" timestampCache="1261708366347" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySAK\group\bld.inf;C:\Projects\Doubango\tinySAK\group\tinySAK.mmp;" includesCache="C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__ARMCC_2__;NDEBUG;__ARMCC__;__MARM__;__S60_50__;__S60_3X__;__ARMCC_2_2__;_UNICODE;__S60_5X__;TINYSAK_EXPORTS;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinySAK/src;src;" timestampCache="1261708366363" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCEErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySAK\group\bld.inf;C:\Projects\Doubango\tinySAK\group\tinySAK.mmp;" includesCache="C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__GCCE__;__MARM__;__S60_50__;_UNICODE;__S60_3X__;__S60_5X__;TINYSAK_EXPORTS;_DEBUG;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinySAK/src;src;" timestampCache="1261708366379" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCEErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySAK\group\bld.inf;C:\Projects\Doubango\tinySAK\group\tinySAK.mmp;" includesCache="C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__GCCE__;NDEBUG;__MARM__;__S60_50__;_UNICODE;__S60_3X__;__S60_5X__;TINYSAK_EXPORTS;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinySAK/src;src;" timestampCache="1261708366394" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
</cproject>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>tinySAK</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,91 @@
|
|||
EXPORTS
|
||||
tsk_b10tob16 @ 1 NONAME
|
||||
tsk_b16tob10 @ 2 NONAME
|
||||
tsk_buffer_append @ 3 NONAME
|
||||
tsk_buffer_appendEx @ 4 NONAME
|
||||
tsk_buffer_def_t @ 5 NONAME
|
||||
tsk_calloc @ 6 NONAME
|
||||
tsk_condwait_broadcast @ 7 NONAME
|
||||
tsk_condwait_create @ 8 NONAME
|
||||
tsk_condwait_destroy @ 9 NONAME
|
||||
tsk_condwait_signal @ 10 NONAME
|
||||
tsk_condwait_timedwait @ 11 NONAME
|
||||
tsk_condwait_wait @ 12 NONAME
|
||||
tsk_free @ 13 NONAME
|
||||
tsk_gettimeofday @ 14 NONAME
|
||||
tsk_itoa @ 15 NONAME
|
||||
tsk_list_clear_items @ 16 NONAME
|
||||
tsk_list_def_t @ 17 NONAME
|
||||
tsk_list_find_item_by_data @ 18 NONAME
|
||||
tsk_list_find_item_by_pred @ 19 NONAME
|
||||
tsk_list_item_def_t @ 20 NONAME
|
||||
tsk_list_pop_first_item @ 21 NONAME
|
||||
tsk_list_push_data @ 22 NONAME
|
||||
tsk_list_push_filtered_data @ 23 NONAME
|
||||
tsk_list_push_filtered_item @ 24 NONAME
|
||||
tsk_list_push_item @ 25 NONAME
|
||||
tsk_list_push_list @ 26 NONAME
|
||||
tsk_list_remove_item @ 27 NONAME
|
||||
tsk_list_remove_item_by_data @ 28 NONAME
|
||||
tsk_list_remove_item_by_pred @ 29 NONAME
|
||||
tsk_malloc @ 30 NONAME
|
||||
tsk_mutex_create @ 31 NONAME
|
||||
tsk_mutex_destroy @ 32 NONAME
|
||||
tsk_mutex_lock @ 33 NONAME
|
||||
tsk_mutex_unlock @ 34 NONAME
|
||||
tsk_object_cmp @ 35 NONAME
|
||||
tsk_object_delete @ 36 NONAME
|
||||
tsk_object_new @ 37 NONAME
|
||||
tsk_object_ref @ 38 NONAME
|
||||
tsk_object_sizeof @ 39 NONAME
|
||||
tsk_object_unref @ 40 NONAME
|
||||
tsk_param_def_t @ 41 NONAME
|
||||
tsk_params_add_param @ 42 NONAME
|
||||
tsk_params_get_param_by_name @ 43 NONAME
|
||||
tsk_params_get_param_value @ 44 NONAME
|
||||
tsk_params_get_param_value_as_int @ 45 NONAME
|
||||
tsk_params_has_param @ 46 NONAME
|
||||
tsk_params_param_tostring @ 47 NONAME
|
||||
tsk_params_parse_param @ 48 NONAME
|
||||
tsk_params_remove_param @ 49 NONAME
|
||||
tsk_params_tostring @ 50 NONAME
|
||||
tsk_pppfcs16 @ 51 NONAME
|
||||
tsk_realloc @ 52 NONAME
|
||||
tsk_runnable_start @ 53 NONAME
|
||||
tsk_runnable_stop @ 54 NONAME
|
||||
tsk_semaphore_create @ 55 NONAME
|
||||
tsk_semaphore_decrement @ 56 NONAME
|
||||
tsk_semaphore_destroy @ 57 NONAME
|
||||
tsk_semaphore_increment @ 58 NONAME
|
||||
tsk_sha1final @ 59 NONAME
|
||||
tsk_sha1input @ 60 NONAME
|
||||
tsk_sha1reset @ 61 NONAME
|
||||
tsk_sha1result @ 62 NONAME
|
||||
tsk_sprintf @ 63 NONAME
|
||||
tsk_strcat @ 64 NONAME
|
||||
tsk_strcmp @ 65 NONAME
|
||||
tsk_strdup @ 66 NONAME
|
||||
tsk_stricmp @ 67 NONAME
|
||||
tsk_string_def_t @ 68 NONAME
|
||||
tsk_strquote @ 69 NONAME
|
||||
tsk_strrandom @ 70 NONAME
|
||||
tsk_strtrim_left @ 71 NONAME
|
||||
tsk_strtrim_right @ 72 NONAME
|
||||
tsk_strunquote @ 73 NONAME
|
||||
tsk_strupdate @ 74 NONAME
|
||||
tsk_thread_create @ 75 NONAME
|
||||
tsk_thread_join @ 76 NONAME
|
||||
tsk_thread_sleep @ 77 NONAME
|
||||
tsk_time_epoch @ 78 NONAME
|
||||
tsk_timer_def_t @ 79 NONAME
|
||||
tsk_timer_manager_cancel @ 80 NONAME
|
||||
tsk_timer_manager_debug @ 81 NONAME
|
||||
tsk_timer_manager_def_t @ 82 NONAME
|
||||
tsk_timer_manager_isready @ 83 NONAME
|
||||
tsk_timer_manager_schedule @ 84 NONAME
|
||||
tsk_timer_manager_start @ 85 NONAME
|
||||
tsk_timer_manager_stop @ 86 NONAME
|
||||
tsk_url_decode @ 87 NONAME
|
||||
tsk_url_encode @ 88 NONAME
|
||||
tsk_object_new2 @ 89 NONAME
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
@ECHO OFF
|
||||
|
||||
REM Bldmake-generated batch file - ABLD.BAT
|
||||
REM ** DO NOT EDIT **
|
||||
|
||||
perl -S ABLD.PL "\Projects\Doubango\tinySAK\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
if errorlevel==1 goto CheckPerl
|
||||
goto End
|
||||
|
||||
:CheckPerl
|
||||
perl -v >NUL
|
||||
if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?
|
||||
goto End
|
||||
|
||||
:End
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
============================================================================
|
||||
Name : bld.inf
|
||||
Author : Mamadou Diop
|
||||
Copyright : * 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.
|
||||
Description : This file provides the information required for building the
|
||||
whole of a tinySAK.
|
||||
============================================================================
|
||||
*/
|
||||
|
||||
PRJ_PLATFORMS
|
||||
DEFAULT
|
||||
|
||||
PRJ_EXPORTS
|
||||
|
||||
PRJ_MMPFILES
|
||||
tinySAK.mmp
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
============================================================================
|
||||
Name : tinySAK.mmp
|
||||
Author : Mamadou Diop
|
||||
Copyright : * 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.
|
||||
Description : This is the project specification file for tinySAK.
|
||||
============================================================================
|
||||
*/
|
||||
|
||||
TARGET tinySAK.dll
|
||||
TARGETTYPE dll
|
||||
UID 0x1000008d 0xE33E7DBF
|
||||
|
||||
SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis \epoc32\include\stdapis\sys
|
||||
|
||||
|
||||
|
||||
// In order to use .def files to freeze code you must use one or more DEFFILE lines;
|
||||
// see the ones commented out below for examples.
|
||||
// By default, the build tools look for the WINSCW def file in a BWINS directory
|
||||
// (at the same level as the directory containing the mmp file),
|
||||
// the GCC ARM def file in a BMARM directory, and the ARMV5 def file in a EABI directory.
|
||||
// If your .def files are stored in these default locations, you can simply specify the
|
||||
// .def filename(s) with no path. If you want to store .def files in non-default
|
||||
// locations, you will need to specify the paths in the DEFFILE statement(s).
|
||||
|
||||
//The following commented out code shows how the build system uses the implicit
|
||||
// location for defiles. To create the DEF files Choose Project > Freeze Exports from Carbide
|
||||
// or run 'abld freeze' from the command-line
|
||||
//#if defined (WINS)
|
||||
// DEFFILE ..\bwins\tinySAK.def
|
||||
//#elif defined (GCC32)
|
||||
// DEFFILE ..\bmarm\tinySAK.def
|
||||
//#else
|
||||
// DEFFILE ..\eabi\tinySAK.def
|
||||
//#endif
|
||||
|
||||
nostrictdef
|
||||
|
||||
LIBRARY euser.lib libc.lib libpthread.lib
|
||||
|
||||
#ifdef ENABLE_ABIV2_MODE
|
||||
DEBUGGABLE_UDEBONLY
|
||||
#endif
|
||||
|
||||
MACRO TINYSAK_EXPORTS
|
||||
|
||||
EPOCALLOWDLLDATA
|
||||
|
||||
SOURCEPATH ..\src
|
||||
SOURCE tsk.c tsk_binaryutils.c tsk_buffer.c tsk_condwait.c tsk_debug.c tsk_heap.c tsk_list.c tsk_memory.c tsk_mutex.c tsk_object.c tsk_params.c tsk_ppfcs16.c tsk_runnable.c tsk_safeobj.c tsk_semaphore.c tsk_sha1.c tsk_string.c tsk_thread.c tsk_time.c tsk_timer.c tsk_url.c tsk_xml.c
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -0,0 +1,21 @@
|
|||
; Installation file for tinySAK dll
|
||||
;
|
||||
; This is an auto-generated PKG file by Carbide.
|
||||
; This file uses variables specific to Carbide builds that will not work
|
||||
; on command-line builds. If you want to use this generated PKG file from the
|
||||
; command-line tools you will need to modify the variables with the appropriate
|
||||
; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
|
||||
|
||||
;
|
||||
; UID is the dll's UID
|
||||
;
|
||||
#{"tinySAK DLL"},(0xE33E7DBF),1,0,0
|
||||
|
||||
|
||||
;Localised Vendor name
|
||||
%{"Vendor-EN"}
|
||||
|
||||
;Unique Vendor name
|
||||
:"Vendor"
|
||||
|
||||
"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\tinySAK.dll" -"!:\sys\bin\tinySAK.dll"
|
|
@ -75,6 +75,15 @@
|
|||
# define HAVE_GETTIMEOFDAY 1
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef TSK_MIN
|
||||
#define TSK_MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif /* TSK_MIN */
|
||||
|
||||
#ifndef TSK_MAX
|
||||
#define TSK_MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif /* TSK_MAX */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
|
|
@ -38,9 +38,12 @@
|
|||
|
||||
int tsk_buffer_appendEx(tsk_buffer_t* self, const char* format, ...)
|
||||
{
|
||||
/*
|
||||
* I suppose that sizeof(char) = 1-byte
|
||||
*/
|
||||
int len = 0;
|
||||
va_list list;
|
||||
uint8_t *buffer;
|
||||
char *buffer;
|
||||
size_t oldsize;
|
||||
|
||||
if(!self)
|
||||
|
@ -49,7 +52,7 @@ int tsk_buffer_appendEx(tsk_buffer_t* self, const char* format, ...)
|
|||
}
|
||||
|
||||
oldsize = self->size;
|
||||
buffer = (uint8_t*)TSK_BUFFER_DATA(self);
|
||||
buffer = (char*)TSK_BUFFER_DATA(self);
|
||||
|
||||
/* initialize variable arguments */
|
||||
va_start(list, format);
|
||||
|
@ -168,4 +171,4 @@ static const tsk_object_def_t tsk_buffer_def_s =
|
|||
tsk_buffer_destroy,
|
||||
tsk_buffer_cmp,
|
||||
};
|
||||
const void *tsk_buffer_def_t = &tsk_buffer_def_s;
|
||||
const void *tsk_buffer_def_t = &tsk_buffer_def_s;
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#define TSK_BUFFER_CREATE(data, size) tsk_object_new(tsk_buffer_def_t, (const void*)data, (size_t)size)
|
||||
#define TSK_BUFFER_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
#define TSK_BUFFER_CREATE_NULL() TSK_BUFFER_CREATE(0,0)
|
||||
|
||||
#define TSK_BUFFER(self) ((tsk_buffer_t*)self)
|
||||
#define TSK_BUFFER_DATA(self) (self ? TSK_BUFFER(self)->data : 0)
|
||||
#define TSK_BUFFER_SIZE(self) (self ? TSK_BUFFER(self)->size : 0)
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include "tsk_memory.h"
|
||||
#include "tsk_macros.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
/**@defgroup tsk_list_group Linked list
|
||||
|
@ -221,11 +223,29 @@ void tsk_list_remove_item_by_data(tsk_list_t* list, const void * tskobj)
|
|||
if(!tsk_object_cmp(curr->data, tskobj))
|
||||
{
|
||||
if(prev == curr)
|
||||
{
|
||||
/* Found at first position. */
|
||||
list->head = curr->next;
|
||||
{ /* Found at first position. */
|
||||
|
||||
if(list->head == list->tail)
|
||||
{ /* There was only one item */
|
||||
|
||||
list->head = list->tail = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
list->head = curr->next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(curr == list->tail)
|
||||
{ /* Found at last position */
|
||||
list->tail = prev;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev->next = curr->next;
|
||||
}
|
||||
}
|
||||
else prev->next = curr->next;
|
||||
|
||||
/*curr =*/ tsk_object_unref(curr);
|
||||
break;
|
||||
|
@ -255,11 +275,28 @@ void tsk_list_remove_item_by_pred(tsk_list_t* list, tsk_list_func_predicate pred
|
|||
if(!predicate(curr, data))
|
||||
{
|
||||
if(prev == curr)
|
||||
{
|
||||
/* Found at first position. */
|
||||
list->head = curr->next;
|
||||
{ /* Found at first position. */
|
||||
|
||||
if(list->head == list->tail)
|
||||
{ /* There was only one item */
|
||||
list->head = list->tail = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
list->head = curr->next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(curr == list->tail)
|
||||
{ /* Found at last position */
|
||||
list->tail = prev;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev->next = curr->next;
|
||||
}
|
||||
}
|
||||
else prev->next = curr->next;
|
||||
|
||||
/*curr =*/ tsk_object_unref(curr);
|
||||
break;
|
||||
|
@ -318,7 +355,9 @@ tsk_list_item_t* tsk_list_pop_first_item(tsk_list_t* list)
|
|||
{
|
||||
list->head = list->tail = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert((list && list->tail) ? !list->tail->next : 1);
|
||||
}
|
||||
|
||||
return item;
|
||||
|
@ -343,6 +382,8 @@ void tsk_list_push_item(tsk_list_t* list, tsk_list_item_t** item, int back)
|
|||
list->tail = list->head = *item;
|
||||
}
|
||||
(*item) = 0;
|
||||
|
||||
assert((list && list->tail) ? !list->tail->next : 1);
|
||||
}
|
||||
|
||||
/**@ingroup tsk_list_group
|
||||
|
@ -381,6 +422,8 @@ void tsk_list_push_filtered_item(tsk_list_t* list, tsk_list_item_t** item, int a
|
|||
}
|
||||
|
||||
tsk_list_push_back_item(list, item);
|
||||
|
||||
assert((list && list->tail) ? !list->tail->next : 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -439,6 +482,8 @@ void tsk_list_push_filtered_data(tsk_list_t* list, void** data, int ascending)
|
|||
|
||||
tsk_list_push_filtered_item(list, &item, ascending);
|
||||
(*data) = 0;
|
||||
|
||||
assert((list && list->tail) ? !list->tail->next : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
*/
|
||||
//typedef void (*tsk_list_item_func_free)(void** item);
|
||||
|
||||
#define TSK_LIST_IS_EMPTY(self) (self ? (!self->head) : 0)
|
||||
#define TSK_LIST_IS_EMPTY(self) (self ? (!self->head) : 1)
|
||||
|
||||
/** Item
|
||||
*/
|
||||
|
|
|
@ -66,6 +66,30 @@ void* tsk_object_new(const tsk_object_def_t *objdef, ...)
|
|||
return newobj;
|
||||
}
|
||||
|
||||
void* tsk_object_new2(const tsk_object_def_t *objdef, va_list* ap)
|
||||
{
|
||||
void *newobj = tsk_calloc(1, objdef->size);
|
||||
if(newobj)
|
||||
{
|
||||
(*(const tsk_object_def_t **) newobj) = objdef;
|
||||
TSK_OBJECT_HEADER_GET(newobj)->refCount = 1;
|
||||
if(objdef->constructor)
|
||||
{
|
||||
newobj = objdef->constructor(newobj, ap);
|
||||
}
|
||||
else
|
||||
{
|
||||
TSK_DEBUG_WARN("No constructor found.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create new tsk_object.");
|
||||
}
|
||||
|
||||
return newobj;
|
||||
}
|
||||
|
||||
size_t tsk_object_sizeof(const void *self)
|
||||
{
|
||||
const tsk_object_def_t **objdef = self;
|
||||
|
|
|
@ -66,6 +66,7 @@ typedef struct tsk_object_def_s
|
|||
tsk_object_def_t;
|
||||
|
||||
TINYSAK_API void* tsk_object_new(const tsk_object_def_t *objdef, ...);
|
||||
TINYSAK_API void* tsk_object_new2(const tsk_object_def_t *objdef, va_list* ap);
|
||||
TINYSAK_API size_t tsk_object_sizeof(const void *self);
|
||||
TINYSAK_API int tsk_object_cmp(const void *self, const void *object);
|
||||
//TINYSAK_API int tsk_object_icmp(const void *self, const void *object);
|
||||
|
|
|
@ -81,6 +81,34 @@ int tsk_params_has_param(const tsk_params_L_t *self, const char* name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int tsk_params_add_param(tsk_params_L_t **self, const char* name, const char* value)
|
||||
{
|
||||
tsk_param_t *param;
|
||||
|
||||
if(!name) return -1;
|
||||
|
||||
if(!*self)
|
||||
{
|
||||
*self = TSK_LIST_CREATE();
|
||||
}
|
||||
|
||||
param = TSK_PARAM_CREATE(name, value);
|
||||
tsk_list_push_back_data(*self, (void**)¶m);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int tsk_params_remove_param(tsk_params_L_t *self, const char* name)
|
||||
{
|
||||
if(self)
|
||||
{
|
||||
tsk_list_remove_item_by_pred(self, pred_find_param_by_name, name);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
const tsk_param_t *tsk_params_get_param_by_name(const tsk_params_L_t *self, const char* name)
|
||||
{
|
||||
if(self)
|
||||
|
|
|
@ -52,6 +52,8 @@ typedef tsk_list_t tsk_params_L_t; /**< List of @ref tsk_param_t elements. */
|
|||
TINYSAK_API tsk_param_t *tsk_params_parse_param(const char* line, size_t size);
|
||||
|
||||
TINYSAK_API int tsk_params_has_param(const tsk_params_L_t *self, const char* name);
|
||||
TINYSAK_API int tsk_params_add_param(tsk_params_L_t **self, const char* name, const char* value);
|
||||
TINYSAK_API int tsk_params_remove_param(tsk_params_L_t *self, const char* name);
|
||||
TINYSAK_API const tsk_param_t *tsk_params_get_param_by_name(const tsk_params_L_t *self, const char* name);
|
||||
TINYSAK_API const char *tsk_params_get_param_value(const tsk_params_L_t *self, const char* name);
|
||||
TINYSAK_API int tsk_params_get_param_value_as_int(const tsk_params_L_t *self, const char* name);
|
||||
|
|
|
@ -67,7 +67,7 @@ typedef void * (*tsk_runnable_func_run)(void* self);
|
|||
{ \
|
||||
if(TSK_RUNNABLE(self) && TSK_RUNNABLE(self)->initialized) \
|
||||
{ \
|
||||
tsk_list_push_back_data(TSK_RUNNABLE(self)->objects, &object); \
|
||||
tsk_list_push_back_data(TSK_RUNNABLE(self)->objects, (void**)&object); \
|
||||
tsk_semaphore_increment(TSK_RUNNABLE(self)->semaphore); \
|
||||
} \
|
||||
else \
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
*/
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_time.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
|
@ -104,13 +105,11 @@ int tsk_strcmp(const char * str1, const char * str2)
|
|||
* @retval The duplicated string. */
|
||||
char* tsk_strdup(const char *s1)
|
||||
{
|
||||
char* ret = 0;
|
||||
if(s1)
|
||||
{
|
||||
ret = strdup(s1);
|
||||
return strdup(s1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**@ingroup tsk_string_group
|
||||
|
@ -279,6 +278,12 @@ void tsk_itoa(int64_t i, tsk_istr_t *result)
|
|||
}
|
||||
|
||||
|
||||
void tsk_strrandom(tsk_istr_t *result)
|
||||
{
|
||||
uint64_t epoch = tsk_time_epoch();
|
||||
tsk_itoa(epoch, result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define TSK_STRING_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
#define TSK_STRING_STR(self) ((tsk_string_t*)self)->value
|
||||
|
||||
typedef char tsk_istr_t[20]; /**< Integer number as string value. */
|
||||
typedef char tsk_istr_t[21]; /**< Integer number as string value. */
|
||||
|
||||
TINYSAK_API char tsk_b10tob16(char c);
|
||||
TINYSAK_API char tsk_b16tob10(char c);
|
||||
|
@ -55,7 +55,7 @@ TINYSAK_API void tsk_strtrim_right(char **str);
|
|||
TINYSAK_API void tsk_strquote(char **str);
|
||||
TINYSAK_API void tsk_strunquote(char **str);
|
||||
TINYSAK_API void tsk_itoa(int64_t i, tsk_istr_t *result);
|
||||
|
||||
TINYSAK_API void tsk_strrandom(tsk_istr_t *result);
|
||||
|
||||
#define tsk_strtrim_both(str) tsk_strtrim_left(str), tsk_strtrim_right(str);
|
||||
#define tsk_strempty(s) (*s == '\0')
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
#include "tsk_time.h"
|
||||
|
||||
#if TSK_UNDER_WINDOWS
|
||||
# ifdef _WIN32_WCE
|
||||
# include <Winsock2.h> // timeval
|
||||
# endif
|
||||
# include <windows.h>
|
||||
#elif defined(__SYMBIAN32__)
|
||||
# include <_timeval.h>
|
||||
|
|
|
@ -37,6 +37,8 @@ struct timeval;
|
|||
struct timezone;
|
||||
#endif
|
||||
|
||||
#define TSK_TIME_S_2_MS(S) (S*1000)
|
||||
|
||||
TINYSAK_API int tsk_gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
TINYSAK_API uint64_t tsk_time_epoch();
|
||||
|
||||
|
@ -45,18 +47,18 @@ TINYSAK_API uint64_t tsk_time_epoch();
|
|||
*/
|
||||
#define tsk_time_now() tsk_time_epoch()
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
#ifndef TIMEVAL
|
||||
/* On wince timeval struct is defined in "Winsock2.h" but I don't want to add it */
|
||||
struct timeval
|
||||
{
|
||||
long tv_sec;
|
||||
long tv_usec;
|
||||
};
|
||||
#define TIMEVAL
|
||||
#endif TIMEVAL
|
||||
|
||||
#endif
|
||||
//#ifdef _WIN32_WCE
|
||||
//
|
||||
//#ifndef TIMEVAL
|
||||
///* On wince timeval struct is defined in "Winsock2.h" but I don't want to add it */
|
||||
//struct timeval
|
||||
//{
|
||||
// long tv_sec;
|
||||
// long tv_usec;
|
||||
//};
|
||||
//#define TIMEVAL
|
||||
//#endif TIMEVAL
|
||||
//
|
||||
//#endif
|
||||
|
||||
#endif /* _TINYSAK_TIME_H_ */
|
||||
|
|
|
@ -61,6 +61,8 @@ typedef struct tsk_timer_s
|
|||
const void *arg; /**< Opaque data to return with the callback function. */
|
||||
uint64_t timeout; /**< When the timer will timeout(as EPOCH time). */
|
||||
tsk_timer_callback callback; /**< The callback function to call after @ref timeout milliseconds. */
|
||||
|
||||
unsigned canceled:1;
|
||||
}
|
||||
tsk_timer_t;
|
||||
typedef tsk_list_t tsk_timers_L_t; /**< List of @ref tsk_timer_t elements. */
|
||||
|
@ -76,7 +78,7 @@ typedef tsk_list_t tsk_timers_L_t; /**< List of @ref tsk_timer_t elements. */
|
|||
typedef struct tsk_timer_manager_s
|
||||
{
|
||||
TSK_DECLARE_RUNNABLE;
|
||||
|
||||
|
||||
unsigned active:1;
|
||||
void* mainThreadId[1];
|
||||
tsk_condwait_handle_t *condwait;
|
||||
|
@ -175,7 +177,7 @@ int tsk_timer_manager_stop(tsk_timer_manager_handle_t *self)
|
|||
|
||||
tsk_timer_id_t tsk_timer_manager_schedule(tsk_timer_manager_handle_t *self, uint64_t timeout, tsk_timer_callback callback, const void *arg)
|
||||
{
|
||||
tsk_timer_id_t timer_id = INVALID_TIMER_ID;
|
||||
tsk_timer_id_t timer_id = TSK_INVALID_TIMER_ID;
|
||||
tsk_timer_manager_t *manager = self;
|
||||
|
||||
if(manager && manager->running)
|
||||
|
@ -188,8 +190,8 @@ tsk_timer_id_t tsk_timer_manager_schedule(tsk_timer_manager_handle_t *self, uint
|
|||
tsk_list_push_ascending_data(manager->timers, ((void**) &timer));
|
||||
tsk_mutex_unlock(manager->mutex);
|
||||
|
||||
tsk_semaphore_increment(manager->sem);
|
||||
tsk_condwait_signal(manager->condwait);
|
||||
tsk_semaphore_increment(manager->sem);
|
||||
}
|
||||
|
||||
return timer_id;
|
||||
|
@ -199,7 +201,7 @@ int tsk_timer_manager_cancel(tsk_timer_manager_handle_t *self, tsk_timer_id_t id
|
|||
{
|
||||
int ret = -1;
|
||||
tsk_timer_manager_t *manager = self;
|
||||
if(manager->timers && manager->running)
|
||||
if(!TSK_LIST_IS_EMPTY(manager->timers) && manager->running)
|
||||
{
|
||||
const tsk_list_item_t *item;
|
||||
tsk_mutex_lock(manager->mutex);
|
||||
|
@ -207,8 +209,13 @@ int tsk_timer_manager_cancel(tsk_timer_manager_handle_t *self, tsk_timer_id_t id
|
|||
if(item && item->data)
|
||||
{
|
||||
tsk_timer_t *timer = item->data;
|
||||
//timer->callback(timer->arg, id);
|
||||
tsk_list_remove_item(manager->timers, (tsk_list_item_t*)item);
|
||||
timer->canceled = 1;
|
||||
|
||||
if(item == manager->timers->head)
|
||||
{ /* The timer we are waiting on ? ==> remove it now. */
|
||||
tsk_condwait_signal(manager->condwait);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
}
|
||||
tsk_mutex_unlock(manager->mutex);
|
||||
|
@ -240,9 +247,10 @@ static void *run(void* self)
|
|||
|
||||
static int __tsk_pred_find_timer_by_id(const tsk_list_item_t *item, const void *id)
|
||||
{
|
||||
tsk_timer_t *timer;
|
||||
if(item && item->data)
|
||||
{
|
||||
tsk_timer_t *timer = item->data;
|
||||
timer = item->data;
|
||||
return (int)(timer->id - *((tsk_timer_id_t*)id));
|
||||
}
|
||||
return -1;
|
||||
|
@ -271,7 +279,7 @@ peek_first:
|
|||
curr = TSK_TIMER_GET_FIRST();
|
||||
tsk_mutex_unlock(manager->mutex);
|
||||
|
||||
if(curr)
|
||||
if(curr && !curr->canceled)
|
||||
{
|
||||
epoch = tsk_time_epoch();
|
||||
if(epoch >= curr->timeout)
|
||||
|
@ -295,6 +303,12 @@ peek_first:
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(curr && curr->canceled)
|
||||
{
|
||||
tsk_mutex_lock(manager->mutex);
|
||||
tsk_list_remove_item_by_data(manager->timers, curr);
|
||||
tsk_mutex_unlock(manager->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
manager->active = 0;
|
||||
|
@ -391,7 +405,6 @@ static void* tsk_timer_destroy(void * self)
|
|||
|
||||
if(timer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
|
@ -34,9 +34,10 @@
|
|||
|
||||
#define TSK_TIMER_MANAGER_CREATE() tsk_object_new(tsk_timer_manager_def_t)
|
||||
#define TSK_TIMER_MANAGER_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
#define TSK_TIMER_CALLBACK(callback) ((tsk_timer_callback)callback)
|
||||
|
||||
#define INVALID_TIMER_ID 0
|
||||
#define TSK_TIMER_ID_IS_VALID(id) (id != INVALID_TIMER_ID)
|
||||
#define TSK_INVALID_TIMER_ID 0
|
||||
#define TSK_TIMER_ID_IS_VALID(id) (id != TSK_INVALID_TIMER_ID)
|
||||
|
||||
|
||||
typedef void tsk_timer_manager_handle_t;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#define LOOP 1
|
||||
|
||||
#define RUN_TEST_ALL 0
|
||||
#define RUN_TEST_LISTS 0
|
||||
#define RUN_TEST_LISTS 1
|
||||
#define RUN_TEST_HEAP 0
|
||||
#define RUN_TEST_STRINGS 0
|
||||
#define RUN_TEST_URL 0
|
||||
|
@ -43,7 +43,7 @@
|
|||
#define RUN_TEST_SEMAPHORE 0
|
||||
#define RUN_TEST_SAFEOBJECT 0
|
||||
#define RUN_TEST_OBJECT 0
|
||||
#define RUN_TEST_PARAMS 1
|
||||
#define RUN_TEST_PARAMS 0
|
||||
#define RUN_TEST_TIMER 0
|
||||
#define RUN_TEST_RUNNABLE 0
|
||||
#define RUN_TEST_BUFFER 0
|
||||
|
@ -119,9 +119,9 @@ int main()
|
|||
|
||||
#if RUN_TEST_LISTS || RUN_TEST_ALL
|
||||
/* linked lists */
|
||||
//test_basic_list();
|
||||
test_basic_list();
|
||||
printf("\n\n");
|
||||
//test_complex_list();
|
||||
test_complex_list();
|
||||
printf("\n\n");
|
||||
test_filtered_list();
|
||||
printf("\n\n");
|
||||
|
|
|
@ -111,7 +111,12 @@ void test_basic_list()
|
|||
{
|
||||
tsk_string_t* item_data = ((tsk_string_t*)item->data);
|
||||
printf("test_basic_list/// --> [%s]\n", item_data->value);
|
||||
}
|
||||
}
|
||||
|
||||
tsk_list_remove_item(list, list->tail);
|
||||
tsk_list_remove_item(list, list->tail);
|
||||
tsk_list_remove_item(list, list->tail);
|
||||
tsk_list_remove_item(list, list->tail);
|
||||
|
||||
/* delete all items in the list */
|
||||
TSK_LIST_SAFE_FREE(list);
|
||||
|
|
|
@ -26,7 +26,7 @@ int so_mutex_count = 0;
|
|||
|
||||
typedef struct mysafeobj_s
|
||||
{
|
||||
TSK_SAFEOBJ_DECLARE;
|
||||
TSK_DECLARE_SAFEOBJ;
|
||||
|
||||
int test1;
|
||||
int test2;
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject>
|
||||
<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="0" concurrentBuildJobs="4" defaultMMPChangedAction="0" infBuildComponents="" infFileLocation="group/bld.inf" macrosFile="" makeEngineToUse="make" manageDependencies="true" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideMakeEngine="false" overrideWorkspaceSettings="false" promptForMMPChangedAction="false" useConcurrentBuilding="true" useDebugMode="false" useIncrementalBuilder="false" useKeepGoing="false" useMMPMacros="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySIGCOMP\group\bld.inf;C:\Projects\Doubango\tinySIGCOMP\group\tinySIGCOMP.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="TINYSIGCOMP_EXPORTS;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__CW32__;__S60_50__;__WINSCW__;_UNICODE;__S60_3X__;__S60_5X__;_DEBUG;__SERIES60_3X__;__DLL__;__WINS__;" moduleId="configDataCache" sourcesCache="/tinySAK/src;/tinySIGCOMP/src;src;" timestampCache="1261708708059" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySIGCOMP\group\bld.inf;C:\Projects\Doubango\tinySIGCOMP\group\tinySIGCOMP.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;TINYSIGCOMP_EXPORTS;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__ARMCC_2__;__ARMCC__;__MARM__;__S60_50__;__S60_3X__;__ARMCC_2_2__;_UNICODE;__S60_5X__;_DEBUG;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinySAK/src;/tinySIGCOMP/src;src;" timestampCache="1261708708075" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySIGCOMP\group\bld.inf;C:\Projects\Doubango\tinySIGCOMP\group\tinySIGCOMP.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;TINYSIGCOMP_EXPORTS;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__ARMCC_2__;NDEBUG;__ARMCC__;__MARM__;__S60_50__;__S60_3X__;__ARMCC_2_2__;_UNICODE;__S60_5X__;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinySAK/src;/tinySIGCOMP/src;src;" timestampCache="1261708708075" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCEErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySIGCOMP\group\bld.inf;C:\Projects\Doubango\tinySIGCOMP\group\tinySIGCOMP.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;TINYSIGCOMP_EXPORTS;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__GCCE__;__MARM__;__S60_50__;_UNICODE;__S60_3X__;__S60_5X__;_DEBUG;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinySAK/src;/tinySIGCOMP/src;src;" timestampCache="1261708708091" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCEErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySIGCOMP\group\bld.inf;C:\Projects\Doubango\tinySIGCOMP\group\tinySIGCOMP.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;TINYSIGCOMP_EXPORTS;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__GCCE__;NDEBUG;__MARM__;__S60_50__;_UNICODE;__S60_3X__;__S60_5X__;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinySAK/src;/tinySIGCOMP/src;src;" timestampCache="1261708708106" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
</cproject>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>tinySIGCOMP</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,34 @@
|
|||
EXPORTS
|
||||
tcomp_buffer_def_t @ 1 NONAME
|
||||
tcomp_buffer_getBufferAtPos @ 2 NONAME
|
||||
tcomp_buffer_getSize @ 3 NONAME
|
||||
tcomp_compartment_def_t @ 4 NONAME
|
||||
tcomp_compressordisp_def_t @ 5 NONAME
|
||||
tcomp_decompressordisp_def_t @ 6 NONAME
|
||||
tcomp_deflatedata_def_t @ 7 NONAME
|
||||
tcomp_manager_addCompressor @ 8 NONAME
|
||||
tcomp_manager_addPresenceDictionary @ 9 NONAME
|
||||
tcomp_manager_addSipSdpDictionary @ 10 NONAME
|
||||
tcomp_manager_closeCompartment @ 11 NONAME
|
||||
tcomp_manager_compress @ 12 NONAME
|
||||
tcomp_manager_decompress @ 13 NONAME
|
||||
tcomp_manager_def_t @ 14 NONAME
|
||||
tcomp_manager_getNextStreamMessage @ 15 NONAME
|
||||
tcomp_manager_provideCompartmentId @ 16 NONAME
|
||||
tcomp_manager_setCycles_Per_Bit @ 17 NONAME
|
||||
tcomp_manager_setDecompression_Memory_Size @ 18 NONAME
|
||||
tcomp_manager_setSigComp_Version @ 19 NONAME
|
||||
tcomp_manager_setState_Memory_Size @ 20 NONAME
|
||||
tcomp_message_def_t @ 21 NONAME
|
||||
tcomp_nackinfo_def_t @ 22 NONAME
|
||||
tcomp_params_def_t @ 23 NONAME
|
||||
tcomp_reqfeed_def_t @ 24 NONAME
|
||||
tcomp_result_def_t @ 25 NONAME
|
||||
tcomp_result_setCompartmentId @ 26 NONAME
|
||||
tcomp_result_setOutputBuffer @ 27 NONAME
|
||||
tcomp_state_def_t @ 28 NONAME
|
||||
tcomp_statehandler_def_t @ 29 NONAME
|
||||
tcomp_stream_buffer_def_t @ 30 NONAME
|
||||
tcomp_tempstate_to_free_def_t @ 31 NONAME
|
||||
tcomp_udvm_def_t @ 32 NONAME
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
@ECHO OFF
|
||||
|
||||
REM Bldmake-generated batch file - ABLD.BAT
|
||||
REM ** DO NOT EDIT **
|
||||
|
||||
perl -S ABLD.PL "\Projects\Doubango\tinySIGCOMP\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
if errorlevel==1 goto CheckPerl
|
||||
goto End
|
||||
|
||||
:CheckPerl
|
||||
perl -v >NUL
|
||||
if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?
|
||||
goto End
|
||||
|
||||
:End
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
============================================================================
|
||||
Name : bld.inf
|
||||
Author : Mamadou Diop
|
||||
Copyright : * 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.
|
||||
Description : This file provides the information required for building the
|
||||
whole of a tinySIGCOMP.
|
||||
============================================================================
|
||||
*/
|
||||
|
||||
PRJ_PLATFORMS
|
||||
DEFAULT
|
||||
|
||||
PRJ_EXPORTS
|
||||
|
||||
PRJ_MMPFILES
|
||||
tinySIGCOMP.mmp
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
============================================================================
|
||||
Name : tinySIGCOMP.mmp
|
||||
Author : Mamadou Diop
|
||||
Copyright : * 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.
|
||||
Description : This is the project specification file for tinySIGCOMP.
|
||||
============================================================================
|
||||
*/
|
||||
|
||||
TARGET tinySIGCOMP.dll
|
||||
TARGETTYPE dll
|
||||
UID 0x1000008d 0xED682012
|
||||
|
||||
USERINCLUDE ..\..\tinySAK\src
|
||||
|
||||
SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis \epoc32\include\stdapis\sys
|
||||
|
||||
|
||||
|
||||
// In order to use .def files to freeze code you must use one or more DEFFILE lines;
|
||||
// see the ones commented out below for examples.
|
||||
// By default, the build tools look for the WINSCW def file in a BWINS directory
|
||||
// (at the same level as the directory containing the mmp file),
|
||||
// the GCC ARM def file in a BMARM directory, and the ARMV5 def file in a EABI directory.
|
||||
// If your .def files are stored in these default locations, you can simply specify the
|
||||
// .def filename(s) with no path. If you want to store .def files in non-default
|
||||
// locations, you will need to specify the paths in the DEFFILE statement(s).
|
||||
|
||||
//The following commented out code shows how the build system uses the implicit
|
||||
// location for defiles. To create the DEF files Choose Project > Freeze Exports from Carbide
|
||||
// or run 'abld freeze' from the command-line
|
||||
//#if defined (WINS)
|
||||
// DEFFILE ..\bwins\tinySIGCOMP.def
|
||||
//#elif defined (GCC32)
|
||||
// DEFFILE ..\bmarm\tinySIGCOMP.def
|
||||
//#else
|
||||
// DEFFILE ..\eabi\tinySIGCOMP.def
|
||||
//#endif
|
||||
|
||||
nostrictdef
|
||||
|
||||
LIBRARY euser.lib libc.lib tinySAK.lib
|
||||
|
||||
#ifdef ENABLE_ABIV2_MODE
|
||||
DEBUGGABLE_UDEBONLY
|
||||
#endif
|
||||
|
||||
MACRO TINYSIGCOMP_EXPORTS
|
||||
|
||||
EPOCALLOWDLLDATA
|
||||
|
||||
SOURCEPATH ..\src
|
||||
SOURCE adler32.c compress.c deflate.c tcomp.c tcomp_buffer.c tcomp_compartment.c tcomp_compressor_deflate.c tcomp_compressor_dummy.c tcomp_compressordata.c tcomp_compressordisp.c tcomp_decompressordisp.c tcomp_deflatedata.c tcomp_deflatedata.ghost.c tcomp_deflatedata.zlib.c tcomp_dicts.c tcomp_manager.c tcomp_message.c tcomp_nackinfo.c tcomp_params.c tcomp_reqfeed.c tcomp_result.c tcomp_state.c tcomp_statehandler.c tcomp_udvm.bytecopy.c tcomp_udvm.c tcomp_udvm.instructions.c tcomp_udvm.nack.c tcomp_udvm.operands.c tcomp_udvm.statemanagment.c trees.c zutil.c
|
||||
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -0,0 +1,21 @@
|
|||
; Installation file for tinySIGCOMP dll
|
||||
;
|
||||
; This is an auto-generated PKG file by Carbide.
|
||||
; This file uses variables specific to Carbide builds that will not work
|
||||
; on command-line builds. If you want to use this generated PKG file from the
|
||||
; command-line tools you will need to modify the variables with the appropriate
|
||||
; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
|
||||
|
||||
;
|
||||
; UID is the dll's UID
|
||||
;
|
||||
#{"tinySIGCOMP DLL"},(0xED682012),1,0,0
|
||||
|
||||
|
||||
;Localised Vendor name
|
||||
%{"Vendor-EN"}
|
||||
|
||||
;Unique Vendor name
|
||||
:"Vendor"
|
||||
|
||||
"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\tinySIGCOMP.dll" -"!:\sys\bin\tinySIGCOMP.dll"
|
|
@ -385,13 +385,16 @@ void tcomp_compartment_addNack(tcomp_compartment_t *compartment, const uint8_t n
|
|||
// FIXME: very bad
|
||||
if(compartment->nacks_history_count >= NACK_MAX_HISTORY_SIZE)
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
//tsk_list_item_t *item;
|
||||
tsk_list_item_t *item2delete = 0;
|
||||
|
||||
tsk_list_foreach(item, compartment->nacks)
|
||||
/*tsk_list_foreach(item, compartment->nacks)
|
||||
{
|
||||
item2delete = item;
|
||||
}
|
||||
}*/
|
||||
|
||||
item2delete = compartment->nacks->tail;
|
||||
|
||||
tsk_list_remove_item(compartment->nacks, item2delete);
|
||||
compartment->nacks_history_count--;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject>
|
||||
<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="0" concurrentBuildJobs="4" defaultMMPChangedAction="0" infBuildComponents="" infFileLocation="group/bld.inf" macrosFile="" makeEngineToUse="make" manageDependencies="true" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideMakeEngine="false" overrideWorkspaceSettings="false" promptForMMPChangedAction="false" useConcurrentBuilding="true" useDebugMode="false" useIncrementalBuilder="false" useKeepGoing="false" useMMPMacros="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySIP\group\bld.inf;C:\Projects\Doubango\tinySIP\group\tinySIP.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/Projects/Doubango/tinyNET/src[LOCAL];C:/Projects/Doubango/tinySIP/include[LOCAL];C:/Projects/Doubango/thirdparties/s60/include/smc[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="TINYSIP_EXPORTS;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__CW32__;__S60_50__;__WINSCW__;_UNICODE;__S60_3X__;__S60_5X__;_DEBUG;__SERIES60_3X__;__DLL__;__WINS__;" moduleId="configDataCache" sourcesCache="/tinyNET/src;/tinySAK/src;/tinySIP/include;/tinySIP/source;" timestampCache="1261717558363" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySIP\group\bld.inf;C:\Projects\Doubango\tinySIP\group\tinySIP.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/Projects/Doubango/tinyNET/src[LOCAL];C:/Projects/Doubango/tinySIP/include[LOCAL];C:/Projects/Doubango/thirdparties/s60/include/smc[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;TINYSIP_EXPORTS;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__ARMCC_2__;__ARMCC__;__MARM__;__S60_50__;__S60_3X__;__ARMCC_2_2__;_UNICODE;__S60_5X__;_DEBUG;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinyNET/src;/tinySAK/src;/tinySIP/include;/tinySIP/source;;" timestampCache="1261717558379" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (ARMV5) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTCompilerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RVCTLinkerErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySIP\group\bld.inf;C:\Projects\Doubango\tinySIP\group\tinySIP.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/Projects/Doubango/tinyNET/src[LOCAL];C:/Projects/Doubango/tinySIP/include[LOCAL];C:/Projects/Doubango/thirdparties/s60/include/smc[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;TINYSIP_EXPORTS;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__ARMCC_2__;NDEBUG;__ARMCC__;__MARM__;__S60_50__;__S60_3X__;__ARMCC_2_2__;_UNICODE;__S60_5X__;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinyNET/src;/tinySAK/src;/tinySIP/include;/tinySIP/source;;" timestampCache="1261717558379" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Debug (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCEErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySIP\group\bld.inf;C:\Projects\Doubango\tinySIP\group\tinySIP.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/Projects/Doubango/tinyNET/src[LOCAL];C:/Projects/Doubango/tinySIP/include[LOCAL];C:/Projects/Doubango/thirdparties/s60/include/smc[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;TINYSIP_EXPORTS;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__GCCE__;__MARM__;__S60_50__;_UNICODE;__S60_3X__;__S60_5X__;_DEBUG;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinyNET/src;/tinySAK/src;/tinySIP/include;/tinySIP/source;;" timestampCache="1261717558395" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]" moduleId="org.eclipse.cdt.core.settings" name="Phone Release (GCCE) [S60_5th_Edition_SDK_v1.0]">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.GCCEErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.Elf2E32ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="CarbideConfigurationDataProvider">
|
||||
<ENV_VAR_DATA_ID/>
|
||||
<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
|
||||
<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="C:\"/>
|
||||
</storageModule>
|
||||
<storageModule filesCache="C:\Projects\Doubango\tinySIP\group\bld.inf;C:\Projects\Doubango\tinySIP\group\tinySIP.mmp;" includesCache="C:/Projects/Doubango/tinySAK/src[LOCAL];C:/Projects/Doubango/tinyNET/src[LOCAL];C:/Projects/Doubango/tinySIP/include[LOCAL];C:/Projects/Doubango/thirdparties/s60/include/smc[LOCAL];C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis;C:/S60/devices/S60_5th_Edition_SDK_v1.0/epoc32/include/stdapis/sys;" macrosCache="__GENERIC_MARM__;TINYSIP_EXPORTS;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__EPOC32__;__EABI__;__GCCE__;NDEBUG;__MARM__;__S60_50__;_UNICODE;__S60_3X__;__S60_5X__;__SERIES60_3X__;__MARM_ARMV5__;__DLL__;" moduleId="configDataCache" sourcesCache="/tinyNET/src;/tinySAK/src;/tinySIP/include;/tinySIP/source;;" timestampCache="1261717558395" useMmpMacrosCache="true"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
</cproject>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>tinySIP</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="root">
|
||||
<section name="CodeScannerPropertyPage">
|
||||
<item key="CodeScanerHTMLResults" value="false"/>
|
||||
<item key="CodeScannerResultsFolder" value=""/>
|
||||
<item key="CodeScannerRulesEnabled" value="1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:"/>
|
||||
<item key="CodeScannerLFunctionIgnore" value="RunL"/>
|
||||
<item key="CodeScannerFolder" value="C:\Apps\Nokia\Carbide.c++ v2.0\plugins\com.nokia.carbide.cpp.codescanner_1.4.0.014\tools\"/>
|
||||
<item key="CodeScannerWorryingComments" value="kludge|workaround|\scrap|hack"/>
|
||||
<item key="CodeScannerRuleSeverities" value="low:low:low:low:medium:low:low:low:low:low:low:low:low:high:medium:low:low:high:medium:medium:low:high:high:low:low:medium:medium:low:low:medium:medium:low:low:low:low:low:low:low:high:low:low:high:medium:low:low:low:low:low:high:low:low:high:low:low:low:medium:medium:low:low:low:low:low:low:low:low:high:medium:low:low:low:low:high:high:high:low:low:high:low:low:low:low:low:medium:low:low:high:medium:low:medium:low:medium:medium:low:medium:low:low:low:low:low:"/>
|
||||
<item key="CodeScannerRuleCategories" value="codereview:codereview:codereview:codereview:performance:codereview:codingstandards:codingstandards:codereview:codereview:codereview:codingstandards:codereview:canpanic:functionality:codingstandards:codingstandards:canpanic:functionality:performance:codingstandards:canpanic:canpanic:codereview:codingstandards:localisation:performance:codingstandards:codingstandards:functionality:functionality:codereview:codingstandards:codereview:codereview:codingstandards:codingstandards:codingstandards:canpanic:codereview:codingstandards:canpanic:functionality:codereview:codereview:codingstandards:codingstandards:codingstandards:canpanic:codingstandards:codingstandards:canpanic:codingstandards:codereview:codingstandards:functionality:functionality:codingstandards:codingstandards:codereview:codingstandards:codingstandards:codereview:codereview:codingstandards:canpanic:performance:codingstandards:codingstandards:codereview:codingstandards:canpanic:canpanic:canpanic:codereview:codingstandards:canpanic:codereview:codereview:codingstandards:codereview:codingstandards:functionality:codingstandards:codereview:panic:performance:codingstandards:functionality:codereview:performance:performance:codereview:performance:codereview:codereview:codingstandards:codingstandards:codereview:"/>
|
||||
<item key="CodeScannerOpenIgnore" value="RDesReadStream|RDesWriteStream"/>
|
||||
<item key="CodeScannerLongLinesLength" value="160"/>
|
||||
<item key="CodeScannerCClassIgnore" value="CBase"/>
|
||||
<item key="CodeScannerForbiddenWords" value="Typhoon|Hurricane|Epoc|Nokia Mobile Phones|NMP"/>
|
||||
<item key="CodeScannerFileFilters" value=".*\.au:.*\.avi:.*\.bat:.*\.bin:.*\.bmp:.*\.cmd:.*\.dll:.*\.doc:.*\.exe:.*\.gif:.*\.jpg:.*\.lib:.*\.log:.*\.mbm:.*\.mp3:.*\.mpg:.*\.png:.*\.raw:.*\.rtf:.*\.tif:.*\.wav:.*\.wbmp:.*\.wmf:.*\.xls:.*\.zip:"/>
|
||||
<item key="CodeScannerRuleScripts" value="accessArrayElementWithoutCheck:accessArrayElementWithoutCheck2:activestart:activestop:arraypassing:arrayptrcleanup:assertdebuginvariant:baddefines:baseconstruct:callActiveObjectWithoutCheckingOrStopping:changenotification:cleanup:commentcode:connect:ConnectAndDontCloseMemberVariable:constnames:consttdescptr:controlornull:ctltargettype:debugrom:declarename:deleteMemberVariable:destructor:doubleSemiColon:driveletters:eikbuttons:eikonenvstatic:enummembers:enumnames:exportinline:exportpurevirtual:foff:forbiddenwords:forgottoputptroncleanupstack:friend:goto:ifassignments:ifpreprocessor:inheritanceorder:intleaves:jmp:leave:LeaveNoError:leavingoperators:LFunctionCantLeave:longlines:magicnumbers:mclassdestructor:memberlc:membervariablecallld:missingcancel:missingcclass:mmpsourcepath:multilangrsc:multipledeclarations:multipleinheritance:mydocs:namespace:newlreferences:noleavetrap:nonconsthbufc:nonconsttdesc:nonleavenew:nonunicodeskins:null:open:pointertoarrays:pragmadisable:pragmamessage:pragmaother:privateinheritance:pushaddrvar:pushmember:readresource:resourcenotoncleanupstack:resourcesonheap:returndescriptoroutofscope:rfs:rssnames:stringliterals:stringsinresourcefiles:struct:tcclasses:tclassdestructor:todocomments:trapcleanup:trapeleave:traprunl:trspassing:uids:uncompressedaif:uncompressedbmp:unicodesource:userafter:userfree:userWaitForRequest:variablenames:voidparameter:worryingcomments:"/>
|
||||
<item key="CodeScannerXMLResults" value="false"/>
|
||||
<item key="CodeScannerProjectSettings" value="false"/>
|
||||
<item key="CodeScannerKnowledgeBaseScanning" value="false"/>
|
||||
<item key="CodeScannerAutoscan" value="false"/>
|
||||
</section>
|
||||
</section>
|
|
@ -0,0 +1,85 @@
|
|||
EXPORTS
|
||||
tsip_contact_def_t @ 1 NONAME
|
||||
tsip_dialog_layer_def_t @ 2 NONAME
|
||||
tsip_dialog_register_def_t @ 3 NONAME
|
||||
tsip_event_def_t @ 4 NONAME
|
||||
tsip_global_deinit @ 5 NONAME
|
||||
tsip_global_init @ 6 NONAME
|
||||
tsip_header_Allow_Events_def_t @ 7 NONAME
|
||||
tsip_header_Allow_def_t @ 8 NONAME
|
||||
tsip_header_CSeq_def_t @ 9 NONAME
|
||||
tsip_header_Call_ID_def_t @ 10 NONAME
|
||||
tsip_header_Contact_def_t @ 11 NONAME
|
||||
tsip_header_Content_Length_def_t @ 12 NONAME
|
||||
tsip_header_Expires_def_t @ 13 NONAME
|
||||
tsip_header_From_def_t @ 14 NONAME
|
||||
tsip_header_Max_Forwards_def_t @ 15 NONAME
|
||||
tsip_header_Min_Expires_def_t @ 16 NONAME
|
||||
tsip_header_P_Access_Network_Info_def_t @ 17 NONAME
|
||||
tsip_header_P_Preferred_Identity_def_t @ 18 NONAME
|
||||
tsip_header_Privacy_def_t @ 19 NONAME
|
||||
tsip_header_Require_def_t @ 20 NONAME
|
||||
tsip_header_Supported_def_t @ 21 NONAME
|
||||
tsip_header_To_def_t @ 22 NONAME
|
||||
tsip_header_User_Agent_def_t @ 23 NONAME
|
||||
tsip_header_Via_def_t @ 24 NONAME
|
||||
tsip_header_get_name @ 25 NONAME
|
||||
tsip_header_get_param_separator @ 26 NONAME
|
||||
tsip_header_tostring @ 27 NONAME
|
||||
tsip_message_add_header @ 28 NONAME
|
||||
tsip_message_allowed @ 29 NONAME
|
||||
tsip_message_def_t @ 30 NONAME
|
||||
tsip_message_getContent_length @ 31 NONAME
|
||||
tsip_message_getExpires @ 32 NONAME
|
||||
tsip_message_get_header @ 33 NONAME
|
||||
tsip_message_get_headerAt @ 34 NONAME
|
||||
tsip_message_parse @ 35 NONAME
|
||||
tsip_message_required @ 36 NONAME
|
||||
tsip_message_supported @ 37 NONAME
|
||||
tsip_message_tostring @ 38 NONAME
|
||||
tsip_operation_def_t @ 39 NONAME
|
||||
tsip_ragel_state_init @ 40 NONAME
|
||||
tsip_request_new @ 41 NONAME
|
||||
tsip_stack_create @ 42 NONAME
|
||||
tsip_stack_destroy @ 43 NONAME
|
||||
tsip_stack_register @ 44 NONAME
|
||||
tsip_stack_set @ 45 NONAME
|
||||
tsip_stack_start @ 46 NONAME
|
||||
tsip_stack_stop @ 47 NONAME
|
||||
tsip_timers_getA @ 48 NONAME
|
||||
tsip_timers_getB @ 49 NONAME
|
||||
tsip_timers_getC @ 50 NONAME
|
||||
tsip_timers_getD @ 51 NONAME
|
||||
tsip_timers_getE @ 52 NONAME
|
||||
tsip_timers_getF @ 53 NONAME
|
||||
tsip_timers_getG @ 54 NONAME
|
||||
tsip_timers_getH @ 55 NONAME
|
||||
tsip_timers_getI @ 56 NONAME
|
||||
tsip_timers_getJ @ 57 NONAME
|
||||
tsip_timers_getK @ 58 NONAME
|
||||
tsip_timers_getT1 @ 59 NONAME
|
||||
tsip_timers_getT2 @ 60 NONAME
|
||||
tsip_timers_getT4 @ 61 NONAME
|
||||
tsip_timers_setA @ 62 NONAME
|
||||
tsip_timers_setB @ 63 NONAME
|
||||
tsip_timers_setD @ 64 NONAME
|
||||
tsip_timers_setE @ 65 NONAME
|
||||
tsip_timers_setF @ 66 NONAME
|
||||
tsip_timers_setG @ 67 NONAME
|
||||
tsip_timers_setH @ 68 NONAME
|
||||
tsip_timers_setI @ 69 NONAME
|
||||
tsip_timers_setJ @ 70 NONAME
|
||||
tsip_timers_setK @ 71 NONAME
|
||||
tsip_timers_setT1 @ 72 NONAME
|
||||
tsip_timers_setT2 @ 73 NONAME
|
||||
tsip_timers_setT4 @ 74 NONAME
|
||||
tsip_timers_setc @ 75 NONAME
|
||||
tsip_transac_layer_def_t @ 76 NONAME
|
||||
tsip_transac_nict_def_t @ 77 NONAME
|
||||
tsip_transport_def_t @ 78 NONAME
|
||||
tsip_transport_layer_def_t @ 79 NONAME
|
||||
tsip_uri_clone @ 80 NONAME
|
||||
tsip_uri_def_t @ 81 NONAME
|
||||
tsip_uri_parse @ 82 NONAME
|
||||
tsip_uri_tostring @ 83 NONAME
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
@ECHO OFF
|
||||
|
||||
REM Bldmake-generated batch file - ABLD.BAT
|
||||
REM ** DO NOT EDIT **
|
||||
|
||||
perl -S ABLD.PL "\Projects\Doubango\tinySIP\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
if errorlevel==1 goto CheckPerl
|
||||
goto End
|
||||
|
||||
:CheckPerl
|
||||
perl -v >NUL
|
||||
if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?
|
||||
goto End
|
||||
|
||||
:End
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
============================================================================
|
||||
Name : bld.inf
|
||||
Author : Mamadou Diop
|
||||
Copyright : * 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.
|
||||
Description : This file provides the information required for building the
|
||||
whole of a tinySIP.
|
||||
============================================================================
|
||||
*/
|
||||
|
||||
PRJ_PLATFORMS
|
||||
DEFAULT
|
||||
|
||||
PRJ_EXPORTS
|
||||
|
||||
PRJ_MMPFILES
|
||||
tinySIP.mmp
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
============================================================================
|
||||
Name : tinySIP.mmp
|
||||
Author : Mamadou Diop
|
||||
Copyright : * 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.
|
||||
Description : This is the project specification file for tinySIP.
|
||||
============================================================================
|
||||
*/
|
||||
|
||||
TARGET tinySIP.dll
|
||||
TARGETTYPE dll
|
||||
UID 0x1000008d 0xE600CF6F
|
||||
|
||||
|
||||
USERINCLUDE ..\..\tinySAK\src
|
||||
USERINCLUDE ..\..\tinyNET\src
|
||||
USERINCLUDE ..\..\tinySIP\include
|
||||
USERINCLUDE ..\..\thirdparties\s60\include\smc
|
||||
|
||||
SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis \epoc32\include\stdapis\sys
|
||||
|
||||
|
||||
|
||||
// In order to use .def files to freeze code you must use one or more DEFFILE lines;
|
||||
// see the ones commented out below for examples.
|
||||
// By default, the build tools look for the WINSCW def file in a BWINS directory
|
||||
// (at the same level as the directory containing the mmp file),
|
||||
// the GCC ARM def file in a BMARM directory, and the ARMV5 def file in a EABI directory.
|
||||
// If your .def files are stored in these default locations, you can simply specify the
|
||||
// .def filename(s) with no path. If you want to store .def files in non-default
|
||||
// locations, you will need to specify the paths in the DEFFILE statement(s).
|
||||
|
||||
//The following commented out code shows how the build system uses the implicit
|
||||
// location for defiles. To create the DEF files Choose Project > Freeze Exports from Carbide
|
||||
// or run 'abld freeze' from the command-line
|
||||
//#if defined (WINS)
|
||||
// DEFFILE ..\bwins\tinySIP.def
|
||||
//#elif defined (GCC32)
|
||||
// DEFFILE ..\bmarm\tinySIP.def
|
||||
//#else
|
||||
// DEFFILE ..\eabi\tinySIP.def
|
||||
//#endif
|
||||
|
||||
nostrictdef
|
||||
|
||||
LIBRARY euser.lib libc.lib tinySAK.lib tinyNET.lib
|
||||
|
||||
#ifdef ENABLE_ABIV2_MODE
|
||||
DEBUGGABLE_UDEBONLY
|
||||
#endif
|
||||
|
||||
MACRO TINYSIP_EXPORTS
|
||||
|
||||
EPOCALLOWDLLDATA
|
||||
|
||||
SOURCEPATH ..\source\dialogs
|
||||
SOURCE tsip_dialog.c tsip_dialog_invite.client.c tsip_dialog_invite.server.c tsip_dialog_layer.c tsip_dialog_register.client.c tsip_dialog_register.server.c tsip_dialog_subscribe.client.c tsip_dialog_subscribe.server.c
|
||||
SOURCEPATH ..\source\headers
|
||||
SOURCE tsip_header.c tsip_header_Accept_Contact.c tsip_header_Accept_Encoding.c tsip_header_Accept_Language.c tsip_header_Accept_Resource_Priority.c tsip_header_Alert_Info.c tsip_header_Allow.c tsip_header_Allow_Events.c tsip_header_Authentication_Info.c tsip_header_Authorization.c tsip_header_CSeq.c tsip_header_Call_ID.c tsip_header_Call_Info.c tsip_header_Contact.c tsip_header_Content_Disposition.c tsip_header_Content_Encoding.c tsip_header_Content_Language.c tsip_header_Content_Length.c tsip_header_Content_Type.c tsip_header_Date.c tsip_header_Error_Info.c tsip_header_Event.c tsip_header_Expires.c tsip_header_From.c tsip_header_History_Info.c tsip_header_Identity.c tsip_header_Identity_Info.c tsip_header_In_Reply_To.c tsip_header_Join.c tsip_header_MIME_Version.c tsip_header_Max_Forwards.c tsip_header_Min_Expires.c tsip_header_Min_SE.c tsip_header_Organization.c tsip_header_P_Access_Network_Info.c tsip_header_P_Answer_State.c tsip_header_P_Asserted_Identity.c tsip_header_P_Associated_URI.c tsip_header_P_Called_Party_ID.c tsip_header_P_Charging_Function_Addresses.c tsip_header_P_Charging_Vector.c tsip_header_P_DCS_Billing_Info.c tsip_header_P_DCS_LAES.c tsip_header_P_DCS_OSPS.c tsip_header_P_DCS_Redirect.c tsip_header_P_DCS_Trace_Party_ID.c tsip_header_P_Early_Media.c tsip_header_P_Media_Authorization.c tsip_header_P_Preferred_Identity.c tsip_header_P_Profile_Key.c tsip_header_P_User_Database.c tsip_header_P_Visited_Network_ID.c tsip_header_Path.c tsip_header_Priority.c tsip_header_Privacy.c tsip_header_Proxy_Authenticate.c tsip_header_Proxy_Authorization.c tsip_header_Proxy_Require.c tsip_header_RAck.c tsip_header_RSeq.c tsip_header_Reason.c tsip_header_Record_Route.c tsip_header_Refer_Sub.c tsip_header_Refer_To.c tsip_header_Referred_By.c tsip_header_Reject_Contact.c tsip_header_Replaces.c tsip_header_Reply_To.c tsip_header_Request_Disposition.c tsip_header_Require.c tsip_header_Resource_Priority.c tsip_header_Retry_After.c tsip_header_Route.c tsip_header_SIP_ETag.c tsip_header_SIP_If_Match.c tsip_header_Security_Client.c tsip_header_Security_Server.c tsip_header_Security_Verify.c tsip_header_Server.c tsip_header_Service_Route.c tsip_header_Session_Expires.c tsip_header_Subject.c tsip_header_Subscription_State.c tsip_header_Supported.c tsip_header_Target_Dialog.c tsip_header_Timestamp.c tsip_header_To.c tsip_header_Unsupported.c tsip_header_User_Agent.c tsip_header_Via.c tsip_header_WWW_Authenticate.c tsip_header_Warning.c tsip_header_accept.c
|
||||
SOURCEPATH ..\source\parsers
|
||||
SOURCE tsip_parser_header.c tsip_parser_message.c tsip_parser_uri.c tsip_ragel_state.c
|
||||
SOURCEPATH ..\source\smc
|
||||
SOURCE tsip_dialog_register_sm.c tsip_transac_ict_sm.c tsip_transac_ist_sm.c tsip_transac_nict_sm.c tsip_transac_nist_sm.c
|
||||
SOURCEPATH ..\source\transactions
|
||||
SOURCE tsip_transac.c tsip_transac_ict.c tsip_transac_ist.c tsip_transac_layer.c tsip_transac_nict.c tsip_transac_nist.c
|
||||
SOURCEPATH ..\source\transports
|
||||
SOURCE tsip_transport.c tsip_transport_layer.c
|
||||
SOURCEPATH ..\source
|
||||
SOURCE tsip.c tsip_message.c tsip_operation.c tsip_timers.c tsip_uri.c
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -33,47 +33,102 @@
|
|||
#include "tinysip_config.h"
|
||||
|
||||
#include "tsip.h"
|
||||
#include "tinysip/tsip_uri.h"
|
||||
#include "tinysip/tsip_timers.h"
|
||||
#include "tinysip/tsip_message.h"
|
||||
#include "tinysip/tsip_operation.h"
|
||||
|
||||
#include "tsk_object.h"
|
||||
#include "tsk_list.h"
|
||||
#include "tsk_string.h"
|
||||
|
||||
#define TSIP_DIALOG(self) ((tsip_dialog_t*)(self))
|
||||
#define TSIP_DIALOG_GET_STATE(self) TSIP_DIALOG(self)->state
|
||||
#define TSIP_DIALOG(self) ((tsip_dialog_t*)(self))
|
||||
#define TSIP_DIALOG_GET_STATE(self) TSIP_DIALOG(self)->state
|
||||
|
||||
#define TSIP_DIALOG_TIMER_SCHEDULE(name, TX) self->timer##TX##.id = tsk_timer_manager_schedule(TSIP_STACK(self->stack)->timer_mgr, TSK_TIME_S_2_MS(self->timer##TX##.timeout), TSK_TIMER_CALLBACK(tsip_dialog_##name##Context_sm_##TX##), &(self->_fsm))
|
||||
|
||||
#define TSIP_DIALOG_EXPIRES_DEFAULT 3600
|
||||
|
||||
typedef enum tsip_dialog_state_e
|
||||
{
|
||||
tsip_none,
|
||||
tsip_early,
|
||||
tsip_established,
|
||||
tsip_terminated
|
||||
}
|
||||
tsip_dialog_state_t;
|
||||
|
||||
typedef enum tsip_dialog_type_e
|
||||
{
|
||||
tsip_dialog_unknown,
|
||||
tsip_dialog_invite,
|
||||
tsip_dialog_message,
|
||||
tsip_dialog_options,
|
||||
tsip_dialog_prack,
|
||||
tsip_dialog_publish,
|
||||
tsip_dialog_refer,
|
||||
tsip_dialog_register
|
||||
}
|
||||
tsip_dialog_type_t;
|
||||
|
||||
typedef enum tsip_dialog_event_type_e
|
||||
{
|
||||
tsip_dialog_msg,
|
||||
tsip_dialog_transac_ok,
|
||||
tsip_dialog_canceled,
|
||||
tsip_dialog_terminated,
|
||||
tsip_dialog_timedout,
|
||||
tsip_dialog_error,
|
||||
tsip_dialog_transport_error
|
||||
}
|
||||
tsip_dialog_event_type_t;
|
||||
|
||||
typedef int (*tsip_dialog_event_callback)(const void *arg, tsip_dialog_event_type_t type, const tsip_message_t *msg);
|
||||
|
||||
#define TSIP_DECLARE_DIALOG struct { \
|
||||
TSK_DECLARE_OBJECT; \
|
||||
\
|
||||
const tsip_stack_handle_t * stack;\
|
||||
tsip_dialog_type_t type; \
|
||||
\
|
||||
const tsip_stack_handle_t *stack;\
|
||||
const tsip_operation_handle_t* operation; \
|
||||
\
|
||||
tsip_dialog_state_t state; \
|
||||
\
|
||||
unsigned running:1; \
|
||||
\
|
||||
char* tag_local; \
|
||||
tsip_uri_t* uri_local; \
|
||||
char* tag_remote; \
|
||||
tsip_uri_t* uri_remote; \
|
||||
\
|
||||
tsip_uri_t* uri_remote_target; \
|
||||
\
|
||||
int32_t cseq_value; \
|
||||
char* cseq_method; \
|
||||
int32_t rseq_value; \
|
||||
\
|
||||
int32_t expires; \
|
||||
\
|
||||
char* callid; \
|
||||
\
|
||||
tsip_uris_L_t *routes; \
|
||||
\
|
||||
tsip_dialog_event_callback callback; \
|
||||
}
|
||||
|
||||
typedef TSIP_DECLARE_DIALOG tsip_dialog_t;
|
||||
|
||||
typedef tsk_list_t tsip_dialogs_L_t;
|
||||
|
||||
int tsip_dialog_request_send(const tsip_dialog_t *self, const tsip_request_t* request);
|
||||
int tsip_dialog_response_send(const tsip_dialog_t *, const tsip_response_t* response);
|
||||
tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* method);
|
||||
int tsip_dialog_request_send(const tsip_dialog_t *self, tsip_request_t* request);
|
||||
int tsip_dialog_response_send(const tsip_dialog_t *self, tsip_response_t* response);
|
||||
|
||||
int tsip_dialog_init(tsip_dialog_t *self, const tsip_stack_handle_t * stack);
|
||||
int tsip_dialog_get_newdelay(tsip_dialog_t *self, const tsip_response_t* response);
|
||||
int tsip_dialog_update(tsip_dialog_t *self, const tsip_response_t* response);
|
||||
|
||||
int tsip_dialog_init(tsip_dialog_t *self, tsip_dialog_type_t type, const tsip_stack_handle_t * stack, const char* call_id, const tsip_operation_handle_t* operation);
|
||||
int tsip_dialog_deinit(tsip_dialog_t *self);
|
||||
|
||||
#endif /* TINYSIP_DIALOG_H */
|
|
@ -50,8 +50,11 @@ typedef struct tsip_dialog_layer_s
|
|||
tsip_dialogs_L_t *dialogs;
|
||||
}
|
||||
tsip_dialog_layer_t;
|
||||
|
||||
typedef tsk_list_t tsip_dialog_layers_L_t;
|
||||
|
||||
int tsip_dialog_layer_register(tsip_dialog_layer_t *self, const tsip_operation_handle_t *operation);
|
||||
|
||||
|
||||
TINYSIP_API const void *tsip_dialog_layer_def_t;
|
||||
|
||||
#endif /* TINYSIP_DIALOG_LAYER_H */
|
|
@ -32,32 +32,37 @@
|
|||
|
||||
#include "tinysip_config.h"
|
||||
#include "tinysip/dialogs/tsip_dialog.h"
|
||||
#include "tinysip/tsip_operation.h"
|
||||
|
||||
#include "tinysip/smc/tsip_dialog_register_sm.h"
|
||||
|
||||
#define TSIP_DIALOG_REGISTER_CREATE(stack) tsk_object_new(tsip_dialog_register_def_t, (const tsip_stack_handle_t *)stack)
|
||||
#define TSIP_DIALOG_REGISTER_CREATE(stack, operation) tsk_object_new(tsip_dialog_register_def_t, (const tsip_stack_handle_t *)stack, (const tsip_operation_handle_t*) operation)
|
||||
#define TSIP_DIALOG_REGISTER_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
#define TSIP_DIALOG_REGISTER(self) ((tsip_dialog_register_t*)(self))
|
||||
|
||||
typedef struct tsip_dialog_register
|
||||
{
|
||||
TSIP_DECLARE_DIALOG;
|
||||
|
||||
struct tsip_dialog_registerContext _fsm;
|
||||
|
||||
tsip_timer_t timerrefresh;
|
||||
|
||||
unsigned registering:1;
|
||||
tsip_request_t *dlg_request;
|
||||
}
|
||||
tsip_dialog_register_t;
|
||||
|
||||
void tsip_dialog_register_init(tsip_dialog_register_t *self);
|
||||
int tsip_dialog_register_start(tsip_dialog_register_t *self, const tsip_operation_handle_t* operation);
|
||||
int tsip_dialog_register_start(tsip_dialog_register_t *self);
|
||||
|
||||
void tsip_dialog_register_Started_2_Trying_X_send(tsip_dialog_register_t *self);
|
||||
void tsip_dialog_register_Trying_2_Trying_X_1xx(tsip_dialog_register_t *self);
|
||||
void tsip_dialog_register_Trying_2_Connected_X_2xx(tsip_dialog_register_t *self);
|
||||
void tsip_dialog_register_Trying_2_Terminated_X_2xx(tsip_dialog_register_t *self);
|
||||
void tsip_dialog_register_Trying_2_Trying_X_401_407_421_494(tsip_dialog_register_t *self);
|
||||
void tsip_dialog_register_Trying_2_Terminated_X_401_407_421_494(tsip_dialog_register_t *self);
|
||||
void tsip_dialog_register_Trying_2_Trying_X_423(tsip_dialog_register_t *self);
|
||||
void tsip_dialog_register_Trying_2_Terminated_X_300_to_699(tsip_dialog_register_t *self);
|
||||
void tsip_dialog_register_Trying_2_Trying_X_1xx(tsip_dialog_register_t *self, const tsip_message_t *msg);
|
||||
void tsip_dialog_register_Trying_2_Connected_X_2xx(tsip_dialog_register_t *self, const tsip_message_t *msg);
|
||||
void tsip_dialog_register_Trying_2_Terminated_X_2xx(tsip_dialog_register_t *self, const tsip_message_t *msg);
|
||||
void tsip_dialog_register_Trying_2_Trying_X_401_407_421_494(tsip_dialog_register_t *self, const tsip_message_t *msg);
|
||||
void tsip_dialog_register_Trying_2_Terminated_X_401_407_421_494(tsip_dialog_register_t *self, const tsip_message_t *msg);
|
||||
void tsip_dialog_register_Trying_2_Trying_X_423(tsip_dialog_register_t *self, const tsip_message_t *msg);
|
||||
void tsip_dialog_register_Trying_2_Terminated_X_300_to_699(tsip_dialog_register_t *self, const tsip_message_t *msg);
|
||||
void tsip_dialog_register_Trying_2_Terminated_X_cancel(tsip_dialog_register_t *self);
|
||||
void tsip_dialog_register_Connected_2_Trying_X_unregister(tsip_dialog_register_t *self);
|
||||
void tsip_dialog_register_Connected_2_Trying_X_refresh(tsip_dialog_register_t *self);
|
||||
|
|
|
@ -161,10 +161,11 @@ typedef tsk_list_t tsip_headers_L_t; /**< List of @ref tsip_header_t elements. *
|
|||
|
||||
TINYSIP_API const char *tsip_header_get_name(tsip_header_type_t type);
|
||||
TINYSIP_API const char tsip_header_get_param_separator(const tsip_header_t *self, int first);
|
||||
TINYSIP_API void tsip_header_add_param(tsip_header_t *self, const char *name, const char *value);
|
||||
TINYSIP_API int tsip_header_tostring(const tsip_header_t *self, tsk_buffer_t *output);
|
||||
|
||||
#define TSIP_HEADER_HAS_PARAM(self, name) tsk_params_has_param(self ? self->params : 0, name)
|
||||
#define TSIP_HEADER_ADD_PARAM(self, name, value) tsk_params_add_param(self ? &self->params : 0, name, value)
|
||||
#define TSIP_HEADER_REMOVE_PARAM(self, name) tsk_params_remove_param(self ? self->params : 0, name)
|
||||
#define TSIP_HEADER_GET_PARAM_BY_NAME(self, name) tsk_params_get_param_by_name(self ? self->params : 0, name)
|
||||
#define TSIP_HEADER_GET_PARAM_VALUE(self, name) tsk_params_get_param_value(self ? self->params : 0, name)
|
||||
#define TSIP_HEADER_GET_PARAM_VALUE_AS_INT(self, name) tsk_params_get_param_value_as_int(self ? self->params : 0, name)
|
||||
|
|
|
@ -40,8 +40,13 @@
|
|||
* Safely free a sip 'CSeq' header previously created using TSIP_HEADER_CSEQ_CREATE.
|
||||
* @sa TSIP_HEADER_CSEQ_CREATE.
|
||||
*/
|
||||
#define TSIP_HEADER_CSEQ_CREATE() tsk_object_new(tsip_header_CSeq_def_t)
|
||||
#define TSIP_HEADER_CSEQ_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
#define TSIP_HEADER_CSEQ_VA_ARGS(seq, method) tsip_header_CSeq_def_t, (int32_t) seq, (const char*)method
|
||||
#define TSIP_HEADER_CSEQ_CREATE(seq, method) tsk_object_new(TSIP_HEADER_CSEQ_VA_ARGS(seq, method))
|
||||
#define TSIP_HEADER_CSEQ_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
#define TSIP_HEADER_CSEQ_NONE -1
|
||||
#define TSIP_HEADER_CSEQ_DEFAULT 1
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @struct
|
||||
|
|
|
@ -40,8 +40,9 @@
|
|||
* Safely free a sip 'Call-ID' header previously created using TSIP_HEADER_CALL_ID_CREATE.
|
||||
* @sa TSIP_HEADER_CALL_ID_CREATE.
|
||||
*/
|
||||
#define TSIP_HEADER_CALL_ID_CREATE(call_id) tsk_object_new(tsip_header_Call_ID_def_t, (const char*)call_id)
|
||||
#define TSIP_HEADER_CALL_ID_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
#define TSIP_HEADER_CALL_ID_VA_ARGS(call_id) tsip_header_Call_ID_def_t, (const char*)call_id
|
||||
#define TSIP_HEADER_CALL_ID_CREATE(call_id) tsk_object_new(TSIP_HEADER_CALL_ID_VA_ARGS(call_id))
|
||||
#define TSIP_HEADER_CALL_ID_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @struct
|
||||
|
@ -62,6 +63,7 @@ typedef struct tsip_header_Call_ID_s
|
|||
}
|
||||
tsip_header_Call_ID_t;
|
||||
|
||||
void tsip_header_Call_ID_random(tsk_istr_t *result);
|
||||
tsip_header_Call_ID_t *tsip_header_Call_ID_parse(const char *data, size_t size);
|
||||
|
||||
TINYSIP_API const void *tsip_header_Call_ID_def_t;
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
#define TSIP_HEADER_CONTACT_CREATE() tsk_object_new(tsip_header_Contact_def_t)
|
||||
#define TSIP_HEADER_CONTACT_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
#define TSIP_CONTACT_CREATE() tsk_object_new(tsip_contact_def_t)
|
||||
#define TSIP_CONTACT_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
#define TSIP_CONTACT_CREATE() tsk_object_new(tsip_contact_def_t)
|
||||
#define TSIP_CONTACT_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
typedef struct tsip_contact_s
|
||||
{
|
||||
|
|
|
@ -40,8 +40,12 @@
|
|||
* Safely free a sip 'Expires' header previously created using TSIP_HEADER_EXPIRES_CREATE.
|
||||
* @sa TSIP_HEADER_EXPIRES_CREATE.
|
||||
*/
|
||||
#define TSIP_HEADER_EXPIRES_CREATE() tsk_object_new(tsip_header_Expires_def_t)
|
||||
#define TSIP_HEADER_EXPIRES_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
#define TSIP_HEADER_EXPIRES_CREATE(delta_seconds) tsk_object_new(tsip_header_Expires_def_t, (int32_t)delta_seconds)
|
||||
#define TSIP_HEADER_EXPIRES_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
|
||||
#define TSIP_HEADER_EXPIRES_NONE -1
|
||||
#define TSIP_HEADER_EXPIRES_DEFAULT 600000
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @struct
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
* Safely free a sip 'From' header previously created using TSIP_HEADER_FROM_CREATE.
|
||||
* @sa TSIP_HEADER_FROM_CREATE.
|
||||
*/
|
||||
#define TSIP_HEADER_FROM_CREATE(display_name, uri, tag) tsk_object_new(tsip_header_From_def_t, (const char*)display_name, (const tsip_uri_t*)uri, (const char*)tag)
|
||||
#define TSIP_HEADER_FROM_VA_ARGS(display_name, uri, tag) tsip_header_From_def_t, (const char*)display_name, (const tsip_uri_t*)uri, (const char*)tag
|
||||
#define TSIP_HEADER_FROM_CREATE(display_name, uri, tag) tsk_object_new(TSIP_HEADER_FROM_VA_ARGS(display_name, uri, tag))
|
||||
#define TSIP_HEADER_FROM_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -42,9 +42,14 @@
|
|||
* Safely free a sip 'Max-Forwards' header previously created using TSIP_HEADER_MAX_FORWARDS_CREATE.
|
||||
* @sa TSIP_HEADER_MAX_FORWARDS_CREATE.
|
||||
*/
|
||||
#define TSIP_HEADER_MAX_FORWARDS_CREATE(max) tsk_object_new(tsip_header_Max_Forwards_def_t, (int32_t) max)
|
||||
#define TSIP_HEADER_MAX_FORWARDS_VA_ARGS(max) tsip_header_Max_Forwards_def_t, (int32_t) max
|
||||
#define TSIP_HEADER_MAX_FORWARDS_CREATE(max) tsk_object_new(TSIP_HEADER_MAX_FORWARDS_VA_ARGS(max))
|
||||
#define TSIP_HEADER_MAX_FORWARDS_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
|
||||
#define TSIP_HEADER_MAX_FORWARDS_NONE -1
|
||||
#define TSIP_HEADER_MAX_FORWARDS_DEFAULT 70
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @struct
|
||||
///
|
||||
|
@ -52,7 +57,7 @@
|
|||
/// @author Mamadou
|
||||
/// @date 12/3/2009
|
||||
///
|
||||
/// @par ABNF
|
||||
/// @par ABNF: Max-Forwards = "Max-Forwards" HCOLON 1*DIGIT
|
||||
///
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct tsip_header_Max_Forwards_s
|
||||
|
|
|
@ -32,20 +32,44 @@
|
|||
#include "tinysip_config.h"
|
||||
#include "tinysip/headers/tsip_header.h"
|
||||
|
||||
|
||||
/**@def TSIP_HEADER_MIN_EXPIRES_CREATE
|
||||
* Creates new sip 'Min-Expires' header. You must call @ref TSIP_HEADER_MIN_EXPIRES_SAFE_FREE to free the header.
|
||||
* @sa TSIP_HEADER_MIN_EXPIRES_SAFE_FREE.
|
||||
*/
|
||||
/**@def TSIP_HEADER_MIN_EXPIRES_SAFE_FREE
|
||||
* Safely free a sip 'Min-Expires' header previously created using TSIP_HEADER_MIN_EXPIRES_CREATE.
|
||||
* @sa TSIP_HEADER_MIN_EXPIRES_CREATE.
|
||||
*/
|
||||
#define TSIP_HEADER_MIN_EXPIRES_VA_ARGS(value) tsip_header_Min_Expires_def_t, (int32_t) value
|
||||
#define TSIP_HEADER_MIN_EXPIRES_CREATE(value) tsk_object_new(TSIP_HEADER_MIN_EXPIRES_VA_ARGS(value))
|
||||
#define TSIP_HEADER_MIN_EXPIRES_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
#define TSIP_HEADER_MIN_EXPIRES_CREATE_NULL() TSIP_HEADER_MIN_EXPIRES_CREATE(TSIP_HEADER_MIN_EXPIRES_NONE)
|
||||
|
||||
#define TSIP_HEADER_MIN_EXPIRES_NONE -1
|
||||
#define TSIP_HEADER_MIN_EXPIRES_DEFAULT 30
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @struct
|
||||
///
|
||||
/// @brief SIP header 'Min-Expires'.
|
||||
/// @brief SIP header 'Min-Expires' as per RFC 3261.
|
||||
/// @author Mamadou
|
||||
/// @date 12/3/2009
|
||||
///
|
||||
/// @par ABNF
|
||||
/// @par ABNF: Min-Expires = "Min-Expires" HCOLON delta-seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct tsip_header_Min_Expires_s
|
||||
{
|
||||
TSIP_DECLARE_HEADER;
|
||||
|
||||
int32_t value;
|
||||
}
|
||||
tsip_header_Min_Expires_t;
|
||||
|
||||
tsip_header_Min_Expires_t *tsip_header_Min_Expires_parse(const char *data, size_t size);
|
||||
|
||||
TINYSIP_API const void *tsip_header_Min_Expires_def_t;
|
||||
|
||||
#endif /* _TSIP_HEADER_MIN_EXPIRES_H_ */
|
|
@ -40,9 +40,12 @@
|
|||
* Safely free a sip 'P-Access-Network-Info' header previously created using TSIP_HEADER_P_ACCESS_NETWORK_INFO_CREATE.
|
||||
* @sa TSIP_HEADER_P_ACCESS_NETWORK_INFO_CREATE.
|
||||
*/
|
||||
#define TSIP_HEADER_P_ACCESS_NETWORK_INFO_CREATE() tsk_object_new(tsip_header_P_Access_Network_Info_def_t)
|
||||
#define TSIP_HEADER_P_ACCESS_NETWORK_INFO_VA_ARGS(value) tsip_header_P_Access_Network_Info_def_t, (const char*)value
|
||||
#define TSIP_HEADER_P_ACCESS_NETWORK_INFO_CREATE(value) tsk_object_new(TSIP_HEADER_P_ACCESS_NETWORK_INFO_VA_ARGS(value))
|
||||
#define TSIP_HEADER_P_ACCESS_NETWORK_INFO_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
#define TSIP_HEADER_P_ACCESS_NETWORK_INFO_CREATE_NULL() TSIP_HEADER_P_ACCESS_NETWORK_INFO_CREATE(0)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @struct
|
||||
///
|
||||
|
|
|
@ -41,7 +41,8 @@
|
|||
* Safely free a sip 'To' header previously created using TSIP_HEADER_TO_CREATE.
|
||||
* @sa TSIP_HEADER_TO_CREATE.
|
||||
*/
|
||||
#define TSIP_HEADER_TO_CREATE(display_name, uri, tag) tsk_object_new(tsip_header_To_def_t, (const char*)display_name, (const tsip_uri_t*)uri, (const char*)tag)
|
||||
#define TSIP_HEADER_TO_VA_ARGS(display_name, uri, tag) tsip_header_To_def_t, (const char*)display_name, (const tsip_uri_t*)uri, (const char*)tag
|
||||
#define TSIP_HEADER_TO_CREATE(display_name, uri, tag) tsk_object_new(TSIP_HEADER_TO_VA_ARGS(display_name, uri, tag))
|
||||
#define TSIP_HEADER_TO_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -40,9 +40,12 @@
|
|||
* Safely free a sip 'User-Agent' header previously created using TSIP_HEADER_USER_AGENT_CREATE.
|
||||
* @sa TSIP_HEADER_USER_AGENT_CREATE.
|
||||
*/
|
||||
#define TSIP_HEADER_USER_AGENT_CREATE() tsk_object_new(tsip_header_User_Agent_def_t)
|
||||
#define TSIP_HEADER_USER_AGENT_VA_ARGS(ua) tsip_header_User_Agent_def_t, (const char*)ua
|
||||
#define TSIP_HEADER_USER_AGENT_CREATE(ua) tsk_object_new(TSIP_HEADER_USER_AGENT_VA_ARGS(ua))
|
||||
#define TSIP_HEADER_USER_AGENT_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
|
||||
#define TSIP_HEADER_USER_AGENT_DEFAULT "IM-client/OMA1.0 doubango/v0.0.0"
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @struct
|
||||
///
|
||||
|
|
|
@ -43,8 +43,14 @@
|
|||
* Safely free a sip via header previously created using TSIP_HEADER_VIA_CREATE.
|
||||
* @sa TSIP_HEADER_VIA_CREATE.
|
||||
*/
|
||||
#define TSIP_HEADER_VIA_CREATE() tsk_object_new(tsip_header_Via_def_t)
|
||||
#define TSIP_HEADER_VIA_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
#define TSIP_HEADER_VIA_VA_ARGS(proto_name, proto_version, transport, host, port) tsip_header_Via_def_t, (const char*)proto_name, (const char*)proto_version, (const char*)transport, (const char*)host, (uint16_t)port
|
||||
#define TSIP_HEADER_VIA_CREATE(proto_name, proto_version, transport, host, port) tsk_object_new(TSIP_HEADER_VIA_VA_ARGS(proto_name, proto_version, transport, host, port))
|
||||
#define TSIP_HEADER_VIA_CREATE_NULL() TSIP_HEADER_VIA_CREATE(0, 0, 0, 0, 0)
|
||||
#define TSIP_HEADER_VIA_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
|
||||
#define TSIP_HEADER_VIA_PROTO_NAME_DEFAULT "SIP"
|
||||
#define TSIP_HEADER_VIA_PROTO_VERSION_DEFAULT "2.0"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// @struct tsip_header_Via_s
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "tinysip_config.h"
|
||||
|
||||
|
||||
#define PARSER_SET_STRING(string) \
|
||||
if(!string) \
|
||||
{ \
|
||||
|
@ -90,8 +89,7 @@ typedef struct tsip_ragel_state_s
|
|||
}
|
||||
tsip_ragel_state_t;
|
||||
|
||||
|
||||
TINYSIP_API void tsip_ragel_state_init(tsip_ragel_state_t *state, const char *data, size_t size);
|
||||
|
||||
|
||||
|
||||
#endif /* TINYSIP_RAGEL_STATE_H */
|
||||
#endif /* TINYSIP_RAGEL_STATE_H */
|
||||
|
|
|
@ -17,13 +17,13 @@ struct tsip_dialog_registerContext;
|
|||
struct tsip_dialog_registerState
|
||||
{
|
||||
|
||||
void(*sm_1xx)(struct tsip_dialog_registerContext*);
|
||||
void(*sm_2xx)(struct tsip_dialog_registerContext*, int);
|
||||
void(*sm_300_to_699)(struct tsip_dialog_registerContext*);
|
||||
void(*sm_401_407_421_494)(struct tsip_dialog_registerContext*, int);
|
||||
void(*sm_423)(struct tsip_dialog_registerContext*);
|
||||
void(*sm_1xx)(struct tsip_dialog_registerContext*, const tsip_message_t*);
|
||||
void(*sm_2xx)(struct tsip_dialog_registerContext*, int, const tsip_message_t*);
|
||||
void(*sm_300_to_699)(struct tsip_dialog_registerContext*, const tsip_message_t*);
|
||||
void(*sm_401_407_421_494)(struct tsip_dialog_registerContext*, int, const tsip_message_t*);
|
||||
void(*sm_423)(struct tsip_dialog_registerContext*, const tsip_message_t*);
|
||||
void(*sm_cancel)(struct tsip_dialog_registerContext*);
|
||||
void(*sm_refresh)(struct tsip_dialog_registerContext*);
|
||||
void(*sm_refresh)(struct tsip_dialog_registerContext*, tsk_timer_id_t);
|
||||
void(*sm_send)(struct tsip_dialog_registerContext*);
|
||||
void(*sm_transportError)(struct tsip_dialog_registerContext*);
|
||||
void(*sm_unregister)(struct tsip_dialog_registerContext*);
|
||||
|
@ -45,13 +45,13 @@ struct tsip_dialog_registerContext
|
|||
};
|
||||
|
||||
extern void tsip_dialog_registerContext_Init(struct tsip_dialog_registerContext*, struct tsip_dialog_register*);
|
||||
extern void tsip_dialog_registerContext_sm_1xx(struct tsip_dialog_registerContext*);
|
||||
extern void tsip_dialog_registerContext_sm_2xx(struct tsip_dialog_registerContext*, int);
|
||||
extern void tsip_dialog_registerContext_sm_300_to_699(struct tsip_dialog_registerContext*);
|
||||
extern void tsip_dialog_registerContext_sm_401_407_421_494(struct tsip_dialog_registerContext*, int);
|
||||
extern void tsip_dialog_registerContext_sm_423(struct tsip_dialog_registerContext*);
|
||||
extern void tsip_dialog_registerContext_sm_1xx(struct tsip_dialog_registerContext*, const tsip_message_t*);
|
||||
extern void tsip_dialog_registerContext_sm_2xx(struct tsip_dialog_registerContext*, int, const tsip_message_t*);
|
||||
extern void tsip_dialog_registerContext_sm_300_to_699(struct tsip_dialog_registerContext*, const tsip_message_t*);
|
||||
extern void tsip_dialog_registerContext_sm_401_407_421_494(struct tsip_dialog_registerContext*, int, const tsip_message_t*);
|
||||
extern void tsip_dialog_registerContext_sm_423(struct tsip_dialog_registerContext*, const tsip_message_t*);
|
||||
extern void tsip_dialog_registerContext_sm_cancel(struct tsip_dialog_registerContext*);
|
||||
extern void tsip_dialog_registerContext_sm_refresh(struct tsip_dialog_registerContext*);
|
||||
extern void tsip_dialog_registerContext_sm_refresh(struct tsip_dialog_registerContext*, tsk_timer_id_t);
|
||||
extern void tsip_dialog_registerContext_sm_send(struct tsip_dialog_registerContext*);
|
||||
extern void tsip_dialog_registerContext_sm_transportError(struct tsip_dialog_registerContext*);
|
||||
extern void tsip_dialog_registerContext_sm_unregister(struct tsip_dialog_registerContext*);
|
||||
|
|
|
@ -16,13 +16,14 @@ struct tsip_transac_nictContext;
|
|||
|
||||
struct tsip_transac_nictState
|
||||
{
|
||||
void(*Entry)(struct tsip_transac_nictContext*);
|
||||
|
||||
void(*sm_1xx)(struct tsip_transac_nictContext*);
|
||||
void(*sm_200_to_699)(struct tsip_transac_nictContext*);
|
||||
void(*sm_1xx)(struct tsip_transac_nictContext*, const tsip_message_t*);
|
||||
void(*sm_200_to_699)(struct tsip_transac_nictContext*, const tsip_message_t*);
|
||||
void(*sm_send)(struct tsip_transac_nictContext*);
|
||||
void(*sm_timerE)(struct tsip_transac_nictContext*);
|
||||
void(*sm_timerF)(struct tsip_transac_nictContext*);
|
||||
void(*sm_timerK)(struct tsip_transac_nictContext*);
|
||||
void(*sm_timerE)(struct tsip_transac_nictContext*, tsk_timer_id_t);
|
||||
void(*sm_timerF)(struct tsip_transac_nictContext*, tsk_timer_id_t);
|
||||
void(*sm_timerK)(struct tsip_transac_nictContext*, tsk_timer_id_t);
|
||||
void(*sm_transportError)(struct tsip_transac_nictContext*);
|
||||
|
||||
void(*Default)(struct tsip_transac_nictContext*);
|
||||
|
@ -43,12 +44,13 @@ struct tsip_transac_nictContext
|
|||
};
|
||||
|
||||
extern void tsip_transac_nictContext_Init(struct tsip_transac_nictContext*, struct tsip_transac_nict*);
|
||||
extern void tsip_transac_nictContext_sm_1xx(struct tsip_transac_nictContext*);
|
||||
extern void tsip_transac_nictContext_sm_200_to_699(struct tsip_transac_nictContext*);
|
||||
extern void tsip_transac_nictContext_EnterStartState(struct tsip_transac_nictContext*);
|
||||
extern void tsip_transac_nictContext_sm_1xx(struct tsip_transac_nictContext*, const tsip_message_t*);
|
||||
extern void tsip_transac_nictContext_sm_200_to_699(struct tsip_transac_nictContext*, const tsip_message_t*);
|
||||
extern void tsip_transac_nictContext_sm_send(struct tsip_transac_nictContext*);
|
||||
extern void tsip_transac_nictContext_sm_timerE(struct tsip_transac_nictContext*);
|
||||
extern void tsip_transac_nictContext_sm_timerF(struct tsip_transac_nictContext*);
|
||||
extern void tsip_transac_nictContext_sm_timerK(struct tsip_transac_nictContext*);
|
||||
extern void tsip_transac_nictContext_sm_timerE(struct tsip_transac_nictContext*, tsk_timer_id_t);
|
||||
extern void tsip_transac_nictContext_sm_timerF(struct tsip_transac_nictContext*, tsk_timer_id_t);
|
||||
extern void tsip_transac_nictContext_sm_timerK(struct tsip_transac_nictContext*, tsk_timer_id_t);
|
||||
extern void tsip_transac_nictContext_sm_transportError(struct tsip_transac_nictContext*);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -36,12 +36,47 @@
|
|||
#include "tinysip/tsip_timers.h"
|
||||
#include "tinysip/tsip_message.h"
|
||||
|
||||
#include "tinysip/dialogs/tsip_dialog.h"
|
||||
|
||||
#include "tsk_object.h"
|
||||
#include "tsk_list.h"
|
||||
|
||||
#define TSIP_TRANSAC(self) ((tsip_transac_t*)(self))
|
||||
#define TSIP_TRANSAC_GET_TYPE(self) TSIP_TRANSAC(self)->type
|
||||
|
||||
#define TSIP_TRANSAC_MAGIC_COOKIE "z9hG4bK"
|
||||
|
||||
#define TRANSAC_TIMER_SCHEDULE(name, TX) \
|
||||
self->timer##TX##.id = tsk_timer_manager_schedule((tsk_timer_manager_handle_t*)self->timer_mgr, self->timer##TX##.timeout, TSK_TIMER_CALLBACK(tsip_transac_##name##Context_sm_timer##TX##), &(self->_fsm))
|
||||
|
||||
#define TRANSAC_TIMER_CANCEL(TX) \
|
||||
tsk_timer_manager_cancel((tsk_timer_manager_handle_t*)self->timer_mgr, self->timer##TX##.id)
|
||||
|
||||
typedef enum tsip_transac_event_type_e
|
||||
{
|
||||
tsip_transac_msg,
|
||||
tsip_transac_canceled,
|
||||
tsip_transac_terminated,
|
||||
tsip_transac_timedout,
|
||||
tsip_transac_error,
|
||||
tsip_transac_transport_error
|
||||
}
|
||||
tsip_transac_event_type_t;
|
||||
|
||||
/*typedef struct tsip_transac_event_s
|
||||
{
|
||||
tsip_transac_event_type_t type;
|
||||
const tsip_message_t *msg;
|
||||
}
|
||||
tsip_transac_event_t;
|
||||
|
||||
#define TSIP_TRANSAC_EVENT_INIT(transac_event, type, msg) \
|
||||
transac_event.type = type; \
|
||||
transac_event.msg = msg;*/
|
||||
|
||||
typedef int (*tsip_transac_event_callback)(const void *arg, tsip_transac_event_type_t type, const tsip_message_t *msg);
|
||||
|
||||
|
||||
typedef enum tsip_transac_type_e
|
||||
{
|
||||
tsip_ict, /**< Invite Client Transaction. */
|
||||
|
@ -55,15 +90,24 @@ tsip_transac_type_t;
|
|||
TSK_DECLARE_OBJECT; \
|
||||
\
|
||||
const tsip_stack_handle_t * stack;\
|
||||
const tsk_timer_manager_handle_t *timer_mgr; \
|
||||
\
|
||||
const tsip_dialog_t *dialog; \
|
||||
\
|
||||
tsip_transac_type_t type; \
|
||||
\
|
||||
unsigned reliable:1; \
|
||||
\
|
||||
unsigned running:1; \
|
||||
\
|
||||
char *branch; \
|
||||
\
|
||||
int32_t cseq_value; \
|
||||
char* cseq_method; \
|
||||
\
|
||||
char* callid; \
|
||||
\
|
||||
tsip_transac_event_callback callback; \
|
||||
}
|
||||
|
||||
typedef TSIP_DECLARE_TRANSAC tsip_transac_t;
|
||||
|
@ -71,7 +115,8 @@ typedef TSIP_DECLARE_TRANSAC tsip_transac_t;
|
|||
typedef tsk_list_t tsip_transacs_L_t;
|
||||
|
||||
int tsip_transac_init(tsip_transac_t *self, const tsip_stack_handle_t * stack, tsip_transac_type_t type, unsigned reliable, int32_t cseq_value, const char* cseq_method, const char* callid);
|
||||
int tsip_transac_send(tsip_transac_t *self, const tsip_message_t *msg);
|
||||
int tsip_transac_send(tsip_transac_t *self, const char *branch, const tsip_message_t *msg);
|
||||
int tsip_transac_cmp(const tsip_transac_t *t1, const tsip_transac_t *t2);
|
||||
int tsip_transac_deinit(tsip_transac_t *transac);
|
||||
|
||||
#endif /* TINYSIP_TRANSAC_H */
|
|
@ -35,7 +35,7 @@
|
|||
#include "tsip.h"
|
||||
#include "tinysip/transactions/tsip_transac.h"
|
||||
|
||||
#include "tsk_object.h"
|
||||
#include "tsk_safeobj.h"
|
||||
#include "tsk_list.h"
|
||||
|
||||
#define TSIP_TRANSAC_LAYER_CREATE(stack) tsk_object_new(tsip_transac_layer_def_t, stack)
|
||||
|
@ -48,6 +48,8 @@ typedef struct tsip_transac_layer_s
|
|||
const tsip_stack_handle_t *stack;
|
||||
|
||||
tsip_transacs_L_t *transactions;
|
||||
|
||||
TSK_DECLARE_SAFEOBJ;
|
||||
}
|
||||
tsip_transac_layer_t;
|
||||
|
||||
|
@ -56,5 +58,7 @@ TINYSIP_API const void *tsip_transac_layer_def_t;
|
|||
|
||||
|
||||
const tsip_transac_t* tsip_transac_layer_new(tsip_transac_layer_t *self, const tsip_message_t* msg);
|
||||
int tsip_transac_layer_remove(tsip_transac_layer_t *self, const tsip_transac_t *transac);
|
||||
const tsip_transac_t* tsip_transac_layer_find_client(const tsip_transac_layer_t *self, const char* branch, const char* cseq_method);
|
||||
|
||||
#endif /* TINYSIP_TRANSAC_LAYER_H */
|
|
@ -31,11 +31,13 @@
|
|||
#define TINYSIP_TRANSAC_NICT_H
|
||||
|
||||
#include "tinysip_config.h"
|
||||
#include "tinysip/smc/tsip_transac_nict_sm.h"
|
||||
|
||||
#include "tinysip/transactions/tsip_transac.h"
|
||||
#include "tinysip/tsip_message.h"
|
||||
|
||||
#define TSIP_TRANSAC_NICT_CREATE(stack, type, reliable, cseq_value, cseq_method, callid) tsk_object_new(tsip_transac_nict_def_t, (const tsip_stack_handle_t *)stack, (tsip_transac_type_t)type, (unsigned)reliable, (int32_t)cseq_value, (const char*)cseq_method, (const char*)callid)
|
||||
#include "tinysip/smc/tsip_transac_nict_sm.h"
|
||||
|
||||
#define TSIP_TRANSAC_NICT_CREATE(stack, reliable, cseq_value, cseq_method, callid) tsk_object_new(tsip_transac_nict_def_t, (const tsip_stack_handle_t *)stack, (unsigned)reliable, (int32_t)cseq_value, (const char*)cseq_method, (const char*)callid)
|
||||
#define TSIP_TRANSAC_NICT_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
#define TSIP_TRANSAC_NICT(self) ((tsip_transac_nict_t*)(self))
|
||||
|
@ -46,7 +48,7 @@ typedef struct tsip_transac_nict
|
|||
|
||||
struct tsip_transac_nictContext _fsm; /**< The state machine context. */
|
||||
|
||||
const tsip_request_t* request;
|
||||
tsip_request_t* request;
|
||||
tsip_timer_t timerE;
|
||||
tsip_timer_t timerF;
|
||||
tsip_timer_t timerK;
|
||||
|
@ -54,22 +56,23 @@ typedef struct tsip_transac_nict
|
|||
tsip_transac_nict_t;
|
||||
|
||||
void tsip_transac_nict_init(tsip_transac_nict_t *self);
|
||||
int tsip_transac_nict_start(tsip_transac_nict_t *self, const tsip_request_t* request);
|
||||
int tsip_transac_nict_start(tsip_transac_nict_t *self, tsip_request_t* request);
|
||||
void tsip_transac_nict_OnTerminated(tsip_transac_nict_t *self);
|
||||
|
||||
void tsip_transac_nict_Started_2_Trying_X_send(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Trying_2_Trying_X_timerE(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Trying_2_Terminated_X_timerF(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Trying_2_Terminated_X_transportError(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Trying_2_Proceedding_X_1xx(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Trying_2_Completed_X_200_to_699(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Trying_2_Proceedding_X_1xx(tsip_transac_nict_t *self, const tsip_message_t* msg);
|
||||
void tsip_transac_nict_Trying_2_Completed_X_200_to_699(tsip_transac_nict_t *self, const tsip_message_t* msg);
|
||||
void tsip_transac_nict_Trying_2_Trying_X_unknown(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Proceeding_2_Proceeding_X_timerE(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Proceeding_2_Terminated_X_timerF(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Proceeding_2_Terminated_X_transportError(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Proceeding_2_Proceeding_X_1xx(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Proceeding_2_Completed_X_200_to_699(tsip_transac_nict_t *self);
|
||||
void tsip_transac_nict_Proceeding_2_Proceeding_X_1xx(tsip_transac_nict_t *self, const tsip_message_t* msg);
|
||||
void tsip_transac_nict_Proceeding_2_Completed_X_200_to_699(tsip_transac_nict_t *self, const tsip_message_t* msg);
|
||||
void tsip_transac_nict_Completed_2_Terminated_X_timerK(tsip_transac_nict_t *self);
|
||||
|
||||
void tsip_transac_nict_Any_2_Terminated_X_transportError(tsip_transac_nict_t *self);
|
||||
|
||||
|
||||
TINYSIP_API const void *tsip_transac_nict_def_t;
|
||||
|
|
|
@ -32,24 +32,54 @@
|
|||
|
||||
#include "tinysip_config.h"
|
||||
|
||||
#include "tinysip/tsip_message.h"
|
||||
|
||||
#include "tnet_transport.h"
|
||||
|
||||
#include "tsk_object.h"
|
||||
#include "tsk_list.h"
|
||||
|
||||
|
||||
#define TSIP_TRANSPORT_CREATE(host, port, type, description) tsk_object_new(tsip_transport_def_t, (const char*)host, (tnet_port_t)port, (tnet_socket_type_t)type, (const char*) description)
|
||||
#define TSIP_TRANSPORT_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
#define TSIP_TRANSPORT_IS_SECURE(self) (self && )
|
||||
|
||||
typedef struct tsip_transport_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
||||
tnet_transport_t *net_transport;
|
||||
tnet_fd_t connectedFD;
|
||||
tnet_transport_handle_t *net_transport;
|
||||
|
||||
const char *scheme;
|
||||
const char *protocol;
|
||||
const char *via_protocol;
|
||||
const char *service; /**< NAPTR service name */
|
||||
}
|
||||
tsip_transport_t;
|
||||
|
||||
typedef tsk_list_t tsip_transports_L_t; /**< List of @ref tsip_transport_t elements. */
|
||||
|
||||
size_t tsip_transport_send(const tsip_transport_t* self, const char *branch, tsip_message_t *msg);
|
||||
|
||||
#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_set_callback(transport, callback, callback_data) (transport ? tnet_transport_set_callback(transport->net_transport, callback, callback_data) : -1)
|
||||
|
||||
#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)
|
||||
|
||||
TINYSIP_API const void *tsip_transport_def_t;
|
||||
|
||||
#endif /* TINYSIP_TRANSPORT_H */
|
|
@ -45,11 +45,18 @@ typedef struct tsip_transport_layer_s
|
|||
|
||||
const tsip_stack_handle_t *stack;
|
||||
|
||||
unsigned running:1;
|
||||
tsip_transports_L_t *transports;
|
||||
}
|
||||
tsip_transport_layer_t;
|
||||
|
||||
int tsip_transport_layer_send(const tsip_transport_layer_t* self, const tsip_message_t *msg);
|
||||
int tsip_transport_layer_add(tsip_transport_layer_t* self, const char* host, tnet_port_t port, const char* description);
|
||||
int tsip_transport_layer_remove(tsip_transport_layer_t* self, const char* description);
|
||||
|
||||
int tsip_transport_layer_send(const tsip_transport_layer_t* self, const char *branch, const tsip_message_t *msg);
|
||||
|
||||
int tsip_transport_layer_start(const tsip_transport_layer_t* self);
|
||||
int tsip_transport_layer_shutdown(const tsip_transport_layer_t* self);
|
||||
|
||||
TINYSIP_API const void *tsip_transport_layer_def_t;
|
||||
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
#include "tinysip/headers/tsip_header_Contact.h"
|
||||
#include "tinysip/headers/tsip_header_Content_Length.h"
|
||||
#include "tinysip/headers/tsip_header_CSeq.h"
|
||||
#include "tinysip/headers/tsip_header_From.h"
|
||||
#include "tinysip/headers/tsip_header_Expires.h"
|
||||
#include "tinysip/headers/tsip_header_From.h"
|
||||
#include "tinysip/headers/tsip_header_P_Access_Network_Info.h"
|
||||
#include "tinysip/headers/tsip_header_To.h"
|
||||
#include "tinysip/headers/tsip_header_Via.h"
|
||||
|
||||
|
@ -50,6 +51,8 @@
|
|||
#define TSIP_MESSAGE_IS_REQUEST(self) ((self) ? (self)->type == tsip_request : 0)
|
||||
#define TSIP_MESSAGE_IS_RESPONSE(self) ((self) ? (self)->type == tsip_response : 0)
|
||||
|
||||
#define TSIP_MESSAGE(self) ((tsip_message_t*)(self))
|
||||
#define TSIP_MESSAGE_AS_RESPONSE(self) ((tsip_response_t*)(self))
|
||||
#define TSIP_MESSAGE_AS_REQUEST(self) ((tsip_request_t*)(self))
|
||||
|
||||
|
||||
|
@ -63,7 +66,7 @@
|
|||
* @sa TSIP_MESSAGE_CREATE.
|
||||
*/
|
||||
#define TSIP_MESSAGE_CREATE() tsk_object_new(tsip_message_def_t, (tsip_message_type_t)tsip_unknown)
|
||||
#define TSIP_REQUEST_CREATE(method, uristring) tsk_object_new(tsip_message_def_t, (tsip_message_type_t)tsip_request, (const char*)method, (const char*)uristring)
|
||||
#define TSIP_REQUEST_CREATE(method, uri) tsk_object_new(tsip_message_def_t, (tsip_message_type_t)tsip_request, (const char*)method, (const tsip_uri_t*)uri)
|
||||
#define TSIP_RESPONSE_CREATE(request, status_code, reason_phrase) tsk_object_new(tsip_message_def_t, (tsip_message_type_t)tsip_response, (const tsip_request_t*)request, (short)status, (const char*)phrase)
|
||||
#define TSIP_MESSAGE_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
#define TSIP_REQUEST_SAFE_FREE(self) TSIP_MESSAGE_SAFE_FREE(self)
|
||||
|
@ -100,7 +103,7 @@ tsip_message_type_t;
|
|||
typedef struct tsip_request_line_s
|
||||
{
|
||||
char *method; /**< SIP method name. e.g REGISTER, ACK or INVITE.*/
|
||||
char *uri; /**< The Request-URI is a SIP or SIPS URI as described in Section 19.1 or a general URI (RFC 2396 [5]). It indicates
|
||||
tsip_uri_t *uri; /**< The Request-URI is a SIP or SIPS URI as described in Section 19.1 or a general URI (RFC 2396 [5]). It indicates
|
||||
the user or service to which this request is being addressed. The Request-URI MUST NOT contain unescaped spaces or control
|
||||
characters and MUST NOT be enclosed in "<>". */
|
||||
}
|
||||
|
@ -165,8 +168,33 @@ tsip_message_t;
|
|||
typedef tsip_message_t tsip_request_t; /**< SIP request message. */
|
||||
typedef tsip_message_t tsip_response_t; /**< SIP response message. */
|
||||
|
||||
|
||||
TINYSIP_API int tsip_message_add_header(tsip_message_t *self, const tsip_header_t *hdr);
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
static void TSIP_MESSAGE_ADD_HEADER(tsip_message_t *self, ...)
|
||||
{
|
||||
va_list ap;
|
||||
tsip_header_t *header;
|
||||
const tsk_object_def_t *objdef;
|
||||
|
||||
va_start(ap, self);
|
||||
objdef = va_arg(ap, const tsk_object_def_t*);
|
||||
header = tsk_object_new2(objdef, &ap);
|
||||
va_end(ap);
|
||||
|
||||
tsip_message_add_header(self, header);
|
||||
tsk_object_unref(header);
|
||||
}
|
||||
#else
|
||||
#define TSIP_MESSAGE_ADD_HEADER(self, objdef, ...) \
|
||||
{ \
|
||||
tsip_header_t *header = tsk_object_new(objdef, __VA_ARGS__); \
|
||||
tsip_message_add_header(self, header); \
|
||||
tsk_object_unref(header); \
|
||||
}
|
||||
#endif
|
||||
|
||||
TINYSIP_API tsip_header_t *tsip_message_get_headerAt(const tsip_message_t *self, tsip_header_type_t type, size_t index);
|
||||
TINYSIP_API tsip_header_t *tsip_message_get_header(const tsip_message_t *self, tsip_header_type_t type);
|
||||
TINYSIP_API TSIP_BOOLEAN tsip_message_allowed(const tsip_message_t *self, const char* method);
|
||||
|
@ -180,7 +208,7 @@ TINYSIP_API int32_t tsip_message_getCSeq(const tsip_message_t *message);
|
|||
|
||||
TINYSIP_API int tsip_message_tostring(const tsip_message_t *self, tsk_buffer_t *output);
|
||||
|
||||
TINYSIP_API tsip_request_t *tsip_request_new(const char* method, const char *uristring, const tsip_uri_t *from, const tsip_uri_t *to, const char *call_id);
|
||||
TINYSIP_API tsip_request_t *tsip_request_new(const char* method, const tsip_uri_t *request_uri, const tsip_uri_t *from, const tsip_uri_t *to, const char *call_id, int32_t cseq);
|
||||
|
||||
TINYSIP_API const void *tsip_message_def_t;
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
#define TSIP_OPERATION_CREATE(stack, ...) tsk_object_new(tsip_operation_def_t, stack, __VA_ARGS__)
|
||||
#define TSIP_OPERATION_SAFE_FREE(self) tsk_object_unref(self), self = 0
|
||||
|
||||
typedef uint64_t tsip_operation_id_t;
|
||||
#define TSIP_OPERATION_INVALID_ID 0
|
||||
|
||||
typedef enum tsip_operation_param_type_e
|
||||
{
|
||||
oppname_nvp,
|
||||
|
@ -52,7 +55,8 @@ tsip_operation_param_type_t;
|
|||
|
||||
typedef void tsip_operation_handle_t;
|
||||
|
||||
tsip_operation_handle_t *tsip_operation_clone(const tsip_operation_handle_t *operation);
|
||||
tsip_operation_handle_t *tsip_operation_clone(const tsip_operation_handle_t *self);
|
||||
tsip_operation_id_t tsip_operation_get_id(const tsip_operation_handle_t *self);
|
||||
|
||||
typedef tsk_list_t tsip_operations_L_t; /**< List of @ref tsip_operation_handle_t elements. */
|
||||
TINYSIP_API const void *tsip_operation_def_t;
|
||||
|
|
|
@ -92,7 +92,10 @@ typedef struct tsip_uri_s
|
|||
}
|
||||
tsip_uri_t;
|
||||
|
||||
typedef tsk_list_t tsip_uris_L_t;
|
||||
|
||||
TINYSIP_API int tsip_uri_tostring(const tsip_uri_t *uri, int with_params, int quote, tsk_buffer_t *output);
|
||||
TINYSIP_API tsip_uri_t *tsip_uri_clone(const tsip_uri_t *uri, int with_params, int quote);
|
||||
|
||||
TINYSIP_API const void *tsip_uri_def_t;
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#ifdef __SYMBIAN32__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/* FIXME */
|
||||
#define TINYSAK_IMPORTS
|
||||
|
|
|
@ -32,26 +32,29 @@
|
|||
|
||||
#include "tinysip_config.h"
|
||||
#include "tinysip/tsip_operation.h"
|
||||
#include "tinysip/tsip_timers.h"
|
||||
|
||||
#include "tsk_runnable.h"
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint8_t amf_t[2];
|
||||
typedef uint8_t operator_id_t[16];
|
||||
typedef void tsip_stack_handle_t;
|
||||
|
||||
typedef int (*tsip_stack_callback)(struct tsip_event_s *sipevent);
|
||||
#define TSIP_STACK(self) ((tsip_stack_t*)(self))
|
||||
|
||||
typedef enum tsip_stack_param_type_e
|
||||
{
|
||||
/* Identity */
|
||||
pname_uri,
|
||||
pname_preferred_uri,
|
||||
pname_user_name,
|
||||
pname_display_name,
|
||||
pname_public_identity,
|
||||
pname_private_identity,
|
||||
pname_password,
|
||||
#define TSIP_STACK_SET_URI(STR) pname_uri, (const char*)STR
|
||||
#define TSIP_STACK_SET_PREFERRED_URI(STR) pname_preferred_uri, (const char*)STR
|
||||
#define TSIP_STACK_SET_USER_NAME(STR) pname_user_name, (const char*)STR
|
||||
#define TSIP_STACK_SET_DISPLAY_NAME(STR) pname_display_name, (const char*)STR
|
||||
#define TSIP_STACK_SET_PUBLIC_IDENTITY(URI_STR) pname_public_identity, (const char*)URI_STR
|
||||
#define TSIP_STACK_SET_PRIVATE_IDENTITY(STR) pname_private_identity, (const char*)STR
|
||||
#define TSIP_STACK_SET_PASSWORD(STR) pname_password, (const char*)STR
|
||||
|
||||
/* Network */
|
||||
|
@ -63,7 +66,8 @@ typedef enum tsip_stack_param_type_e
|
|||
pname_amf,
|
||||
pname_netinfo,
|
||||
pname_realm,
|
||||
pname_proxy,
|
||||
pname_proxy_cscf,
|
||||
pname_proxy_cscf_port,
|
||||
#define TSIP_STACK_SET_LOCAL_IP(STR) pname_local_ip, (const char*)STR
|
||||
#define TSIP_STACK_SET_LOCAL_PORT(UINT16) pname_local_port, (uint16_t)UINT16
|
||||
#define TSIP_STACK_SET_ENABLE_IPV6(INT) pname_enable_ipv6, (int)INT
|
||||
|
@ -71,8 +75,9 @@ typedef enum tsip_stack_param_type_e
|
|||
#define TSIP_STACK_SET_POPERATOR_ID(OPERATOR_ID) pname_privacy, (operator_id_t)OPERATOR_ID
|
||||
#define TSIP_STACK_SET_AMF(AMF) pname_amf, (amf_t)AMF
|
||||
#define TSIP_STACK_SET_NETINFO(STR) pname_netinfo, (const char*)STR
|
||||
#define TSIP_STACK_SET_REALM(STR) pname_realm, (const char*)STR
|
||||
#define TSIP_STACK_SET_PROXY(STR) pname_proxy, (const char*)STR
|
||||
#define TSIP_STACK_SET_REALM(FQDN_STR) pname_realm, (const char*)FQDN_STR
|
||||
#define TSIP_STACK_SET_PROXY_CSCF(FQDN_STR) pname_proxy_cscf, (const char*)FQDN_STR
|
||||
#define TSIP_STACK_SET_PROXY_CSCF_PORT(UINT16) pname_proxy_cscf_port, (uint16_t)UINT16
|
||||
|
||||
/* Services */
|
||||
pname_enable_100rel,
|
||||
|
@ -93,26 +98,26 @@ typedef enum tsip_stack_param_type_e
|
|||
}
|
||||
tsip_stack_param_type_t;
|
||||
|
||||
typedef void tsip_stack_handle_t;
|
||||
|
||||
typedef enum tsip_event_type_e
|
||||
{
|
||||
tsip_ack,
|
||||
tsip_bye,
|
||||
tsip_cancel,
|
||||
tsip_message,
|
||||
tsip_notify,
|
||||
tsip_options,
|
||||
tsip_prack,
|
||||
tsip_publish,
|
||||
tsip_refer,
|
||||
tsip_register,
|
||||
tsip_subscribe,
|
||||
tsip_update,
|
||||
tsip_event_ack,
|
||||
tsip_event_bye,
|
||||
tsip_event_cancel,
|
||||
tsip_event_invite,
|
||||
tsip_event_message,
|
||||
tsip_event_notify,
|
||||
tsip_event_options,
|
||||
tsip_event_prack,
|
||||
tsip_event_publish,
|
||||
tsip_event_refer,
|
||||
tsip_event_register,
|
||||
tsip_event_subscribe,
|
||||
tsip_event_update,
|
||||
|
||||
tsip_unpublish,
|
||||
tsip_unregister,
|
||||
tsip_unsubscribe,
|
||||
tsip_event_unpublish,
|
||||
tsip_event_unregister,
|
||||
tsip_event_unsubscribe,
|
||||
|
||||
}
|
||||
tsip_event_type_t;
|
||||
|
@ -131,20 +136,85 @@ typedef struct tsip_event_s
|
|||
tsip_event_t;
|
||||
TINYSIP_API const void *tsip_event_def_t;
|
||||
|
||||
|
||||
typedef int (*tsip_stack_callback)(tsip_event_t *sipevent);
|
||||
|
||||
|
||||
|
||||
typedef struct tsip_stack_s
|
||||
{
|
||||
TSK_DECLARE_RUNNABLE;
|
||||
|
||||
tsip_stack_callback callback;
|
||||
|
||||
/* Identity */
|
||||
char* display_name;
|
||||
struct tsip_uri_s *public_identity;
|
||||
char *private_identity;
|
||||
char *password;
|
||||
|
||||
/* Network */
|
||||
char *local_ip;
|
||||
uint16_t local_port;
|
||||
unsigned enable_ipv6:1;
|
||||
char *privacy;
|
||||
operator_id_t operator_id;
|
||||
amf_t amf;
|
||||
char *netinfo;
|
||||
struct tsip_uri_s *realm;
|
||||
char *proxy_cscf;
|
||||
uint16_t proxy_cscf_port;
|
||||
|
||||
/* Services */
|
||||
unsigned enable_100rel:1;
|
||||
unsigned enable_gsmais:1;
|
||||
unsigned enable_precond:1;
|
||||
unsigned enable_3gppsms:1;
|
||||
unsigned enable_gsmarcs:1;
|
||||
unsigned enable_earlyIMS:1;
|
||||
unsigned enable_ofdr:1;
|
||||
unsigned enable_aa:1;
|
||||
unsigned enable_dnd:1;
|
||||
unsigned enable_option:1;
|
||||
|
||||
/* QoS */
|
||||
|
||||
/* Internals. */
|
||||
tsk_timer_manager_handle_t* timer_mgr;
|
||||
tsip_timers_t timers;
|
||||
tsip_operations_L_t *operations;
|
||||
|
||||
/* Layers */
|
||||
struct tsip_dialog_layer_s *layer_dialog;
|
||||
struct tsip_transac_layer_s *layer_transac;
|
||||
struct tsip_transport_layer_s *layer_transport;
|
||||
}
|
||||
tsip_stack_t;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TINYSIP_API int tsip_global_init();
|
||||
TINYSIP_API int tsip_global_deinit();
|
||||
|
||||
TINYSIP_API tsip_stack_handle_t *tsip_stack_create(tsip_stack_callback callback, ...);
|
||||
TINYSIP_API int tsip_stack_start(tsip_stack_handle_t *self);
|
||||
TINYSIP_API int tsip_stack_set(tsip_stack_handle_t *self, ...);
|
||||
TINYSIP_API int tsip_stack_stop(tsip_stack_handle_t *self);
|
||||
TINYSIP_API int tsip_stack_destroy(tsip_stack_handle_t *self);
|
||||
|
||||
const tsk_timer_manager_handle_t* tsip_stack_get_timer_mgr(const tsip_stack_handle_t *self);
|
||||
struct tsip_dialog_layer_s* tsip_stack_get_dialog_layer(const tsip_stack_handle_t *self);
|
||||
struct tsip_transac_layer_s* tsip_stack_get_transac_layer(const tsip_stack_handle_t *self);
|
||||
struct tsip_transport_layer_s* tsip_stack_get_transport_layer(const tsip_stack_handle_t *self);
|
||||
|
||||
int tsip_stack_register(tsip_stack_handle_t *self, const tsip_operation_handle_t *operation);
|
||||
TINYSIP_API int tsip_stack_register(tsip_stack_handle_t *self, const tsip_operation_handle_t *operation);
|
||||
int tsip_stack_unregister(tsip_stack_handle_t *self, const tsip_operation_handle_t *operation);
|
||||
|
||||
#define TSIP_STACK_EVENT_RAISE(stack, status_code, reason_phrase, incoming, type) \
|
||||
TSK_RUNNABLE_ENQUEUE(TSK_RUNNABLE(stack), (const tsip_stack_handle_t*)stack, (short)status_code, (const char*)reason_phrase, (unsigned)incoming, (tsip_event_type_t)type);
|
||||
|
||||
#endif /* TINYSIP_TSIP_H */
|
||||
#endif /* TINYSIP_TSIP_H */
|
||||
|
|
|
@ -15,7 +15,7 @@ ragel.exe $OPTIONS -o ../source/parsers/tsip_parser_header.c tsip_parser_header.
|
|||
|
||||
|
||||
# ==Allow
|
||||
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Allow.c tsip_parser_header_Allow.rl
|
||||
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Allow.c tsip_parser_header_Allow.rl
|
||||
|
||||
# ==Allow-Events
|
||||
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Allow_Events.c tsip_parser_header_Allow_Events.rl
|
||||
|
@ -24,7 +24,7 @@ ragel.exe $OPTIONS -o ../source/headers/tsip_header_Allow_Events.c tsip_parser_h
|
|||
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Call_ID.c tsip_parser_header_Call_ID.rl
|
||||
|
||||
# ==Content-Length
|
||||
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_Content_Length.c tsip_parser_header_Content_Length.rl
|
||||
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Content_Length.c tsip_parser_header_Content_Length.rl
|
||||
|
||||
# ==Contact
|
||||
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Contact.c tsip_parser_header_Contact.rl
|
||||
|
@ -38,11 +38,14 @@ ragel.exe $OPTIONS -o ../source/headers/tsip_header_Expires.c tsip_parser_header
|
|||
# ==From
|
||||
ragel.exe $OPTIONS -o ../source/headers/tsip_header_From.c tsip_parser_header_From.rl
|
||||
|
||||
# ==Max_Forwards
|
||||
# ==Max-Forwards
|
||||
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Max_Forwards.c tsip_parser_header_Max_Forwards.rl
|
||||
|
||||
# ==Min-Expires
|
||||
ragel.exe $OPTIONS -o ../source/headers/tsip_header_Min_Expires.c tsip_parser_header_Min_Expires.rl
|
||||
|
||||
# ==P-Access-Network-Info
|
||||
#ragel.exe $OPTIONS -o ../source/headers/tsip_header_P_Access_Network_Info.c tsip_parser_header_P_Access_Network_Info.rl
|
||||
ragel.exe $OPTIONS -o ../source/headers/tsip_header_P_Access_Network_Info.c tsip_parser_header_P_Access_Network_Info.rl
|
||||
|
||||
# ==P-Preferred-Identity
|
||||
ragel.exe $OPTIONS -o ../source/headers/tsip_header_P_Preferred_Identity.c tsip_parser_header_P_Preferred_Identity.rl
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
Join = "Join"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Join;
|
||||
Max_Forwards = "Max-Forwards"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Max_Forwards;
|
||||
MIME_Version = "MIME-Version"i SP* HCOLON SP*<: any* :>CRLF @parse_header_MIME_Version;
|
||||
Min_Expires = "Min-SE"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Min_Expires;
|
||||
Min_Expires = "Min-Expires"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Min_Expires;
|
||||
Min_SE = "Min-SE"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Min_SE;
|
||||
Organization = "Organization"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Organization;
|
||||
Path = "Path"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Path;
|
||||
|
|
|
@ -35,13 +35,14 @@
|
|||
message_header = any+ >tag :>CRLF %parse_header;
|
||||
|
||||
# SIP RESPONSE
|
||||
Reason_Phrase = ( reserved | unreserved | escaped | UTF8_NONASCII | UTF8_CONT | SP | HTAB )*;
|
||||
Status_Line = SIP_Version SP Status_Code SP Reason_Phrase CRLF;
|
||||
Reason_Phrase = (( reserved | unreserved | escaped | UTF8_NONASCII | UTF8_CONT | SP | HTAB )*)>tag %parse_reason_phrase;
|
||||
Status_Line = SIP_Version :>SP Status_Code>tag %parse_status_code :>SP Reason_Phrase :>CRLF;
|
||||
Response = Status_Line message_header* CRLF message_body?;
|
||||
|
||||
|
||||
# SIP REQUEST
|
||||
Request_URI = any+ >tag %parse_requesturi;
|
||||
URI = (scheme HCOLON any+)>tag %parse_requesturi;
|
||||
Request_URI = URI;
|
||||
Request_Line = Method>tag %parse_method :>SP Request_URI :>SP SIP_Version :>CRLF;
|
||||
Request = Request_Line message_header* :>CRLF <:message_body? >tag %parse_body;
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "tinysip/headers/tsip_header_Expires.h"
|
||||
#include "tinysip/headers/tsip_header_From.h"
|
||||
#include "tinysip/headers/tsip_header_Max_Forwards.h"
|
||||
#include "tinysip/headers/tsip_header_Min_Expires.h"
|
||||
#include "tinysip/headers/tsip_header_P_Preferred_Identity.h"
|
||||
#include "tinysip/headers/tsip_header_P_Access_Network_Info.h"
|
||||
#include "tinysip/headers/tsip_header_Privacy.h"
|
||||
|
@ -274,7 +275,11 @@
|
|||
# /*== Min-Expires: ==*/
|
||||
action parse_header_Min_Expires
|
||||
{
|
||||
TSK_DEBUG_ERROR("parse_header_Min_Expires NOT IMPLEMENTED");
|
||||
tsip_header_Min_Expires_t *header = tsip_header_Min_Expires_parse(state->tag_start, (state->tag_end-state->tag_start));
|
||||
if(header)
|
||||
{
|
||||
tsk_list_push_back_data(message->headers, ((void**) &header));
|
||||
}
|
||||
}
|
||||
|
||||
# /*== Min-SE: ==*/
|
||||
|
|
|
@ -92,7 +92,7 @@ tsip_header_CSeq_t *tsip_header_CSeq_parse(const char *data, size_t size)
|
|||
const char *p = data;
|
||||
const char *pe = p + size;
|
||||
const char *eof = pe;
|
||||
tsip_header_CSeq_t *hdr_cseq = TSIP_HEADER_CSEQ_CREATE();
|
||||
tsip_header_CSeq_t *hdr_cseq = TSIP_HEADER_CSEQ_CREATE(TSIP_HEADER_CSEQ_NONE, 0);
|
||||
|
||||
const char *tag_start;
|
||||
|
||||
|
@ -127,7 +127,8 @@ static void* tsip_header_CSeq_create(void *self, va_list * app)
|
|||
{
|
||||
CSeq->type = tsip_htype_CSeq;
|
||||
CSeq->tostring = tsip_header_CSeq_tostring;
|
||||
CSeq->seq = -1;
|
||||
CSeq->seq = va_arg(*app, int32_t);
|
||||
CSeq->method = tsk_strdup(va_arg(*app, const char*));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "tsk_debug.h"
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_time.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -86,6 +87,12 @@ 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)
|
||||
{
|
||||
uint64_t epoch = tsk_time_epoch();
|
||||
tsk_itoa(epoch, result);
|
||||
}
|
||||
|
||||
tsip_header_Call_ID_t *tsip_header_Call_ID_parse(const char *data, size_t size)
|
||||
{
|
||||
int cs = 0;
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
my_name_addr = display_name? :>LAQUOT<: URI :>RAQUOT;
|
||||
|
||||
c_p_expires = "expires"i EQUAL delta_seconds>tag %parse_expires;
|
||||
contact_extension = generic_param>tag %parse_param;
|
||||
contact_extension = (generic_param--c_p_expires)>tag %parse_param;
|
||||
contact_params = c_p_expires | contact_extension;
|
||||
contact_param = (( my_name_addr | URI ) ( SEMI contact_params )*) >create_contact %add_contact;
|
||||
Contact = ( "Contact"i | "m"i ) HCOLON ( STAR | ( contact_param ( COMMA contact_param )* ) );
|
||||
|
@ -158,7 +158,10 @@ int tsip_header_Contact_tostring(const void* header, tsk_buffer_t* output)
|
|||
/* Expires */
|
||||
if(contact->expires >=0)
|
||||
{
|
||||
tsk_buffer_appendEx(output, ";expires=%d", contact->expires);
|
||||
tsk_buffer_appendEx(output, ";expires=%d%s",
|
||||
contact->expires,
|
||||
TSK_LIST_IS_EMPTY(contact->params) ? "" : ";"
|
||||
);
|
||||
}
|
||||
|
||||
/* Params */
|
||||
|
|
|
@ -90,7 +90,7 @@ tsip_header_Expires_t *tsip_header_Expires_parse(const char *data, size_t size)
|
|||
const char *p = data;
|
||||
const char *pe = p + size;
|
||||
const char *eof = pe;
|
||||
tsip_header_Expires_t *hdr_expires = TSIP_HEADER_EXPIRES_CREATE();
|
||||
tsip_header_Expires_t *hdr_expires = TSIP_HEADER_EXPIRES_CREATE(TSIP_HEADER_EXPIRES_NONE);
|
||||
|
||||
const char *tag_start;
|
||||
|
||||
|
@ -125,7 +125,7 @@ static void* tsip_header_Expires_create(void *self, va_list * app)
|
|||
{
|
||||
Expires->type = tsip_htype_Expires;
|
||||
Expires->tostring = tsip_header_Expires_tostring;
|
||||
Expires->delta_seconds = -1;
|
||||
Expires->delta_seconds = va_arg(*app, int32_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -90,7 +90,7 @@ tsip_header_Max_Forwards_t *tsip_header_Max_Forwards_parse(const char *data, siz
|
|||
const char *p = data;
|
||||
const char *pe = p + size;
|
||||
const char *eof = pe;
|
||||
tsip_header_Max_Forwards_t *hdr_maxf = TSIP_HEADER_MAX_FORWARDS_CREATE(-1);
|
||||
tsip_header_Max_Forwards_t *hdr_maxf = TSIP_HEADER_MAX_FORWARDS_CREATE(TSIP_HEADER_MAX_FORWARDS_NONE);
|
||||
|
||||
const char *tag_start;
|
||||
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* 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_Min_Expires.c
|
||||
* @brief SIP Min-Expiress header.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinysip/headers/tsip_header_Min_Expires.h"
|
||||
|
||||
#include "tinysip/parsers/tsip_parser_uri.h"
|
||||
|
||||
#include "tsk_debug.h"
|
||||
#include "tsk_memory.h"
|
||||
|
||||
/**@defgroup tsip_header_Min_Expires_group SIP Min-Expires header.
|
||||
*/
|
||||
|
||||
/***********************************
|
||||
* Ragel state machine.
|
||||
*/
|
||||
%%{
|
||||
machine tsip_machine_parser_header_Min_Expires;
|
||||
|
||||
# Includes
|
||||
include tsip_machine_utils "./tsip_machine_utils.rl";
|
||||
|
||||
action tag
|
||||
{
|
||||
TSK_DEBUG_INFO("MIN_EXPIRES:TAG");
|
||||
tag_start = p;
|
||||
}
|
||||
|
||||
action parse_value
|
||||
{
|
||||
PARSER_SET_INTEGER(hdr_minE->value);
|
||||
TSK_DEBUG_INFO("MIN_EXPIRES:PARSE_VALUE");
|
||||
}
|
||||
|
||||
action eob
|
||||
{
|
||||
TSK_DEBUG_INFO("MIN_EXPIRES:EOB");
|
||||
}
|
||||
|
||||
Min_Expires = "Min-Expires"i HCOLON (delta_seconds)>tag %parse_value;
|
||||
|
||||
# Entry point
|
||||
main := Min_Expires :>CRLF @eob;
|
||||
|
||||
}%%
|
||||
|
||||
int tsip_header_Min_Expires_tostring(const void* header, tsk_buffer_t* output)
|
||||
{
|
||||
if(header)
|
||||
{
|
||||
const tsip_header_Min_Expires_t *Min_Expires = header;
|
||||
if(Min_Expires->value >=0)
|
||||
{
|
||||
return tsk_buffer_appendEx(output, "%d", Min_Expires->value);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsip_header_Min_Expires_t *tsip_header_Min_Expires_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_Min_Expires_t *hdr_minE = TSIP_HEADER_MIN_EXPIRES_CREATE_NULL();
|
||||
|
||||
const char *tag_start;
|
||||
|
||||
%%write data;
|
||||
%%write init;
|
||||
%%write exec;
|
||||
|
||||
if( cs < %%{ write first_final; }%% )
|
||||
{
|
||||
TSIP_HEADER_MIN_EXPIRES_SAFE_FREE(hdr_minE);
|
||||
}
|
||||
|
||||
return hdr_minE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//========================================================
|
||||
// Min-Expires header object definition
|
||||
//
|
||||
|
||||
/**@ingroup tsip_header_Min_Expires_group
|
||||
*/
|
||||
static void* tsip_header_Min_Expires_create(void *self, va_list * app)
|
||||
{
|
||||
tsip_header_Min_Expires_t *Min_Expires = self;
|
||||
if(Min_Expires)
|
||||
{
|
||||
Min_Expires->type = tsip_htype_Min_Expires;
|
||||
Min_Expires->tostring = tsip_header_Min_Expires_tostring;
|
||||
Min_Expires->value = va_arg(*app, int32_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
TSK_DEBUG_ERROR("Failed to create new Min_Expires header.");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/**@ingroup tsip_header_Min_Expires_group
|
||||
*/
|
||||
static void* tsip_header_Min_Expires_destroy(void *self)
|
||||
{
|
||||
tsip_header_Min_Expires_t *Min_Expires = self;
|
||||
if(Min_Expires)
|
||||
{
|
||||
}
|
||||
else TSK_DEBUG_ERROR("Null Min_Expires header.");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tsip_header_Min_Expires_def_s =
|
||||
{
|
||||
sizeof(tsip_header_Min_Expires_t),
|
||||
tsip_header_Min_Expires_create,
|
||||
tsip_header_Min_Expires_destroy,
|
||||
0
|
||||
};
|
||||
const void *tsip_header_Min_Expires_def_t = &tsip_header_Min_Expires_def_s;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue