Merge remote-tracking branch 'origin' into dev_codec_downloader

This commit is contained in:
Erwan Croze 2016-06-24 11:44:57 +02:00
commit 8a2be5a50d
188 changed files with 7377 additions and 5152 deletions

View file

@ -40,6 +40,7 @@ option(ENABLE_SHARED "Build shared library." YES)
option(ENABLE_STATIC "Build static library." YES)
option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." YES)
option(ENABLE_DATE "Use build date in internal version number." NO)
cmake_dependent_option(ENABLE_DAEMON "Enable the linphone daemon interface." YES "NOT WIN32" NO)
option(ENABLE_DOC "Enable documentation generation with Doxygen." YES)
option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." YES)
option(ENABLE_LDAP "Enable LDAP support." NO)
@ -75,6 +76,11 @@ macro(apply_compile_flags SOURCE_FILES)
endif()
endmacro()
if(ENABLE_STATIC)
set(LINPHONE_LIBS_FOR_TOOLS linphone-static)
else()
set(LINPHONE_LIBS_FOR_TOOLS linphone)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@ -228,7 +234,12 @@ set(STRICT_OPTIONS_CPP )
set(STRICT_OPTIONS_C )
set(STRICT_OPTIONS_CXX )
set(STRICT_OPTIONS_OBJC )
if(NOT MSVC)
if(MSVC)
list(APPEND STRICT_OPTIONS_CPP "/wd4995") # Disable "name was marked as #pragma deprecated" warnings
if(ENABLE_STRICT)
list(APPEND STRICT_OPTIONS_CPP "/WX")
endif()
else()
list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized" "-Wno-error=deprecated-declarations")
list(APPEND STRICT_OPTIONS_C "-Wdeclaration-after-statement" "-Wstrict-prototypes" "-Wno-error=strict-prototypes")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
@ -290,6 +301,9 @@ add_subdirectory(share)
if(ENABLE_CONSOLE_UI)
add_subdirectory(console)
endif()
if(ENABLE_DAEMON)
add_subdirectory(daemon)
endif()
if(ENABLE_GTK_UI)
add_subdirectory(gtk)
add_subdirectory(pixmaps)

View file

@ -1,48 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblinphone", "liblinphone.vcproj", "{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "linphonec", "linphonec\linphonec.vcproj", "{92574924-BF59-4DAA-994B-9978B80E5797}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|Windows Mobile 6 Professional SDK (ARMV4I) = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
Debug|Windows Mobile 6 Standard SDK (ARMV4I) = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
Release|Win32 = Release|Win32
Release|Windows Mobile 6 Professional SDK (ARMV4I) = Release|Windows Mobile 6 Professional SDK (ARMV4I)
Release|Windows Mobile 6 Standard SDK (ARMV4I) = Release|Windows Mobile 6 Standard SDK (ARMV4I)
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Win32.ActiveCfg = Debug|Win32
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Win32.Build.0 = Debug|Win32
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Win32.ActiveCfg = Release|Win32
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Win32.Build.0 = Release|Win32
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Standard SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
{92574924-BF59-4DAA-994B-9978B80E5797}.Debug|Win32.ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{92574924-BF59-4DAA-994B-9978B80E5797}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{92574924-BF59-4DAA-994B-9978B80E5797}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{92574924-BF59-4DAA-994B-9978B80E5797}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{92574924-BF59-4DAA-994B-9978B80E5797}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{92574924-BF59-4DAA-994B-9978B80E5797}.Release|Win32.ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{92574924-BF59-4DAA-994B-9978B80E5797}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{92574924-BF59-4DAA-994B-9978B80E5797}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{92574924-BF59-4DAA-994B-9978B80E5797}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{92574924-BF59-4DAA-994B-9978B80E5797}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,585 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="liblinphone"
ProjectGUID="{290078F0-3B63-47BF-A2A9-E1AF5411F5E7}"
RootNamespace="liblinphone"
Keyword="Win32Proj"
TargetFrameworkVersion="0"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="Windows Mobile 6 Standard SDK (ARMV4I)"
/>
<Platform
Name="Windows Mobile 6 Professional SDK (ARMV4I)"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;..\..\oRTP\include:..\..\mediastreamer2\include:..\..\..\..\linphone-builder\osip\include:..\..\..\..\linphone-builder\eXosip\include:..\..\..\..\linphone-builder\speex\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBLINPHONE_EXPORTS; OSIP_MT: ENABLE_TRACE:LOG_DOMAIN=\&quot;LinphoneCore\&quot;:ORTP_STATIC:"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"
OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
IntermediateDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="1"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
AdditionalOptions="&#x0D;&#x0A;"
Optimization="0"
AdditionalIncludeDirectories="..\..\oRTP\include;..\..\mediastreamer2\include;&quot;..\..\..\..\linphone-builder\speex\include&quot;;&quot;..\..\..\..\linphone-builder\eXosip\include&quot;;&quot;..\..\..\..\linphone-builder\osip\include&quot;"
PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);LIBLINPHONE_EXPORTS;OSIP_MT;ENABLE_TRACE;LOG_DOMAIN=\&quot;LinphoneCore\&quot;;IN_LINPHONE;LINPHONE_PLUGINS_DIR=\&quot;\&quot;;LINPHONE_VERSION=\&quot;3.1.2\&quot;"
MinimalRebuild="true"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2.lib osip2.lib osipparser2.lib eXosip2.lib mediastreamer2.lib ortp.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;..\..\..\..\linphone-builder\osip\platform\wince\$(PlatformName)\$(ConfigurationName)&quot;;&quot;..\..\oRTP\build\wince\$(PlatformName)\$(ConfigurationName)&quot;"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
IntermediateDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="1"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
AdditionalOptions="&#x0D;&#x0A;"
Optimization="2"
AdditionalIncludeDirectories="..\..\oRTP\include;..\..\mediastreamer2\include;&quot;..\..\..\..\linphone-builder\speex\include&quot;;&quot;..\..\..\..\linphone-builder\eXosip\include&quot;;&quot;..\..\..\..\linphone-builder\osip\include&quot;"
PreprocessorDefinitions="ORTP_INET6;ORTP_EXPORT;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);LIBLINPHONE_EXPORTS;OSIP_MT;ENABLE_TRACE;LOG_DOMAIN=\&quot;LinphoneCore\&quot;;IN_LINPHONE;LINPHONE_PLUGINS_DIR=\&quot;\&quot;;LINPHONE_VERSION=\&quot;3.1.2\&quot;;_UNICODE;UNICODE;PACKAGE_SOUND_DIR=\&quot;\\Program Files\\Linphone\&quot;"
MinimalRebuild="true"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalOptions=""
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\oRTP\include:..\..\mediastreamer2\include:..\..\..\..\linphone-builder\osip\include::..\..\..\..\linphone-builder\eXosip::..\..\..\..\linphone-builder\speex\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBLINPHONE_EXPORTS; OSIP_MT: ENABLE_TRACE:LOG_DOMAIN=\&quot;LinphoneCore\&quot;:ORTP_STATIC:"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
IntermediateDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="1"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
AdditionalIncludeDirectories="..\..\oRTP\include:..\..\mediastreamer2\include:..\..\..\..\linphone-builder\osip\include::..\..\..\..\linphone-builder\eXosip::..\..\..\..\linphone-builder\speex\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBLINPHONE_EXPORTS; OSIP_MT: ENABLE_TRACE:LOG_DOMAIN=\&quot;LinphoneCore\&quot;:ORTP_STATIC:"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
IntermediateDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="1"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
AdditionalIncludeDirectories="..\..\oRTP\include:..\..\mediastreamer2\include:..\..\..\..\linphone-builder\osip\include::..\..\..\..\linphone-builder\eXosip::..\..\..\..\linphone-builder\speex\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBLINPHONE_EXPORTS; OSIP_MT: ENABLE_TRACE:LOG_DOMAIN=\&quot;LinphoneCore\&quot;:ORTP_STATIC:"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\coreapi\enum.h"
>
</File>
<File
RelativePath="..\..\coreapi\exevents.h"
>
</File>
<File
RelativePath="..\..\coreapi\linphonecore.h"
>
</File>
<File
RelativePath="..\..\coreapi\lpconfig.h"
>
</File>
<File
RelativePath="..\..\coreapi\private.h"
>
</File>
<File
RelativePath="..\..\coreapi\sdphandler.h"
>
</File>
<File
RelativePath="..\..\coreapi\sipsetup.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\coreapi\authentication.c"
>
</File>
<File
RelativePath="..\..\coreapi\chat.c"
>
</File>
<File
RelativePath="..\..\coreapi\enum.c"
>
</File>
<File
RelativePath="..\..\coreapi\exevents.c"
>
</File>
<File
RelativePath="..\..\coreapi\friend.c"
>
</File>
<File
RelativePath="..\..\coreapi\general_state.c"
>
</File>
<File
RelativePath="..\..\coreapi\linphonecore.c"
>
</File>
<File
RelativePath="..\..\coreapi\lpconfig.c"
>
</File>
<File
RelativePath="..\..\coreapi\misc.c"
>
</File>
<File
RelativePath="..\..\coreapi\presence.c"
>
</File>
<File
RelativePath="..\..\coreapi\proxy.c"
>
</File>
<File
RelativePath="..\..\coreapi\sdphandler.c"
>
</File>
<File
RelativePath="..\..\coreapi\siplogin.c"
>
</File>
<File
RelativePath="..\..\coreapi\sipsetup.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,240 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="linphonec"
ProjectGUID="{92574924-BF59-4DAA-994B-9978B80E5797}"
RootNamespace="linphonec"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Windows Mobile 6 Professional SDK (ARMV4I)"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="0"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories="&quot;..\..\..\..\..\linphone-builder\osip\include&quot;;..\..\..\mediastreamer2\include;..\..\..\oRTP\include;..\..\..\coreapi"
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);IN_LINPHONE;PACKAGE_DIR=\&quot;\\Program Files\\Linphone\&quot;"
MinimalRebuild="true"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions=" /subsystem:windowsce,5.02"
AdditionalDependencies="mediastreamer2.lib ortp.lib liblinphone.lib ws2.lib mmtimer.lib iphlpapi.lib eXosip2.lib osip2.lib osipparser2.lib"
OutputFile="$(OutDir)/linphonec.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;..\..\..\oRTP\build\wince\$(PlatformName)\$(ConfigurationName)&quot;;&quot;..\..\..\mediastreamer2\build\wince\$(PlatformName)\$(ConfigurationName)&quot;;&quot;..\$(PlatformName)\$(ConfigurationName)&quot;;&quot;..\..\..\..\..\linphone-builder\eXosip\platform\wince\$(PlatformName)\$(ConfigurationName)&quot;;&quot;..\..\..\..\..\linphone-builder\osip\platform\wince\$(PlatformName)\$(ConfigurationName)&quot;"
DelayLoadDLLs="$(NOINHERIT)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/linphonec.pdb"
SubSystem="0"
StackReserveSize="65536"
StackCommitSize="4096"
EntryPointSymbol="mainWCRTStartup"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory="%CSIDL_PROGRAM_FILES%\linphone"
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="2"
FavorSizeOrSpeed="2"
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_CONSOLE;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions=" /subsystem:windowsce,5.02"
OutputFile="$(OutDir)/linphonec.exe"
LinkIncremental="1"
DelayLoadDLLs="$(NOINHERIT)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/linphonec.pdb"
SubSystem="0"
StackReserveSize="65536"
StackCommitSize="4096"
OptimizeReferences="2"
EnableCOMDATFolding="2"
EntryPointSymbol="mainWCRTStartup"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\console\commands.c"
>
</File>
<File
RelativePath="..\..\..\console\linphonec.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\console\linphonec.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -57,7 +57,6 @@ if(@ENABLE_SHARED@)
else()
set(LINPHONE_LIBRARIES linphone-static)
endif()
set(LINPHONE_LDFLAGS @LINK_FLAGS@)
list(APPEND LINPHONE_INCLUDE_DIRS ${MEDIASTREAMER2_INCLUDE_DIRS} ${BELLESIP_INCLUDE_DIRS})
list(APPEND LINPHONE_LIBRARIES ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES})
set(LINPHONE_CPPFLAGS "${MEDIASTREAMER2_CPPFLAGS}")

View file

@ -30,16 +30,28 @@ set(LINPHONECSH_SOURCE_FILES
)
apply_compile_flags(LINPHONEC_SOURCE_FILES "CPP" "C")
if(MSVC)
get_source_file_property(COMMANDS_C_COMPILE_FLAGS commands.c COMPILE_FLAGS)
set(COMMANDS_C_COMPILE_FLAGS "${COMMANDS_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings
set_source_files_properties(commands.c PROPERTY COMPILE_FLAGS "${COMMANDS_C_COMPILE_FLAGS}")
endif()
add_executable(linphonec ${LINPHONEC_SOURCE_FILES})
target_link_libraries(linphonec linphone)
target_link_libraries(linphonec linphone ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
if(INTL_FOUND)
target_link_libraries(linphonec ${INTL_LIBRARIES})
endif()
if(WIN32)
add_executable(linphoned WIN32 ${LINPHONEC_SOURCE_FILES})
target_link_libraries(linphoned linphone)
target_link_libraries(linphoned linphone ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
if(INTL_FOUND)
target_link_libraries(linphoned ${INTL_LIBRARIES})
endif()
endif()
add_executable(linphonecsh ${LINPHONECSH_SOURCE_FILES})
target_link_libraries(linphonecsh linphone)
target_link_libraries(linphonecsh linphone ${ORTP_LIBRARIES})
set(INSTALL_TARGETS linphonec linphonecsh)
if(WIN32)

View file

@ -600,7 +600,7 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
static int
lpc_cmd_calls(LinphoneCore *lc, char *args){
const MSList *calls = linphone_core_get_calls(lc);
const bctbx_list_t *calls = linphone_core_get_calls(lc);
if(calls)
{
lpc_display_call_states(lc);
@ -665,7 +665,7 @@ lpc_cmd_transfer(LinphoneCore *lc, char *args)
int n=sscanf(args,"%255s %265s %li",arg1,arg2,&id2);
if (n==1 || isalpha(*arg1)){
call=linphone_core_get_current_call(lc);
if (call==NULL && ms_list_size(linphone_core_get_calls(lc))==1){
if (call==NULL && bctbx_list_size(linphone_core_get_calls(lc))==1){
call=(LinphoneCall*)linphone_core_get_calls(lc)->data;
}
refer_to=args;
@ -734,7 +734,7 @@ lpc_cmd_terminate(LinphoneCore *lc, char *args)
static int
lpc_cmd_redirect(LinphoneCore *lc, char *args){
const MSList *elem;
const bctbx_list_t *elem;
int didit=0;
if (!args) return 0;
if ((elem=linphone_core_get_calls(lc))==NULL){
@ -780,7 +780,7 @@ static int
lpc_cmd_answer(LinphoneCore *lc, char *args){
if (!args)
{
int nb=ms_list_size(linphone_core_get_calls(lc));
int nb=bctbx_list_size(linphone_core_get_calls(lc));
if (nb==1){
//if just one call is present answer the only one in passing NULL to the linphone_core_accept_call ...
if ( -1 == linphone_core_accept_call(lc, NULL) )
@ -1176,8 +1176,8 @@ lpc_cmd_proxy(LinphoneCore *lc, char *args)
static int
lpc_cmd_call_logs(LinphoneCore *lc, char *args)
{
const MSList *elem=linphone_core_get_call_logs(lc);
for (;elem!=NULL;elem=ms_list_next(elem))
const bctbx_list_t *elem=linphone_core_get_call_logs(lc);
for (;elem!=NULL;elem=bctbx_list_next(elem))
{
LinphoneCallLog *cl=(LinphoneCallLog*)elem->data;
char *str=linphone_call_log_to_str(cl);
@ -1432,7 +1432,7 @@ lpc_cmd_staticpic(LinphoneCore *lc, char *args)
if (strcmp(arg1, "fps")==0) {
if (arg2) {
float fps = atof(arg2); /* FIXME: Handle not-a-float */
float fps = (float)atof(arg2); /* FIXME: Handle not-a-float */
linphone_core_set_static_picture_fps(lc, fps);
return 1;
} else {
@ -1480,8 +1480,8 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
}
else
{
const MSList *calls = linphone_core_get_calls(lc);
int nbcalls=ms_list_size(calls);
const bctbx_list_t *calls = linphone_core_get_calls(lc);
int nbcalls=bctbx_list_size(calls);
if( nbcalls == 1)
{
if(linphone_core_resume_call(lc,calls->data) < 0)
@ -1766,7 +1766,7 @@ linphonec_proxy_display(LinphoneProxyConfig *cfg)
static void linphonec_proxy_show(LinphoneCore *lc, int index)
{
const MSList *elem;
const bctbx_list_t *elem;
int i;
for(elem=linphone_core_get_proxy_config_list(lc),i=0;elem!=NULL;elem=elem->next,++i){
if (index==i){
@ -1781,12 +1781,12 @@ static void linphonec_proxy_show(LinphoneCore *lc, int index)
static void
linphonec_proxy_list(LinphoneCore *lc)
{
const MSList *proxies;
const bctbx_list_t *proxies;
int n;
int def=linphone_core_get_default_proxy(lc,NULL);
proxies=linphone_core_get_proxy_config_list(lc);
for(n=0;proxies!=NULL;proxies=ms_list_next(proxies),n++){
for(n=0;proxies!=NULL;proxies=bctbx_list_next(proxies),n++){
if (n==def)
linphonec_out("****** Proxy %i - this is the default one - *******\n",n);
else
@ -1799,10 +1799,10 @@ linphonec_proxy_list(LinphoneCore *lc)
static void
linphonec_proxy_remove(LinphoneCore *lc, int index)
{
const MSList *proxies;
const bctbx_list_t *proxies;
LinphoneProxyConfig *cfg;
proxies=linphone_core_get_proxy_config_list(lc);
cfg=(LinphoneProxyConfig*)ms_list_nth_data(proxies,index);
cfg=(LinphoneProxyConfig*)bctbx_list_nth_data(proxies,index);
if (cfg==NULL){
linphonec_out("No such proxy.\n");
return;
@ -1814,10 +1814,10 @@ linphonec_proxy_remove(LinphoneCore *lc, int index)
static int
linphonec_proxy_use(LinphoneCore *lc, int index)
{
const MSList *proxies;
const bctbx_list_t *proxies;
LinphoneProxyConfig *cfg;
proxies=linphone_core_get_proxy_config_list(lc);
cfg=(LinphoneProxyConfig*)ms_list_nth_data(proxies,index);
cfg=(LinphoneProxyConfig*)bctbx_list_nth_data(proxies,index);
if (cfg==NULL){
linphonec_out("No such proxy (try 'proxy list').");
return 0;
@ -1841,7 +1841,7 @@ linphonec_friend_display(LinphoneFriend *fr)
static int
linphonec_friend_list(LinphoneCore *lc, char *pat)
{
const MSList *friend;
const bctbx_list_t *friend;
int n;
if (pat) {
@ -1850,7 +1850,7 @@ linphonec_friend_list(LinphoneCore *lc, char *pat)
}
friend = linphone_core_get_friend_list(lc);
for(n=0; friend!=NULL; friend=ms_list_next(friend), ++n )
for(n=0; friend!=NULL; friend=bctbx_list_next(friend), ++n )
{
if ( pat ) {
const char *name = linphone_address_get_display_name(
@ -1867,11 +1867,11 @@ linphonec_friend_list(LinphoneCore *lc, char *pat)
static int
linphonec_friend_call(LinphoneCore *lc, unsigned int num)
{
const MSList *friend = linphone_core_get_friend_list(lc);
const bctbx_list_t *friend = linphone_core_get_friend_list(lc);
unsigned int n;
char *addr;
for(n=0; friend!=NULL; friend=ms_list_next(friend), ++n )
for(n=0; friend!=NULL; friend=bctbx_list_next(friend), ++n )
{
if ( n == num )
{
@ -1904,10 +1904,10 @@ linphonec_friend_add(LinphoneCore *lc, const char *name, const char *addr)
static int
linphonec_friend_delete(LinphoneCore *lc, int num)
{
const MSList *friend = linphone_core_get_friend_list(lc);
const bctbx_list_t *friend = linphone_core_get_friend_list(lc);
unsigned int n;
for(n=0; friend!=NULL; friend=ms_list_next(friend), ++n )
for(n=0; friend!=NULL; friend=bctbx_list_next(friend), ++n )
{
if ( n == num )
{
@ -1941,7 +1941,7 @@ static int lpc_cmd_register(LinphoneCore *lc, char *args){
char proxy[512];
char passwd[512];
LinphoneProxyConfig *cfg;
const MSList *elem;
const bctbx_list_t *elem;
if (!args)
{
@ -2006,7 +2006,7 @@ static int lpc_cmd_unregister(LinphoneCore *lc, char *args){
static int lpc_cmd_duration(LinphoneCore *lc, char *args){
LinphoneCallLog *cl;
const MSList *elem=linphone_core_get_call_logs(lc);
const bctbx_list_t *elem=linphone_core_get_call_logs(lc);
for(;elem!=NULL;elem=elem->next){
if (elem->next==NULL){
cl=(LinphoneCallLog*)elem->data;
@ -2234,7 +2234,7 @@ static int lpc_cmd_codec(int type, LinphoneCore *lc, char *args){
static void linphonec_codec_list(int type, LinphoneCore *lc){
PayloadType *pt;
int index=0;
const MSList *node=NULL;
const bctbx_list_t *node=NULL;
if (type == AUDIO) {
node=linphone_core_get_audio_codecs(lc);
@ -2242,7 +2242,7 @@ static void linphonec_codec_list(int type, LinphoneCore *lc){
node=linphone_core_get_video_codecs(lc);
}
for(;node!=NULL;node=ms_list_next(node)){
for(;node!=NULL;node=bctbx_list_next(node)){
pt=(PayloadType*)(node->data);
linphonec_out("%2d: %s (%d) %s\n", index, pt->mime_type, pt->clock_rate,
linphone_core_payload_type_enabled(lc,pt) ? "enabled" : "disabled");
@ -2253,7 +2253,7 @@ static void linphonec_codec_list(int type, LinphoneCore *lc){
static void linphonec_codec_enable(int type, LinphoneCore *lc, int sel_index){
PayloadType *pt;
int index=0;
const MSList *node=NULL;
const bctbx_list_t *node=NULL;
if (type == AUDIO) {
node=linphone_core_get_audio_codecs(lc);
@ -2261,7 +2261,7 @@ static void linphonec_codec_enable(int type, LinphoneCore *lc, int sel_index){
node=linphone_core_get_video_codecs(lc);
}
for(;node!=NULL;node=ms_list_next(node)){
for(;node!=NULL;node=bctbx_list_next(node)){
if (index == sel_index || sel_index == -1) {
pt=(PayloadType*)(node->data);
linphone_core_enable_payload_type (lc,pt,TRUE);
@ -2274,7 +2274,7 @@ static void linphonec_codec_enable(int type, LinphoneCore *lc, int sel_index){
static void linphonec_codec_disable(int type, LinphoneCore *lc, int sel_index){
PayloadType *pt;
int index=0;
const MSList *node=NULL;
const bctbx_list_t *node=NULL;
if (type == AUDIO) {
node=linphone_core_get_audio_codecs(lc);
@ -2282,7 +2282,7 @@ static void linphonec_codec_disable(int type, LinphoneCore *lc, int sel_index){
node=linphone_core_get_video_codecs(lc);
}
for(;node!=NULL;node=ms_list_next(node)){
for(;node!=NULL;node=bctbx_list_next(node)){
if (index == sel_index || sel_index == -1) {
pt=(PayloadType*)(node->data);
linphone_core_enable_payload_type (lc,pt,FALSE);
@ -2375,7 +2375,7 @@ static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args){
static int lpc_cmd_playback_gain(LinphoneCore *lc, char *args)
{
if (args){
linphone_core_set_playback_gain_db(lc, atof(args));
linphone_core_set_playback_gain_db(lc, (float)atof(args));
return 1;
}
return 0;
@ -2466,7 +2466,7 @@ static void lpc_display_global_state(LinphoneCore *lc){
static void lpc_display_call_states(LinphoneCore *lc){
LinphoneCall *call;
const MSList *elem;
const bctbx_list_t *elem;
char *tmp;
linphonec_out("Call states\n"
"Id | Destination | State | Flags |\n"
@ -2491,7 +2491,7 @@ static void lpc_display_call_states(LinphoneCore *lc){
}
static void lpc_display_proxy_states(LinphoneCore *lc){
const MSList *elem;
const bctbx_list_t *elem;
linphonec_out("Proxy registration states\n"
" Identity | State\n"
"------------------------------------------------------------\n");

View file

@ -37,6 +37,7 @@
#include <linphonecore.h>
#include "linphonec.h"
#include <bctoolbox/bc_vfs.h>
#ifdef _WIN32
#include <ws2tcpip.h>
@ -1206,7 +1207,7 @@ linphonec_parse_cmdline(int argc, char **argv)
if (strcmp(argv[arg_num], "NUL") != 0) {
#endif
#if !defined(_WIN32_WCE)
if (access(argv[arg_num], F_OK) != 0)
if (bctbx_file_exist(argv[arg_num]) != 0)
{
fprintf(stderr,
"Cannot open config file %s.\n",
@ -1223,7 +1224,7 @@ linphonec_parse_cmdline(int argc, char **argv)
{
if ( ++arg_num >= argc ) print_usage(EXIT_FAILURE);
#if !defined(_WIN32_WCE)
if (access(argv[arg_num],F_OK)!=0 )
if (bctbx_file_exist(argv[arg_num])!=0 )
{
fprintf (stderr,
"Cannot open config file %s.\n",
@ -1331,7 +1332,7 @@ handle_configfile_migration()
* If the *NEW* configuration already exists
* do nothing.
*/
if (access(new_cfg,F_OK)==0)
if (bctbx_file_exist(new_cfg)==0)
{
free(new_cfg);
return 0;
@ -1343,7 +1344,7 @@ handle_configfile_migration()
* If the *OLD* CLI configurations exist copy it to
* the new file and make it a symlink.
*/
if (access(old_cfg_cli, F_OK)==0)
if (bctbx_file_exist(old_cfg_cli)==0)
{
if ( ! copy_file(old_cfg_cli, new_cfg) )
{
@ -1364,7 +1365,7 @@ handle_configfile_migration()
* If the *OLD* GUI configurations exist copy it to
* the new file and make it a symlink.
*/
if (access(old_cfg_gui, F_OK)==0)
if (bctbx_file_exist(old_cfg_gui)==0)
{
if ( ! copy_file(old_cfg_gui, new_cfg) )
{

View file

@ -39,6 +39,7 @@
#endif
#include "ortp/ortp.h"
#include <bctoolbox/port.h>
#define DEFAULT_REPLY_SIZE 4096

View file

@ -271,8 +271,8 @@ void sipomatic_uninit(Sipomatic *obj)
void sipomatic_iterate(Sipomatic *obj)
{
MSList *elem;
MSList *to_be_destroyed=NULL;
bctbx_list_t *elem;
bctbx_list_t *to_be_destroyed=NULL;
Call *call;
double elapsed;
eXosip_event_t *ev;
@ -293,13 +293,13 @@ void sipomatic_iterate(Sipomatic *obj)
case CALL_STATE_RUNNING:
if (elapsed>obj->max_call_time || call->eof){
call_release(call);
to_be_destroyed=ms_list_append(to_be_destroyed,call);
to_be_destroyed=bctbx_list_append(to_be_destroyed,call);
}
break;
}
elem=ms_list_next(elem);
elem=bctbx_list_next(elem);
}
for(;to_be_destroyed!=NULL; to_be_destroyed=ms_list_next(to_be_destroyed)){
for(;to_be_destroyed!=NULL; to_be_destroyed=bctbx_list_next(to_be_destroyed)){
call_destroy((Call*)to_be_destroyed->data);
}
}
@ -307,9 +307,9 @@ void sipomatic_iterate(Sipomatic *obj)
Call* sipomatic_find_call(Sipomatic *obj,int did)
{
MSList *it;
bctbx_list_t *it;
Call *call=NULL;
for (it=obj->calls;it!=NULL;it=ms_list_next(it)){
for (it=obj->calls;it!=NULL;it=bctbx_list_next(it)){
call=(Call*)it->data;
if ( call->did==did) return call;
}
@ -351,7 +351,7 @@ Call * call_new(Sipomatic *root, eXosip_event_t *ev)
obj->state=CALL_STATE_INIT;
obj->eof=0;
obj->root=root;
root->calls=ms_list_append(root->calls,obj);
root->calls=bctbx_list_append(root->calls,obj);
return obj;
}
@ -367,7 +367,7 @@ void call_release(Call *call)
void call_destroy(Call *obj)
{
obj->root->calls=ms_list_remove(obj->root->calls,obj);
obj->root->calls=bctbx_list_remove(obj->root->calls,obj);
rtp_profile_destroy(obj->profile);
sdp_context_free(obj->sdpc);
ms_free(obj);

View file

@ -48,6 +48,7 @@ set(LINPHONE_HEADER_FILES
linphone_tunnel.h
lpc2xml.h
lpconfig.h
nat_policy.h
ringtoneplayer.h
sipsetup.h
sqlite3_bctbx_vfs.h
@ -102,6 +103,7 @@ set(LINPHONE_SOURCE_FILES_C
lsd.c
message_storage.c
misc.c
nat_policy.c
offeranswer.c
offeranswer.h
player.c
@ -228,7 +230,7 @@ if(ENABLE_SHARED)
set_target_properties(linphone PROPERTIES SOVERSION ${LINPHONE_SO_VERSION})
endif()
add_dependencies(linphone liblinphone-git-version)
target_link_libraries(linphone ${LIBS})
target_link_libraries(linphone PRIVATE ${LIBS})
if(WIN32 AND CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set_target_properties(linphone PROPERTIES PREFIX "lib")
elseif(ANDROID)
@ -236,8 +238,8 @@ if(ENABLE_SHARED)
add_dependencies(linphone linphonecore-jni-header)
endif()
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/linphone.pdb
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/linphone.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)

View file

@ -42,6 +42,7 @@ linphone_include_HEADERS=\
linphone_tunnel.h \
lpc2xml.h \
lpconfig.h \
nat_policy.h \
sipsetup.h \
sqlite3_bctbx_vfs.h \
xml2lpc.h \
@ -81,6 +82,7 @@ liblinphone_la_SOURCES=\
lsd.c \
message_storage.c \
misc.c \
nat_policy.c \
offeranswer.c offeranswer.h\
player.c \
presence.c \

View file

@ -136,6 +136,8 @@ int TunnelManager::customRecvfrom(struct _RtpTransport *t, mblk_t *msg, int flag
int err=((TunnelSocket*)t->data)->recvfrom(msg->b_wptr,msg->b_datap->db_lim-msg->b_datap->db_base,from,*fromlen);
//to make ice happy
inet_aton(((TunnelManager*)((TunnelSocket*)t->data)->getUserPointer())->mLocalAddr,&msg->recv_addr.addr.ipi_addr);
msg->recv_addr.family = AF_INET;
msg->recv_addr.port = htons((unsigned short)((TunnelSocket*)t->data)->getPort());
if (err>0) return err;
return 0;
}

View file

@ -210,11 +210,11 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_username(LinphoneAccou
bool_t use_phone_number = lp_config_get_int(creator->core->config, "assistant", "use_phone_number", 0);
const char* regex = lp_config_get_string(creator->core->config, "assistant", "username_regex", 0);
LinphoneAccountCreatorStatus status;
if (min_length > 0 && strlen(username) < min_length) {
if (min_length > 0 && strlen(username) < (size_t)min_length) {
return LinphoneAccountCreatorUsernameTooShort;
} else if (max_length > 0 && strlen(username) > max_length) {
} else if (max_length > 0 && strlen(username) > (size_t)max_length) {
return LinphoneAccountCreatorUsernameTooLong;
} else if (fixed_length > 0 && strlen(username) != fixed_length) {
} else if (fixed_length > 0 && strlen(username) != (size_t)fixed_length) {
return LinphoneAccountCreatorUsernameInvalidSize;
} else if (use_phone_number && !linphone_proxy_config_is_phone_number(NULL, username)) {
return LinphoneAccountCreatorUsernameInvalid;
@ -236,9 +236,9 @@ const char * linphone_account_creator_get_username(const LinphoneAccountCreator
LinphoneAccountCreatorStatus linphone_account_creator_set_password(LinphoneAccountCreator *creator, const char *password){
int min_length = lp_config_get_int(creator->core->config, "assistant", "password_min_length", -1);
int max_length = lp_config_get_int(creator->core->config, "assistant", "password_max_length", -1);
if (min_length > 0 && strlen(password) < min_length) {
if (min_length > 0 && strlen(password) < (size_t)min_length) {
return LinphoneAccountCreatorPasswordTooShort;
} else if (max_length > 0 && strlen(password) > max_length) {
} else if (max_length > 0 && strlen(password) > (size_t)max_length) {
return LinphoneAccountCreatorPasswordTooLong;
}
set_string(&creator->password, password, FALSE);

View file

@ -231,7 +231,7 @@ static bool_t realm_match(const char *realm1, const char *realm2){
}
static const LinphoneAuthInfo *find_auth_info(LinphoneCore *lc, const char *username, const char *realm, const char *domain, bool_t ignore_realm){
MSList *elem;
bctbx_list_t *elem;
const LinphoneAuthInfo *ret=NULL;
for (elem=lc->auth_info;elem!=NULL;elem=elem->next) {
@ -286,7 +286,7 @@ const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const cha
/*the auth info is expected to be in the core's list*/
void linphone_core_write_auth_info(LinphoneCore *lc, LinphoneAuthInfo *ai){
int i;
MSList *elem = lc->auth_info;
bctbx_list_t *elem = lc->auth_info;
if (!lc->sip_conf.save_auth_info) return;
@ -298,12 +298,12 @@ void linphone_core_write_auth_info(LinphoneCore *lc, LinphoneAuthInfo *ai){
}
static void write_auth_infos(LinphoneCore *lc){
MSList *elem;
bctbx_list_t *elem;
int i;
if (!linphone_core_ready(lc)) return;
if (!lc->sip_conf.save_auth_info) return;
for(elem=lc->auth_info,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
for(elem=lc->auth_info,i=0;elem!=NULL;elem=bctbx_list_next(elem),i++){
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)(elem->data);
linphone_auth_info_write_config(lc->config,ai,i);
}
@ -321,8 +321,8 @@ LinphoneAuthInfo * linphone_core_create_auth_info(LinphoneCore *lc, const char *
**/
void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info){
LinphoneAuthInfo *ai;
MSList *elem;
MSList *l;
bctbx_list_t *elem;
bctbx_list_t *l;
int restarted_op_count=0;
bool_t updating=FALSE;
@ -333,11 +333,11 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
/* find if we are attempting to modify an existing auth info */
ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain);
if (ai!=NULL && ai->domain && info->domain && strcmp(ai->domain, info->domain)==0){
lc->auth_info=ms_list_remove(lc->auth_info,ai);
lc->auth_info=bctbx_list_remove(lc->auth_info,ai);
linphone_auth_info_destroy(ai);
updating=TRUE;
}
lc->auth_info=ms_list_append(lc->auth_info,linphone_auth_info_clone(info));
lc->auth_info=bctbx_list_append(lc->auth_info,linphone_auth_info_clone(info));
/* retry pending authentication operations */
for(l=elem=sal_get_pending_auths(lc->sal);elem!=NULL;elem=elem->next){
@ -347,14 +347,14 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
ai=(LinphoneAuthInfo*)_linphone_core_find_auth_info(lc,req_sai->realm,req_sai->username,req_sai->domain, FALSE);
if (ai){
SalAuthInfo sai;
MSList* proxy;
bctbx_list_t* proxy;
sai.username=ai->username;
sai.userid=ai->userid;
sai.realm=ai->realm;
sai.password=ai->passwd;
sai.ha1=ai->ha1;
/*proxy case*/
for (proxy=(MSList*)linphone_core_get_proxy_config_list(lc);proxy!=NULL;proxy=proxy->next) {
for (proxy=(bctbx_list_t*)linphone_core_get_proxy_config_list(lc);proxy!=NULL;proxy=proxy->next) {
if (proxy->data == sal_op_get_user_pointer(op)) {
linphone_proxy_config_set_state((LinphoneProxyConfig*)(proxy->data),LinphoneRegistrationProgress,"Authentication...");
break;
@ -375,7 +375,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
info->realm ? info->realm : "",
info->domain ? info->domain : "");
}
ms_list_free(l);
bctbx_list_free(l);
write_auth_infos(lc);
}
@ -394,7 +394,7 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *in
LinphoneAuthInfo *r;
r=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain);
if (r){
lc->auth_info=ms_list_remove(lc->auth_info,r);
lc->auth_info=bctbx_list_remove(lc->auth_info,r);
linphone_auth_info_destroy(r);
write_auth_infos(lc);
}
@ -405,7 +405,7 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *in
* @param[in] lc The LinphoneCore object
* @return \mslist{LinphoneAuthInfo}
**/
const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc){
const bctbx_list_t *linphone_core_get_auth_info_list(const LinphoneCore *lc){
return lc->auth_info;
}
@ -413,14 +413,14 @@ const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc){
* Clear all authentication information.
**/
void linphone_core_clear_all_auth_info(LinphoneCore *lc){
MSList *elem;
bctbx_list_t *elem;
int i;
for(i=0,elem=lc->auth_info;elem!=NULL;elem=ms_list_next(elem),i++){
for(i=0,elem=lc->auth_info;elem!=NULL;elem=bctbx_list_next(elem),i++){
LinphoneAuthInfo *info=(LinphoneAuthInfo*)elem->data;
linphone_auth_info_destroy(info);
linphone_auth_info_write_config(lc->config,NULL,i);
}
ms_list_free(lc->auth_info);
bctbx_list_free(lc->auth_info);
lc->auth_info=NULL;
}

View file

@ -115,8 +115,8 @@ void sal_set_log_level(OrtpLogLevel level) {
}
void sal_add_pending_auth(Sal *sal, SalOp *op){
if (ms_list_find(sal->pending_auths,op)==NULL){
sal->pending_auths=ms_list_append(sal->pending_auths,op);
if (bctbx_list_find(sal->pending_auths,op)==NULL){
sal->pending_auths=bctbx_list_append(sal->pending_auths,op);
op->has_auth_pending=TRUE;
}
}
@ -124,8 +124,8 @@ void sal_add_pending_auth(Sal *sal, SalOp *op){
void sal_remove_pending_auth(Sal *sal, SalOp *op){
if (op->has_auth_pending){
op->has_auth_pending=FALSE;
if (ms_list_find(sal->pending_auths,op)){
sal->pending_auths=ms_list_remove(sal->pending_auths,op);
if (bctbx_list_find(sal->pending_auths,op)){
sal->pending_auths=bctbx_list_remove(sal->pending_auths,op);
}
}
}
@ -593,7 +593,7 @@ void sal_uninit(Sal* sal){
belle_sip_object_unref(sal->stack);
belle_sip_object_unref(sal->listener);
if (sal->supported) belle_sip_object_unref(sal->supported);
ms_list_free_with_data(sal->supported_tags,ms_free);
bctbx_list_free_with_data(sal->supported_tags,ms_free);
if (sal->uuid) ms_free(sal->uuid);
if (sal->root_ca) ms_free(sal->root_ca);
ms_free(sal);
@ -804,8 +804,8 @@ int sal_iterate(Sal *sal){
belle_sip_stack_sleep(sal->stack,0);
return 0;
}
MSList * sal_get_pending_auths(Sal *sal){
return ms_list_copy(sal->pending_auths);
bctbx_list_t * sal_get_pending_auths(Sal *sal){
return bctbx_list_copy(sal->pending_auths);
}
/*misc*/
@ -858,10 +858,10 @@ int sal_get_transport_timeout(const Sal* sal) {
return belle_sip_stack_get_transport_timeout(sal->stack);
}
void sal_set_dns_servers(Sal *sal, const MSList *servers){
void sal_set_dns_servers(Sal *sal, const bctbx_list_t *servers){
belle_sip_list_t *l = NULL;
/*we have to convert the MSList into a belle_sip_list_t first*/
/*we have to convert the bctbx_list_t into a belle_sip_list_t first*/
for (; servers != NULL; servers = servers->next){
l = belle_sip_list_append(l, servers->data);
}
@ -1036,7 +1036,7 @@ int sal_generate_uuid(char *uuid, size_t len) {
written=snprintf(uuid,len,"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", uuid_struct.time_low, uuid_struct.time_mid,
uuid_struct.time_hi_and_version, uuid_struct.clock_seq_hi_and_reserved,
uuid_struct.clock_seq_low);
if (written>len+13){
if ((written < 0) || ((size_t)written > (len +13))) {
ms_error("sal_create_uuid(): buffer is too short !");
return -1;
}
@ -1055,7 +1055,7 @@ int sal_create_uuid(Sal*ctx, char *uuid, size_t len) {
}
static void make_supported_header(Sal *sal){
MSList *it;
bctbx_list_t *it;
char *alltags=NULL;
size_t buflen=64;
size_t written=0;
@ -1080,7 +1080,7 @@ static void make_supported_header(Sal *sal){
}
void sal_set_supported_tags(Sal *ctx, const char* tags){
ctx->supported_tags=ms_list_free_with_data(ctx->supported_tags,ms_free);
ctx->supported_tags=bctbx_list_free_with_data(ctx->supported_tags,ms_free);
if (tags){
char *iter;
char *buffer=ms_strdup(tags);
@ -1089,7 +1089,7 @@ void sal_set_supported_tags(Sal *ctx, const char* tags){
iter=buffer;
while((tag=strtok_r(iter,", ",&context))!=NULL){
iter=NULL;
ctx->supported_tags=ms_list_append(ctx->supported_tags,ms_strdup(tag));
ctx->supported_tags=bctbx_list_append(ctx->supported_tags,ms_strdup(tag));
}
ms_free(buffer);
}
@ -1104,19 +1104,19 @@ const char *sal_get_supported_tags(Sal *ctx){
}
void sal_add_supported_tag(Sal *ctx, const char* tag){
MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,tag);
bctbx_list_t *elem=bctbx_list_find_custom(ctx->supported_tags,(bctbx_compare_func)strcasecmp,tag);
if (!elem){
ctx->supported_tags=ms_list_append(ctx->supported_tags,ms_strdup(tag));
ctx->supported_tags=bctbx_list_append(ctx->supported_tags,ms_strdup(tag));
make_supported_header(ctx);
}
}
void sal_remove_supported_tag(Sal *ctx, const char* tag){
MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,tag);
bctbx_list_t *elem=bctbx_list_find_custom(ctx->supported_tags,(bctbx_compare_func)strcasecmp,tag);
if (elem){
ms_free(elem->data);
ctx->supported_tags=ms_list_remove_link(ctx->supported_tags,elem);
ctx->supported_tags=bctbx_list_remove_link(ctx->supported_tags,elem);
make_supported_header(ctx);
}
}
@ -1154,6 +1154,10 @@ SalResolverContext * sal_resolve_a(Sal* sal, const char *name, int port, int fam
return (SalResolverContext*)belle_sip_stack_resolve_a(sal->stack,name,port,family,(belle_sip_resolver_callback_t)cb,data);
}
SalResolverContext * sal_resolve(Sal *sal, const char *service, const char *transport, const char *name, int port, int family, SalResolverCallback cb, void *data) {
return (SalResolverContext *)belle_sip_stack_resolve(sal->stack, service, transport, name, port, family, (belle_sip_resolver_callback_t)cb, data);
}
/*
void sal_resolve_cancel(Sal *sal, SalResolverContext* ctx){
belle_sip_stack_resolve_cancel(sal->stack,ctx);

View file

@ -70,7 +70,7 @@ static void add_ice_remote_candidates(belle_sdp_media_description_t *md, const S
}
static bool_t is_rtcp_fb_trr_int_the_same_for_all_payloads(const SalStreamDescription *stream, uint16_t *trr_int) {
MSList *pt_it;
bctbx_list_t *pt_it;
bool_t first = TRUE;
for (pt_it = stream->payloads; pt_it != NULL; pt_it = pt_it->next) {
PayloadType *pt = (PayloadType *)pt_it->data;
@ -119,7 +119,7 @@ static void add_rtcp_fb_ccm_attribute(belle_sdp_media_description_t *media_desc,
}
static void add_rtcp_fb_attributes(belle_sdp_media_description_t *media_desc, const SalMediaDescription *md, const SalStreamDescription *stream) {
MSList *pt_it;
bctbx_list_t *pt_it;
PayloadType *pt;
PayloadTypeAvpfParams avpf_params;
bool_t general_trr_int;
@ -191,7 +191,7 @@ static void stream_description_to_sdp ( belle_sdp_session_description_t *session
belle_sdp_mime_parameter_t* mime_param;
belle_sdp_media_description_t* media_desc;
int j;
MSList* pt_it;
bctbx_list_t* pt_it;
PayloadType* pt;
char buffer[1024];
char* dir=NULL;
@ -470,7 +470,7 @@ static void sdp_parse_payload_types(belle_sdp_media_description_t *media_desc, S
pt->channels=belle_sdp_mime_parameter_get_channel_count ( mime_param );
payload_type_set_send_fmtp ( pt,belle_sdp_mime_parameter_get_parameters ( mime_param ) );
payload_type_set_avpf_params(pt, avpf_params);
stream->payloads=ms_list_append ( stream->payloads,pt );
stream->payloads=bctbx_list_append ( stream->payloads,pt );
stream->ptime=belle_sdp_mime_parameter_get_ptime ( mime_param );
ms_message ( "Found payload %s/%i fmtp=%s",pt->mime_type,pt->clock_rate,
pt->send_fmtp ? pt->send_fmtp : "" );
@ -577,7 +577,7 @@ static void sdp_parse_media_ice_parameters(belle_sdp_media_description_t *media_
}
static void enable_avpf_for_stream(SalStreamDescription *stream) {
MSList *pt_it;
bctbx_list_t *pt_it;
for (pt_it = stream->payloads; pt_it != NULL; pt_it = pt_it->next) {
PayloadType *pt = (PayloadType *)pt_it->data;
payload_type_set_flag(pt, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED);
@ -639,7 +639,7 @@ static bool_t sdp_parse_rtcp_fb_parameters(belle_sdp_media_description_t *media_
belle_sip_list_t *it;
belle_sdp_attribute_t *attribute;
belle_sdp_rtcp_fb_attribute_t *fb_attribute;
MSList *pt_it;
bctbx_list_t *pt_it;
PayloadType *pt;
int8_t pt_num;
bool_t retval = FALSE;

View file

@ -74,9 +74,9 @@ static void set_call_log_date(LinphoneCallLog *cl, time_t start_time){
******************************************************************************/
void call_logs_write_to_config_file(LinphoneCore *lc){
MSList *elem;
bctbx_list_t *elem;
char logsection[32];
int i;
unsigned int i;
char *tmp;
LpConfig *cfg=lc->config;
@ -147,7 +147,7 @@ void call_logs_read_from_config_file(LinphoneCore *lc){
cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0);
tmp=lp_config_get_string(cfg,logsection,"call_id",NULL);
if (tmp) cl->call_id=ms_strdup(tmp);
lc->call_logs=ms_list_append(lc->call_logs,cl);
lc->call_logs=bctbx_list_append(lc->call_logs,cl);
}else break;
}
}
@ -414,13 +414,13 @@ void linphone_core_call_log_storage_close(LinphoneCore *lc) {
* | 11 | refkey
*/
static int create_call_log(void *data, int argc, char **argv, char **colName) {
MSList **list = (MSList **)data;
bctbx_list_t **list = (bctbx_list_t **)data;
LinphoneAddress *from;
LinphoneAddress *to;
LinphoneCallDir dir;
LinphoneCallLog *log;
unsigned int storage_id = atoi(argv[0]);
unsigned int storage_id = (unsigned int)atoi(argv[0]);
from = linphone_address_new(argv[1]);
to = linphone_address_new(argv[2]);
@ -436,7 +436,7 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) {
log->connected_date_time = (time_t)atol(argv[6]);
log->status = (LinphoneCallStatus) atoi(argv[7]);
log->video_enabled = atoi(argv[8]) == 1;
log->quality = atof(argv[9]);
log->quality = (float)atof(argv[9]);
if (argc > 10) {
if (argv[10] != NULL) {
@ -447,7 +447,7 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) {
}
}
*list = ms_list_append(*list, log);
*list = bctbx_list_append(*list, log);
return 0;
error:
@ -461,7 +461,7 @@ error:
return 0;
}
static void linphone_sql_request_call_log(sqlite3 *db, const char *stmt, MSList **list) {
static void linphone_sql_request_call_log(sqlite3 *db, const char *stmt, bctbx_list_t **list) {
char* errmsg = NULL;
int ret;
ret = sqlite3_exec(db, stmt, create_call_log, list, &errmsg);
@ -507,41 +507,41 @@ void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
ms_free(from);
ms_free(to);
log->storage_id = sqlite3_last_insert_rowid(lc->logs_db);
log->storage_id = (unsigned int)sqlite3_last_insert_rowid(lc->logs_db);
}
if (lc) {
lc->call_logs = ms_list_prepend(lc->call_logs, linphone_call_log_ref(log));
lc->call_logs = bctbx_list_prepend(lc->call_logs, linphone_call_log_ref(log));
}
}
static void copy_user_data_from_existing_log(MSList *existing_logs, LinphoneCallLog *log) {
static void copy_user_data_from_existing_log(bctbx_list_t *existing_logs, LinphoneCallLog *log) {
while (existing_logs) {
LinphoneCallLog *existing_log = (LinphoneCallLog *)existing_logs->data;
if (existing_log->storage_id == log->storage_id) {
log->user_data = existing_log->user_data;
break;
}
existing_logs = ms_list_next(existing_logs);
existing_logs = bctbx_list_next(existing_logs);
}
}
static void copy_user_data_from_existing_logs(MSList *existing_logs, MSList *new_logs) {
static void copy_user_data_from_existing_logs(bctbx_list_t *existing_logs, bctbx_list_t *new_logs) {
while (new_logs) {
LinphoneCallLog *new_log = (LinphoneCallLog *)new_logs->data;
copy_user_data_from_existing_log(existing_logs, new_log);
new_logs = ms_list_next(new_logs);
new_logs = bctbx_list_next(new_logs);
}
}
const MSList *linphone_core_get_call_history(LinphoneCore *lc) {
const bctbx_list_t *linphone_core_get_call_history(LinphoneCore *lc) {
char *buf;
uint64_t begin,end;
MSList *result = NULL;
bctbx_list_t *result = NULL;
if (!lc || lc->logs_db == NULL) return NULL;
buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC LIMIT %i", lc->max_call_logs);
buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC LIMIT %u", lc->max_call_logs);
begin = ortp_get_cur_time_ms();
linphone_sql_request_call_log(lc->logs_db, buf, &result);
@ -553,7 +553,7 @@ const MSList *linphone_core_get_call_history(LinphoneCore *lc) {
copy_user_data_from_existing_logs(lc->call_logs, result);
}
lc->call_logs = ms_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
lc->call_logs = bctbx_list_free_with_data(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
lc->call_logs = result;
return lc->call_logs;
@ -574,7 +574,7 @@ void linphone_core_delete_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
if (!lc || lc->logs_db == NULL) return ;
buf = sqlite3_mprintf("DELETE FROM call_history WHERE id = %i", log->storage_id);
buf = sqlite3_mprintf("DELETE FROM call_history WHERE id = %u", log->storage_id);
linphone_sql_request_generic(lc->logs_db, buf);
sqlite3_free(buf);
}
@ -600,11 +600,11 @@ int linphone_core_get_call_history_size(LinphoneCore *lc) {
return numrows;
}
MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
bctbx_list_t * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
char *buf;
char *sipAddress;
uint64_t begin,end;
MSList *result = NULL;
bctbx_list_t *result = NULL;
if (!lc || lc->logs_db == NULL || addr == NULL) return NULL;
@ -629,7 +629,7 @@ MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const Linp
LinphoneCallLog * linphone_core_get_last_outgoing_call_log(LinphoneCore *lc) {
char *buf;
uint64_t begin,end;
MSList *list = NULL;
bctbx_list_t *list = NULL;
LinphoneCallLog* result = NULL;
if (!lc || lc->logs_db == NULL) return NULL;
@ -657,7 +657,7 @@ LinphoneCallLog * linphone_core_get_last_outgoing_call_log(LinphoneCore *lc) {
LinphoneCallLog * linphone_core_find_call_log_from_call_id(LinphoneCore *lc, const char *call_id) {
char *buf;
uint64_t begin,end;
MSList *list = NULL;
bctbx_list_t *list = NULL;
LinphoneCallLog* result = NULL;
if (!lc || lc->logs_db == NULL) return NULL;
@ -693,7 +693,7 @@ void linphone_core_call_log_storage_close(LinphoneCore *lc) {
void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
}
const MSList *linphone_core_get_call_history(LinphoneCore *lc) {
const bctbx_list_t *linphone_core_get_call_history(LinphoneCore *lc) {
return NULL;
}
@ -707,7 +707,7 @@ int linphone_core_get_call_history_size(LinphoneCore *lc) {
return 0;
}
MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
bctbx_list_t * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
return NULL;
}

View file

@ -111,12 +111,12 @@ void linphone_call_update_frozen_payloads(LinphoneCall *call, SalMediaDescriptio
SalMediaDescription *local=call->localdesc;
int i;
for(i=0;i<result_desc->nb_streams;++i){
MSList *elem;
bctbx_list_t *elem;
for (elem=result_desc->streams[i].payloads;elem!=NULL;elem=elem->next){
PayloadType *pt=(PayloadType*)elem->data;
if (is_payload_type_number_available(local->streams[i].already_assigned_payloads, payload_type_get_number(pt), NULL)){
/*new codec, needs to be added to the list*/
local->streams[i].already_assigned_payloads=ms_list_append(local->streams[i].already_assigned_payloads, payload_type_clone(pt));
local->streams[i].already_assigned_payloads=bctbx_list_append(local->streams[i].already_assigned_payloads, payload_type_clone(pt));
ms_message("LinphoneCall[%p] : payload type %i %s/%i fmtp=%s added to frozen list.",
call, payload_type_get_number(pt), pt->mime_type, pt->clock_rate, pt->recv_fmtp ? pt->recv_fmtp : "");
}
@ -201,7 +201,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
prepare_early_media_forking(call);
}
linphone_call_start_media_streams(call, target_state);
if (call->state==LinphoneCallPausing && call->paused_by_app && ms_list_size(lc->calls)==1){
if (call->state==LinphoneCallPausing && call->paused_by_app && bctbx_list_size(lc->calls)==1){
linphone_core_play_named_tone(lc,LinphoneToneCallOnHold);
}
linphone_call_update_frozen_payloads(call, new_md);
@ -212,7 +212,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
}
#if 0
static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to){
MSList *elem;
bctbx_list_t *elem;
for(elem=lc->calls;elem!=NULL;elem=elem->next){
LinphoneCall *call=(LinphoneCall*)elem->data;
if (linphone_address_weak_equal(call->log->from,from) &&
@ -225,7 +225,7 @@ static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, c
#endif
static bool_t already_a_call_with_remote_address(const LinphoneCore *lc, const LinphoneAddress *remote) {
MSList *elem;
bctbx_list_t *elem;
ms_message("Searching for already_a_call_with_remote_address.");
for(elem=lc->calls;elem!=NULL;elem=elem->next){
@ -786,7 +786,7 @@ static void call_terminated(SalOp *op, const char *from){
linphone_core_start_refered_call(lc,call,NULL);
}
//we stop the call only if we have this current call or if we are in call
if ((ms_list_size(lc->calls) == 1) || linphone_core_in_call(lc)) {
if ((bctbx_list_size(lc->calls) == 1) || linphone_core_in_call(lc)) {
linphone_core_stop_ringing(lc);
}
linphone_call_stop_media_streams(call);
@ -1088,8 +1088,8 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){
}
static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){
MSList *elem=lc->last_recv_msg_ids;
MSList *tail=NULL;
bctbx_list_t *elem=lc->last_recv_msg_ids;
bctbx_list_t *tail=NULL;
int i;
bool_t is_duplicate=FALSE;
for(i=0;elem!=NULL;elem=elem->next,i++){
@ -1099,11 +1099,11 @@ static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){
tail=elem;
}
if (!is_duplicate){
lc->last_recv_msg_ids=ms_list_prepend(lc->last_recv_msg_ids,ms_strdup(msg_id));
lc->last_recv_msg_ids=bctbx_list_prepend(lc->last_recv_msg_ids,ms_strdup(msg_id));
}
if (i>=10){
ms_free(tail->data);
lc->last_recv_msg_ids=ms_list_remove_link(lc->last_recv_msg_ids,tail);
lc->last_recv_msg_ids=bctbx_list_remove_link(lc->last_recv_msg_ids,tail);
}
return is_duplicate;
}

View file

@ -105,15 +105,15 @@ static void linphone_carddav_response_free(LinphoneCardDavResponse *response) {
ms_free(response);
}
static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, MSList *vCards) {
if (vCards != NULL && ms_list_size(vCards) > 0) {
MSList *friends = cdc->friend_list->friends;
static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, bctbx_list_t *vCards) {
if (vCards != NULL && bctbx_list_size(vCards) > 0) {
bctbx_list_t *friends = cdc->friend_list->friends;
while (vCards) {
LinphoneCardDavResponse *vCard = (LinphoneCardDavResponse *)vCards->data;
if (vCard) {
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(vCard->vcard);
LinphoneFriend *lf = NULL;
MSList *local_friend = NULL;
bctbx_list_t *local_friend = NULL;
if (lvc) {
// Compute downloaded vCards' URL and save it (+ eTag)
@ -126,7 +126,7 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, MSList *
lf = linphone_friend_new_from_vcard(lvc);
if (lf) {
local_friend = ms_list_find_custom(friends, (int (*)(const void*, const void*))find_matching_friend, lf);
local_friend = bctbx_list_find_custom(friends, (int (*)(const void*, const void*))find_matching_friend, lf);
if (local_friend) {
LinphoneFriend *lf2 = (LinphoneFriend *)local_friend->data;
@ -156,15 +156,15 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, MSList *
ms_error("[carddav] Couldn't parse vCard %s", vCard->vcard);
}
}
vCards = ms_list_next(vCards);
vCards = bctbx_list_next(vCards);
}
ms_list_free_with_data(vCards, (void (*)(void *))linphone_carddav_response_free);
bctbx_list_free_with_data(vCards, (void (*)(void *))linphone_carddav_response_free);
}
linphone_carddav_server_to_client_sync_done(cdc, TRUE, NULL);
}
static MSList* parse_vcards_from_xml_response(const char *body) {
MSList *result = NULL;
static bctbx_list_t* parse_vcards_from_xml_response(const char *body) {
bctbx_list_t *result = NULL;
xmlparsing_context_t *xml_ctx = linphone_xmlparsing_context_new();
xmlSetGenericErrorFunc(xml_ctx, linphone_xmlparsing_genericxml_error);
xml_ctx->doc = xmlReadDoc((const unsigned char*)body, 0, NULL, 0);
@ -188,7 +188,7 @@ static MSList* parse_vcards_from_xml_response(const char *body) {
response->etag = ms_strdup(etag);
response->url = ms_strdup(url);
response->vcard = ms_strdup(vcard);
result = ms_list_append(result, response);
result = bctbx_list_append(result, response);
ms_debug("Added vCard object with eTag %s, URL %s and vCard %s", etag, url, vcard);
}
}
@ -209,19 +209,19 @@ static int find_matching_vcard(LinphoneCardDavResponse *response, LinphoneFriend
return strcmp(response->url, linphone_vcard_get_url(lf->vcard));
}
static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, MSList *vCards) {
if (vCards != NULL && ms_list_size(vCards) > 0) {
MSList *friends = cdc->friend_list->friends;
MSList *friends_to_remove = NULL;
MSList *temp_list = NULL;
static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, bctbx_list_t *vCards) {
if (vCards != NULL && bctbx_list_size(vCards) > 0) {
bctbx_list_t *friends = cdc->friend_list->friends;
bctbx_list_t *friends_to_remove = NULL;
bctbx_list_t *temp_list = NULL;
while (friends) {
LinphoneFriend *lf = (LinphoneFriend *)friends->data;
if (lf) {
MSList *vCard = ms_list_find_custom(vCards, (int (*)(const void*, const void*))find_matching_vcard, lf);
bctbx_list_t *vCard = bctbx_list_find_custom(vCards, (int (*)(const void*, const void*))find_matching_vcard, lf);
if (!vCard) {
ms_debug("Local friend %s isn't in the remote vCard list, delete it", linphone_friend_get_name(lf));
temp_list = ms_list_append(temp_list, linphone_friend_ref(lf));
temp_list = bctbx_list_append(temp_list, linphone_friend_ref(lf));
} else {
LinphoneCardDavResponse *response = (LinphoneCardDavResponse *)vCard->data;
ms_debug("Local friend %s is in the remote vCard list, check eTag", linphone_friend_get_name(lf));
@ -230,13 +230,13 @@ static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, MSList
const char *etag = linphone_vcard_get_etag(lvc);
ms_debug("Local friend eTag is %s, remote vCard eTag is %s", etag, response->etag);
if (lvc && etag && strcmp(etag, response->etag) == 0) {
ms_list_remove(vCards, vCard);
bctbx_list_remove(vCards, vCard);
linphone_carddav_response_free(response);
}
}
}
}
friends = ms_list_next(friends);
friends = bctbx_list_next(friends);
}
friends_to_remove = temp_list;
while(friends_to_remove) {
@ -247,17 +247,17 @@ static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, MSList
cdc->contact_removed_cb(cdc, lf);
}
}
friends_to_remove = ms_list_next(friends_to_remove);
friends_to_remove = bctbx_list_next(friends_to_remove);
}
temp_list = ms_list_free_with_data(temp_list, (void (*)(void *))linphone_friend_unref);
temp_list = bctbx_list_free_with_data(temp_list, (void (*)(void *))linphone_friend_unref);
linphone_carddav_pull_vcards(cdc, vCards);
ms_list_free_with_data(vCards, (void (*)(void *))linphone_carddav_response_free);
bctbx_list_free_with_data(vCards, (void (*)(void *))linphone_carddav_response_free);
}
}
static MSList* parse_vcards_etags_from_xml_response(const char *body) {
MSList *result = NULL;
static bctbx_list_t* parse_vcards_etags_from_xml_response(const char *body) {
bctbx_list_t *result = NULL;
xmlparsing_context_t *xml_ctx = linphone_xmlparsing_context_new();
xmlSetGenericErrorFunc(xml_ctx, linphone_xmlparsing_genericxml_error);
xml_ctx->doc = xmlReadDoc((const unsigned char*)body, 0, NULL, 0);
@ -279,7 +279,7 @@ static MSList* parse_vcards_etags_from_xml_response(const char *body) {
LinphoneCardDavResponse *response = ms_new0(LinphoneCardDavResponse, 1);
response->etag = ms_strdup(etag);
response->url = ms_strdup(url);
result = ms_list_append(result, response);
result = bctbx_list_append(result, response);
ms_debug("Added vCard object with eTag %s and URL %s", etag, url);
}
}
@ -396,12 +396,12 @@ static void process_response_from_carddav_request(void *data, const belle_http_r
} else {
// For some reason, server didn't return the eTag of the updated/created vCard
// We need to do a GET on the vCard to get the correct one
MSList *vcard = NULL;
bctbx_list_t *vcard = NULL;
LinphoneCardDavResponse *response = (LinphoneCardDavResponse *)ms_new0(LinphoneCardDavResponse, 1);
response->url = linphone_vcard_get_url(lvc);
vcard = ms_list_append(vcard, response);
vcard = bctbx_list_append(vcard, response);
linphone_carddav_pull_vcards(query->context, vcard);
ms_list_free_with_data(vcard, (void (*)(void *))linphone_carddav_response_free);
bctbx_list_free_with_data(vcard, (void (*)(void *))linphone_carddav_response_free);
}
}
else {
@ -459,7 +459,7 @@ static void process_auth_requested_from_carddav_request(void *data, belle_sip_au
belle_sip_auth_event_set_ha1(event, cdc->auth_info->ha1);
} else {
LinphoneCore *lc = cdc->friend_list->lc;
const MSList *auth_infos = linphone_core_get_auth_info_list(lc);
const bctbx_list_t *auth_infos = linphone_core_get_auth_info_list(lc);
ms_debug("Looking for auth info for domain %s and realm %s", domain, realm);
while (auth_infos) {
@ -473,7 +473,7 @@ static void process_auth_requested_from_carddav_request(void *data, belle_sip_au
break;
}
}
auth_infos = ms_list_next(auth_infos);
auth_infos = bctbx_list_next(auth_infos);
}
if (!auth_infos) {
@ -716,10 +716,10 @@ void linphone_carddav_fetch_vcards(LinphoneCardDavContext *cdc) {
linphone_carddav_send_query(query);
}
static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(LinphoneCardDavContext *cdc, MSList *vcards) {
static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(LinphoneCardDavContext *cdc, bctbx_list_t *vcards) {
LinphoneCardDavQuery *query = (LinphoneCardDavQuery *)ms_new0(LinphoneCardDavQuery, 1);
char *body = (char *)ms_malloc((ms_list_size(vcards) + 1) * 300 * sizeof(char));
MSList *iterator = vcards;
char *body = (char *)ms_malloc((bctbx_list_size(vcards) + 1) * 300 * sizeof(char));
bctbx_list_t *iterator = vcards;
query->context = cdc;
query->depth = "1";
@ -735,7 +735,7 @@ static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(
char temp_body[300];
snprintf(temp_body, sizeof(temp_body), "<d:href>%s</d:href>", response->url);
sprintf(body, "%s%s", body, temp_body);
iterator = ms_list_next(iterator);
iterator = bctbx_list_next(iterator);
}
}
sprintf(body, "%s%s", body, "</card:addressbook-multiget>");
@ -745,7 +745,7 @@ static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(
return query;
}
void linphone_carddav_pull_vcards(LinphoneCardDavContext *cdc, MSList *vcards_to_pull) {
void linphone_carddav_pull_vcards(LinphoneCardDavContext *cdc, bctbx_list_t *vcards_to_pull) {
LinphoneCardDavQuery *query = linphone_carddav_create_addressbook_multiget_query(cdc, vcards_to_pull);
linphone_carddav_send_query(query);
}

View file

@ -114,18 +114,18 @@ void linphone_chat_message_cbs_set_file_transfer_progress_indication(
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneChatMessage);
static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) {
ms_list_free_with_data(cr->transient_messages, (void (*)(void *))linphone_chat_message_release);
bctbx_list_free_with_data(cr->transient_messages, (void (*)(void *))linphone_chat_message_release);
linphone_chat_room_delete_composing_idle_timer(cr);
linphone_chat_room_delete_composing_refresh_timer(cr);
linphone_chat_room_delete_remote_composing_refresh_timer(cr);
if (cr->lc != NULL) {
if (ms_list_find(cr->lc->chatrooms, cr)) {
if (bctbx_list_find(cr->lc->chatrooms, cr)) {
ms_error("LinphoneChatRoom[%p] is destroyed while still being used by the LinphoneCore. This is abnormal."
" linphone_core_get_chat_room() doesn't give a reference, there is no need to call "
"linphone_chat_room_unref(). "
"In order to remove a chat room from the core, use linphone_core_delete_chat_room().",
cr);
cr->lc->chatrooms = ms_list_remove(cr->lc->chatrooms, cr);
cr->lc->chatrooms = bctbx_list_remove(cr->lc->chatrooms, cr);
}
}
linphone_address_destroy(cr->peer_url);
@ -167,7 +167,7 @@ bool_t linphone_core_chat_enabled(const LinphoneCore *lc) {
return lc->chat_deny_code != LinphoneReasonNone;
}
const MSList *linphone_core_get_chat_rooms(LinphoneCore *lc) {
const bctbx_list_t *linphone_core_get_chat_rooms(LinphoneCore *lc) {
return lc->chatrooms;
}
@ -195,7 +195,7 @@ static LinphoneChatRoom *_linphone_core_create_chat_room_base(LinphoneCore *lc,
static LinphoneChatRoom *_linphone_core_create_chat_room(LinphoneCore *lc, LinphoneAddress *addr) {
LinphoneChatRoom *cr = _linphone_core_create_chat_room_base(lc, addr);
lc->chatrooms = ms_list_append(lc->chatrooms, (void *)cr);
lc->chatrooms = bctbx_list_append(lc->chatrooms, (void *)cr);
return cr;
}
@ -216,8 +216,8 @@ static LinphoneChatRoom *_linphone_core_create_chat_room_from_url(LinphoneCore *
LinphoneChatRoom *_linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAddress *addr) {
LinphoneChatRoom *cr = NULL;
MSList *elem;
for (elem = lc->chatrooms; elem != NULL; elem = ms_list_next(elem)) {
bctbx_list_t *elem;
for (elem = lc->chatrooms; elem != NULL; elem = bctbx_list_next(elem)) {
cr = (LinphoneChatRoom *)elem->data;
if (linphone_chat_room_matches(cr, addr)) {
break;
@ -252,8 +252,8 @@ LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAd
}
void linphone_core_delete_chat_room(LinphoneCore *lc, LinphoneChatRoom *cr) {
if (ms_list_find(lc->chatrooms, cr)) {
lc->chatrooms = ms_list_remove(cr->lc->chatrooms, cr);
if (bctbx_list_find(lc->chatrooms, cr)) {
lc->chatrooms = bctbx_list_remove(cr->lc->chatrooms, cr);
linphone_chat_room_delete_history(cr);
linphone_chat_room_unref(cr);
} else {
@ -338,7 +338,7 @@ static void linphone_chat_room_delete_remote_composing_refresh_timer(LinphoneCha
void linphone_chat_room_destroy(LinphoneChatRoom *cr) {
if (cr->received_rtt_characters) {
cr->received_rtt_characters = ms_list_free(cr->received_rtt_characters);
cr->received_rtt_characters = bctbx_list_free(cr->received_rtt_characters);
}
linphone_chat_room_unref(cr);
}
@ -376,18 +376,24 @@ void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage
msg->dir = LinphoneChatMessageOutgoing;
// add to transient list
cr->transient_messages = ms_list_append(cr->transient_messages, linphone_chat_message_ref(msg));
/* Check if we shall upload a file to a server */
if (msg->file_transfer_information != NULL && msg->content_type == NULL) {
/* open a transaction with the server and send an empty request(RCS5.1 section 3.5.4.8.3.1) */
linphone_chat_room_upload_file(msg);
if (linphone_chat_room_upload_file(msg) == 0) {
// add to transient list only if message is going out
cr->transient_messages = bctbx_list_append(cr->transient_messages, linphone_chat_message_ref(msg));
} else {
linphone_chat_message_unref(msg);
return;
}
} else {
SalOp *op = NULL;
LinphoneCall *call=NULL;
char *content_type;
const char *identity = NULL;
// add to transient list
cr->transient_messages = bctbx_list_append(cr->transient_messages, linphone_chat_message_ref(msg));
msg->time = ms_time(0);
if (lp_config_get_int(cr->lc->config, "sip", "chat_use_call_dialogs", 0) != 0) {
if ((call = linphone_core_get_call_by_remote_address(cr->lc, cr->peer)) != NULL) {
@ -484,7 +490,7 @@ void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMe
if (msg->state == LinphoneChatMessageStateDelivered || msg->state == LinphoneChatMessageStateNotDelivered) {
// msg is not transient anymore, we can remove it from our transient list and unref it
msg->chat_room->transient_messages = ms_list_remove(msg->chat_room->transient_messages, msg);
msg->chat_room->transient_messages = bctbx_list_remove(msg->chat_room->transient_messages, msg);
linphone_chat_message_unref(msg);
}
}
@ -909,7 +915,7 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
cmc->value = character;
cmc->has_been_read = FALSE;
cr->received_rtt_characters = ms_list_append(cr->received_rtt_characters, (void *)cmc);
cr->received_rtt_characters = bctbx_list_append(cr->received_rtt_characters, (void *)cmc);
cr->remote_is_composing = LinphoneIsComposingActive;
linphone_core_notify_is_composing_received(cr->lc, cr);
@ -939,7 +945,7 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
linphone_chat_room_message_received(cr, lc, msg);
linphone_chat_message_unref(msg);
cr->pending_message = NULL;
cr->received_rtt_characters = ms_list_free(cr->received_rtt_characters);
cr->received_rtt_characters = bctbx_list_free(cr->received_rtt_characters);
} else {
char *value = utf8_to_char(character);
cr->pending_message->message = ms_strcat_printf(cr->pending_message->message, value);
@ -951,14 +957,14 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c
uint32_t linphone_chat_room_get_char(const LinphoneChatRoom *cr) {
if (cr && cr->received_rtt_characters) {
MSList *characters = cr->received_rtt_characters;
bctbx_list_t *characters = cr->received_rtt_characters;
while (characters != NULL) {
LinphoneChatMessageCharacter *cmc = (LinphoneChatMessageCharacter *)characters->data;
if (!cmc->has_been_read) {
cmc->has_been_read = TRUE;
return cmc->value;
}
characters = ms_list_next(characters);
characters = bctbx_list_next(characters);
}
}
return 0;

View file

@ -291,20 +291,22 @@ static void linphone_chat_message_process_response_from_post_file(void *data,
msg->message = ms_strdup(body);
}
msg->content_type = ms_strdup("application/vnd.gsma.rcs-ft-http+xml");
linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferDone);
linphone_chat_message_ref(msg);
linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferDone);
_release_http_request(msg);
_linphone_chat_room_send_message(msg->chat_room, msg);
linphone_chat_message_unref(msg);
} else {
ms_warning("Received empty response from server, file transfer failed");
linphone_chat_message_set_state(msg, LinphoneChatMessageStateNotDelivered);
linphone_chat_message_update_state(msg, LinphoneChatMessageStateNotDelivered);
_release_http_request(msg);
linphone_chat_message_unref(msg);
}
} else {
ms_warning("Unhandled HTTP code response %d for file transfer", code);
linphone_chat_message_set_state(msg, LinphoneChatMessageStateNotDelivered);
linphone_chat_message_update_state(msg, LinphoneChatMessageStateNotDelivered);
_release_http_request(msg);
linphone_chat_message_unref(msg);
}
}
}

View file

@ -458,7 +458,7 @@ int LocalConference::remoteParticipantsCount() {
int LocalConference::convertConferenceToCall(){
int err=0;
MSList *calls=m_core->calls;
bctbx_list_t *calls=m_core->calls;
if (remoteParticipantsCount()!=1){
ms_error("No unique call remaining in conference.");
@ -506,7 +506,7 @@ int LocalConference::removeParticipant(const LinphoneAddress *uri) {
}
int LocalConference::terminate() {
MSList *calls=m_core->calls;
bctbx_list_t *calls=m_core->calls;
m_terminating =TRUE;
while (calls) {
@ -924,7 +924,7 @@ LinphoneConferenceParams *linphone_conference_params_clone(const LinphoneConfere
}
void linphone_conference_params_enable_video(LinphoneConferenceParams *params, bool_t enable) {
((Conference::Params *)params)->enableVideo(enable);
((Conference::Params *)params)->enableVideo((enable == TRUE) ? true : false);
}
bool_t linphone_conference_params_video_requested(const LinphoneConferenceParams *params) {
@ -994,7 +994,7 @@ AudioStream *linphone_conference_get_audio_stream(const LinphoneConference *obj)
}
int linphone_conference_mute_microphone(LinphoneConference *obj, bool_t val) {
return ((Conference *)obj)->muteMicrophone(val);
return ((Conference *)obj)->muteMicrophone((val == TRUE) ? true : false);
}
bool_t linphone_conference_microphone_is_muted(const LinphoneConference *obj) {
@ -1009,12 +1009,12 @@ int linphone_conference_get_size(const LinphoneConference *obj) {
return ((Conference *)obj)->getSize();
}
MSList *linphone_conference_get_participants(const LinphoneConference *obj) {
bctbx_list_t *linphone_conference_get_participants(const LinphoneConference *obj) {
const list<Conference::Participant *> &participants = ((Conference *)obj)->getParticipants();
MSList *participants_list = NULL;
bctbx_list_t *participants_list = NULL;
for(list<Conference::Participant *>::const_iterator it=participants.begin();it!=participants.end();it++) {
LinphoneAddress *uri = linphone_address_clone((*it)->getUri());
participants_list = ms_list_append(participants_list, uri);
participants_list = bctbx_list_append(participants_list, uri);
}
return participants_list;
}
@ -1028,7 +1028,7 @@ int linphone_conference_stop_recording(LinphoneConference *obj) {
}
void linphone_conference_on_call_stream_starting(LinphoneConference *obj, LinphoneCall *call, bool_t is_paused_by_remote) {
((Conference *)obj)->onCallStreamStarting(call, is_paused_by_remote);
((Conference *)obj)->onCallStreamStarting(call, (is_paused_by_remote == TRUE) ? true : false);
}
void linphone_conference_on_call_stream_stopping(LinphoneConference *obj, LinphoneCall *call) {

View file

@ -97,12 +97,12 @@ LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *o
/**
* Get URIs of all participants of one conference
* The returned MSList contains URIs of all participant. That list must be
* The returned bctbx_list_t contains URIs of all participant. That list must be
* freed after use and each URI must be unref with linphone_address_unref()
* @param obj A #LinphoneConference
* @return \mslist{LinphoneAddress}
*/
LINPHONE_PUBLIC MSList *linphone_conference_get_participants(const LinphoneConference *obj);
LINPHONE_PUBLIC bctbx_list_t *linphone_conference_get_participants(const LinphoneConference *obj);
/**
* @}

View file

@ -93,12 +93,12 @@ static int friend_compare(const void * a, const void * b){
}
MSList *linphone_find_friend_by_address(MSList *fl, const LinphoneAddress *addr, LinphoneFriend **lf){
MSList *res=NULL;
bctbx_list_t *linphone_find_friend_by_address(bctbx_list_t *fl, const LinphoneAddress *addr, LinphoneFriend **lf){
bctbx_list_t *res=NULL;
LinphoneFriend dummy;
if (lf!=NULL) *lf=NULL;
dummy.uri=(LinphoneAddress*)addr;
res=ms_list_find_custom(fl,friend_compare,&dummy);
res=bctbx_list_find_custom(fl,friend_compare,&dummy);
if (lf!=NULL && res!=NULL) *lf=(LinphoneFriend*)res->data;
return res;
}
@ -133,6 +133,14 @@ LinphoneFriend * linphone_friend_new(void){
return obj;
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
LinphoneFriend *linphone_friend_new_with_address(const char *addr){
LinphoneAddress* linphone_address = linphone_address_new(addr);
LinphoneFriend *fr;
@ -146,6 +154,9 @@ LinphoneFriend *linphone_friend_new_with_address(const char *addr){
linphone_address_unref(linphone_address);
return fr;
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
void linphone_friend_set_user_data(LinphoneFriend *lf, void *data){
lf->user_data=data;
@ -234,11 +245,11 @@ void linphone_friend_add_address(LinphoneFriend *lf, const LinphoneAddress *addr
linphone_vcard_add_sip_address(vcard, linphone_address_as_string_uri_only(addr));
}
MSList* linphone_friend_get_addresses(LinphoneFriend *lf) {
bctbx_list_t* linphone_friend_get_addresses(LinphoneFriend *lf) {
LinphoneVcard *vcard = NULL;
MSList *sipAddresses = NULL;
MSList *addresses = NULL;
MSList *iterator = NULL;
bctbx_list_t *sipAddresses = NULL;
bctbx_list_t *addresses = NULL;
bctbx_list_t *iterator = NULL;
if (!lf) {
return NULL;
@ -246,7 +257,7 @@ MSList* linphone_friend_get_addresses(LinphoneFriend *lf) {
vcard = linphone_friend_get_vcard(lf);
if (!vcard) {
return lf->uri ? ms_list_append(addresses, lf->uri) : NULL;
return lf->uri ? bctbx_list_append(addresses, lf->uri) : NULL;
}
sipAddresses = linphone_vcard_get_sip_addresses(vcard);
@ -255,11 +266,11 @@ MSList* linphone_friend_get_addresses(LinphoneFriend *lf) {
const char *sipAddress = (const char *)iterator->data;
LinphoneAddress *addr = linphone_address_new(sipAddress);
if (addr) {
addresses = ms_list_append(addresses, addr);
addresses = bctbx_list_append(addresses, addr);
}
iterator = ms_list_next(iterator);
iterator = bctbx_list_next(iterator);
}
if (sipAddresses) ms_list_free(sipAddresses);
if (sipAddresses) bctbx_list_free(sipAddresses);
return addresses;
}
@ -291,7 +302,7 @@ void linphone_friend_add_phone_number(LinphoneFriend *lf, const char *phone) {
linphone_vcard_add_phone_number(vcard, phone);
}
MSList* linphone_friend_get_phone_numbers(LinphoneFriend *lf) {
bctbx_list_t* linphone_friend_get_phone_numbers(LinphoneFriend *lf) {
LinphoneVcard *vcard = NULL;
if (!lf) {
@ -359,7 +370,7 @@ int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscri
}
void linphone_friend_notify(LinphoneFriend *lf, LinphonePresenceModel *presence){
MSList *elem;
bctbx_list_t *elem;
if (lf->insubs){
char *addr=linphone_address_as_string(linphone_friend_get_address(lf));
ms_message("Want to notify %s",addr);
@ -373,13 +384,13 @@ void linphone_friend_notify(LinphoneFriend *lf, LinphonePresenceModel *presence)
void linphone_friend_add_incoming_subscription(LinphoneFriend *lf, SalOp *op){
/*ownership of the op is transfered from sal to the LinphoneFriend*/
lf->insubs = ms_list_append(lf->insubs, op);
lf->insubs = bctbx_list_append(lf->insubs, op);
}
void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, SalOp *op){
if (ms_list_find(lf->insubs, op)){
if (bctbx_list_find(lf->insubs, op)){
sal_op_release(op);
lf->insubs = ms_list_remove(lf->insubs, op);
lf->insubs = bctbx_list_remove(lf->insubs, op);
}
}
@ -413,12 +424,12 @@ void linphone_friend_invalidate_subscription(LinphoneFriend *lf){
void linphone_friend_close_subscriptions(LinphoneFriend *lf){
linphone_friend_unsubscribe(lf);
ms_list_for_each(lf->insubs, (MSIterateFunc) sal_notify_presence_close);
lf->insubs = ms_list_free_with_data(lf->insubs, (MSIterateFunc)sal_op_release);
bctbx_list_for_each(lf->insubs, (MSIterateFunc) sal_notify_presence_close);
lf->insubs = bctbx_list_free_with_data(lf->insubs, (MSIterateFunc)sal_op_release);
}
static void _linphone_friend_release_ops(LinphoneFriend *lf){
lf->insubs = ms_list_free_with_data(lf->insubs, (MSIterateFunc) sal_op_release);
lf->insubs = bctbx_list_free_with_data(lf->insubs, (MSIterateFunc) sal_op_release);
if (lf->outsub){
sal_op_release(lf->outsub);
lf->outsub=NULL;
@ -666,7 +677,7 @@ void linphone_friend_done(LinphoneFriend *fr) {
if (fr && fr->vcard) {
if (linphone_vcard_compare_md5_hash(fr->vcard) != 0) {
ms_debug("vCard's md5 has changed, mark friend as dirty");
fr->friend_list->dirty_friends_to_update = ms_list_append(fr->friend_list->dirty_friends_to_update, linphone_friend_ref(fr));
fr->friend_list->dirty_friends_to_update = bctbx_list_append(fr->friend_list->dirty_friends_to_update, linphone_friend_ref(fr));
}
}
}
@ -674,7 +685,11 @@ void linphone_friend_done(LinphoneFriend *fr) {
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
LinphoneFriend * linphone_core_create_friend(LinphoneCore *lc) {
LinphoneFriend * lf = linphone_friend_new();
lf->lc = lc;
@ -693,9 +708,9 @@ LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, cons
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) {
if (linphone_friend_list_add_friend(linphone_core_get_default_friend_list(lc), lf) != LinphoneFriendListOK) return;
if (ms_list_find(lc->subscribers, lf)) {
if (bctbx_list_find(lc->subscribers, lf)) {
/*if this friend was in the pending subscriber list, now remove it from this list*/
lc->subscribers = ms_list_remove(lc->subscribers, lf);
lc->subscribers = bctbx_list_remove(lc->subscribers, lf);
linphone_friend_unref(lf);
}
}
@ -709,11 +724,11 @@ void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *lf) {
}
void linphone_core_update_friends_subscriptions(LinphoneCore *lc, LinphoneProxyConfig *cfg, bool_t only_when_registered) {
MSList *lists = lc->friends_lists;
bctbx_list_t *lists = lc->friends_lists;
while (lists) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
linphone_friend_list_update_subscriptions(list, cfg, only_when_registered);
lists = ms_list_next(lists);
lists = bctbx_list_next(lists);
}
}
@ -722,10 +737,10 @@ bool_t linphone_core_should_subscribe_friends_only_when_registered(const Linphon
}
void linphone_core_send_initial_subscribes(LinphoneCore *lc) {
MSList *lists = lc->friends_lists;
bctbx_list_t *lists = lc->friends_lists;
bool_t proxy_config_for_rls_presence_uri_domain = FALSE;
LinphoneAddress *rls_address = NULL;
const MSList *elem;
const bctbx_list_t *elem;
if (lc->initial_subscribes_sent) return;
lc->initial_subscribes_sent=TRUE;
@ -753,16 +768,16 @@ void linphone_core_send_initial_subscribes(LinphoneCore *lc) {
} else {
linphone_core_update_friends_subscriptions(lc,NULL,linphone_core_should_subscribe_friends_only_when_registered(lc));
}
lists = ms_list_next(lists);
lists = bctbx_list_next(lists);
}
}
void linphone_core_invalidate_friend_subscriptions(LinphoneCore *lc) {
MSList *lists = lc->friends_lists;
bctbx_list_t *lists = lc->friends_lists;
while (lists) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
linphone_friend_list_invalidate_subscriptions(list);
lists = ms_list_next(lists);
lists = bctbx_list_next(lists);
}
lc->initial_subscribes_sent=FALSE;
}
@ -785,56 +800,56 @@ const char *linphone_friend_get_ref_key(const LinphoneFriend *lf){
}
LinphoneFriend *linphone_core_find_friend(const LinphoneCore *lc, const LinphoneAddress *addr) {
MSList *lists = lc->friends_lists;
bctbx_list_t *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_address(list, addr);
lists = ms_list_next(lists);
lists = bctbx_list_next(lists);
}
return lf;
}
LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *uri) {
MSList *lists = lc->friends_lists;
bctbx_list_t *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_uri(list, uri);
lists = ms_list_next(lists);
lists = bctbx_list_next(lists);
}
return lf;
}
LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key) {
MSList *lists = lc->friends_lists;
bctbx_list_t *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_ref_key(list, key);
lists = ms_list_next(lists);
lists = bctbx_list_next(lists);
}
return lf;
}
LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *lc, SalOp *op) {
MSList *lists = lc->friends_lists;
bctbx_list_t *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_out_subscribe(list, op);
lists = ms_list_next(lists);
lists = bctbx_list_next(lists);
}
return lf;
}
LinphoneFriend *linphone_core_find_friend_by_inc_subscribe(const LinphoneCore *lc, SalOp *op) {
MSList *lists = lc->friends_lists;
bctbx_list_t *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_inc_subscribe(list, op);
lists = ms_list_next(lists);
lists = bctbx_list_next(lists);
}
return lf;
}
@ -856,7 +871,7 @@ LinphoneSubscribePolicy __policy_str_to_enum(const char* pol){
}
LinphoneProxyConfig *__index_to_proxy(LinphoneCore *lc, int index){
if (index>=0) return (LinphoneProxyConfig*)ms_list_nth_data(lc->sip_conf.proxies,index);
if (index>=0) return (LinphoneProxyConfig*)bctbx_list_nth_data(lc->sip_conf.proxies,index);
else return NULL;
}
@ -941,14 +956,14 @@ void linphone_friend_write_to_config_file(LpConfig *config, LinphoneFriend *lf,
}
void linphone_core_write_friends_config(LinphoneCore* lc) {
MSList *elem;
bctbx_list_t *elem;
int i;
int store_friends;
if (! linphone_core_ready(lc)) return; /*dont write config when reading it !*/
store_friends = lp_config_get_int(lc->config, "misc", "store_friends", 1);
if (store_friends) {
for (elem=linphone_core_get_default_friend_list(lc)->friends,i=0; elem!=NULL; elem=ms_list_next(elem),i++){
for (elem=linphone_core_get_default_friend_list(lc)->friends,i=0; elem!=NULL; elem=bctbx_list_next(elem),i++){
linphone_friend_write_to_config_file(lc->config,(LinphoneFriend*)elem->data,i);
}
linphone_friend_write_to_config_file(lc->config,NULL,i); /* set the end */
@ -1033,12 +1048,16 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) {
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) {
LinphoneAddress* linphone_address = NULL;
LinphoneFriend *fr;
const char *name = NULL;
MSList *sipAddresses = NULL;
bctbx_list_t *sipAddresses = NULL;
if (vcard == NULL) {
ms_error("Cannot create friend from null vcard");
@ -1137,7 +1156,7 @@ void linphone_core_friends_storage_init(LinphoneCore *lc) {
int ret;
const char *errmsg;
sqlite3 *db;
const MSList *friends_lists = NULL;
const bctbx_list_t *friends_lists = NULL;
linphone_core_friends_storage_close(lc);
@ -1156,13 +1175,13 @@ void linphone_core_friends_storage_init(LinphoneCore *lc) {
friends_lists = linphone_core_fetch_friends_lists_from_db(lc);
if (friends_lists) {
ms_warning("Replacing current default friend list by the one(s) from the database");
lc->friends_lists = ms_list_free_with_data(lc->friends_lists, (void (*)(void*))linphone_friend_list_unref);
lc->friends_lists = bctbx_list_free_with_data(lc->friends_lists, (void (*)(void*))linphone_friend_list_unref);
lc->friends_lists = NULL;
while (friends_lists) {
LinphoneFriendList *list = (LinphoneFriendList *)friends_lists->data;
linphone_core_add_friend_list(lc, list);
friends_lists = ms_list_next(friends_lists);
friends_lists = bctbx_list_next(friends_lists);
}
}
}
@ -1182,8 +1201,8 @@ void linphone_core_friends_storage_close(LinphoneCore *lc) {
* | 4 | revision
*/
static int create_friend_list(void *data, int argc, char **argv, char **colName) {
MSList **list = (MSList **)data;
unsigned int storage_id = atoi(argv[0]);
bctbx_list_t **list = (bctbx_list_t **)data;
unsigned int storage_id = (unsigned int)atoi(argv[0]);
LinphoneFriendList *lfl = linphone_core_create_friend_list(NULL);
lfl->storage_id = storage_id;
@ -1192,7 +1211,7 @@ static int create_friend_list(void *data, int argc, char **argv, char **colName)
linphone_friend_list_set_uri(lfl, argv[3]);
lfl->revision = atoi(argv[4]);
*list = ms_list_append(*list, linphone_friend_list_ref(lfl));
*list = bctbx_list_append(*list, linphone_friend_list_ref(lfl));
linphone_friend_list_unref(lfl);
return 0;
}
@ -1200,7 +1219,11 @@ static int create_friend_list(void *data, int argc, char **argv, char **colName)
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
/* DB layout:
* | 0 | storage_id
* | 1 | friend_list_id
@ -1214,10 +1237,10 @@ static int create_friend_list(void *data, int argc, char **argv, char **colName)
* | 9 | presence_received
*/
static int create_friend(void *data, int argc, char **argv, char **colName) {
MSList **list = (MSList **)data;
bctbx_list_t **list = (bctbx_list_t **)data;
LinphoneFriend *lf = NULL;
LinphoneVcard *vcard = NULL;
unsigned int storage_id = atoi(argv[0]);
unsigned int storage_id = (unsigned int)atoi(argv[0]);
vcard = linphone_vcard_new_from_vcard4_buffer(argv[6]);
if (vcard) {
@ -1237,7 +1260,7 @@ static int create_friend(void *data, int argc, char **argv, char **colName) {
lf->presence_received = atoi(argv[9]);
lf->storage_id = storage_id;
*list = ms_list_append(*list, linphone_friend_ref(lf));
*list = bctbx_list_append(*list, linphone_friend_ref(lf));
linphone_friend_unref(lf);
return 0;
}
@ -1245,7 +1268,7 @@ static int create_friend(void *data, int argc, char **argv, char **colName) {
#pragma GCC diagnostic pop
#endif
static int linphone_sql_request_friend(sqlite3* db, const char *stmt, MSList **list) {
static int linphone_sql_request_friend(sqlite3* db, const char *stmt, bctbx_list_t **list) {
char* errmsg = NULL;
int ret;
ret = sqlite3_exec(db, stmt, create_friend, list, &errmsg);
@ -1256,7 +1279,7 @@ static int linphone_sql_request_friend(sqlite3* db, const char *stmt, MSList **l
return ret;
}
static int linphone_sql_request_friends_list(sqlite3* db, const char *stmt, MSList **list) {
static int linphone_sql_request_friends_list(sqlite3* db, const char *stmt, bctbx_list_t **list) {
char* errmsg = NULL;
int ret;
ret = sqlite3_exec(db, stmt, create_friend_list, list, &errmsg);
@ -1299,7 +1322,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
}
if (lf->storage_id > 0) {
buf = sqlite3_mprintf("UPDATE friends SET friend_list_id=%i,sip_uri=%Q,subscribe_policy=%i,send_subscribe=%i,ref_key=%Q,vCard=%Q,vCard_etag=%Q,vCard_url=%Q,presence_received=%i WHERE (id = %i);",
buf = sqlite3_mprintf("UPDATE friends SET friend_list_id=%u,sip_uri=%Q,subscribe_policy=%i,send_subscribe=%i,ref_key=%Q,vCard=%Q,vCard_etag=%Q,vCard_url=%Q,presence_received=%i WHERE (id = %u);",
lf->friend_list->storage_id,
linphone_address_as_string(linphone_friend_get_address(lf)),
lf->pol,
@ -1312,7 +1335,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
lf->storage_id
);
} else {
buf = sqlite3_mprintf("INSERT INTO friends VALUES(NULL,%i,%Q,%i,%i,%Q,%Q,%Q,%Q,%i);",
buf = sqlite3_mprintf("INSERT INTO friends VALUES(NULL,%u,%Q,%i,%i,%Q,%Q,%Q,%Q,%i);",
lf->friend_list->storage_id,
linphone_address_as_string(linphone_friend_get_address(lf)),
lf->pol,
@ -1328,7 +1351,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
sqlite3_free(buf);
if (lf->storage_id == 0) {
lf->storage_id = sqlite3_last_insert_rowid(lc->friends_db);
lf->storage_id = (unsigned int)sqlite3_last_insert_rowid(lc->friends_db);
}
}
}
@ -1343,7 +1366,7 @@ void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList
}
if (list->storage_id > 0) {
buf = sqlite3_mprintf("UPDATE friends_lists SET display_name=%Q,rls_uri=%Q,uri=%Q,revision=%i WHERE (id = %i);",
buf = sqlite3_mprintf("UPDATE friends_lists SET display_name=%Q,rls_uri=%Q,uri=%Q,revision=%i WHERE (id = %u);",
list->display_name,
list->rls_uri,
list->uri,
@ -1362,7 +1385,7 @@ void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList
sqlite3_free(buf);
if (list->storage_id == 0) {
list->storage_id = sqlite3_last_insert_rowid(lc->friends_db);
list->storage_id = (unsigned int)sqlite3_last_insert_rowid(lc->friends_db);
}
}
}
@ -1375,7 +1398,7 @@ void linphone_core_remove_friend_from_db(LinphoneCore *lc, LinphoneFriend *lf) {
return;
}
buf = sqlite3_mprintf("DELETE FROM friends WHERE id = %i", lf->storage_id);
buf = sqlite3_mprintf("DELETE FROM friends WHERE id = %u", lf->storage_id);
linphone_sql_request_generic(lc->friends_db, buf);
sqlite3_free(buf);
@ -1391,7 +1414,7 @@ void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendL
return;
}
buf = sqlite3_mprintf("DELETE FROM friends_lists WHERE id = %i", list->storage_id);
buf = sqlite3_mprintf("DELETE FROM friends_lists WHERE id = %u", list->storage_id);
linphone_sql_request_generic(lc->friends_db, buf);
sqlite3_free(buf);
@ -1399,23 +1422,23 @@ void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendL
}
}
MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
bctbx_list_t* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
char *buf;
uint64_t begin,end;
MSList *result = NULL;
MSList *elem = NULL;
bctbx_list_t *result = NULL;
bctbx_list_t *elem = NULL;
if (!lc || lc->friends_db == NULL || list == NULL) {
ms_warning("Either lc (or list) is NULL or friends database wasn't initialized with linphone_core_friends_storage_init() yet");
return NULL;
}
buf = sqlite3_mprintf("SELECT * FROM friends WHERE friend_list_id = %i ORDER BY id", list->storage_id);
buf = sqlite3_mprintf("SELECT * FROM friends WHERE friend_list_id = %u ORDER BY id", list->storage_id);
begin = ortp_get_cur_time_ms();
linphone_sql_request_friend(lc->friends_db, buf, &result);
end = ortp_get_cur_time_ms();
ms_message("%s(): %i results fetched, completed in %i ms",__FUNCTION__, ms_list_size(result), (int)(end-begin));
ms_message("%s(): %u results fetched, completed in %i ms",__FUNCTION__, (unsigned int)bctbx_list_size(result), (int)(end-begin));
sqlite3_free(buf);
for(elem = result; elem != NULL; elem = elem->next) {
@ -1427,11 +1450,11 @@ MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList
return result;
}
MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
bctbx_list_t* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
char *buf;
uint64_t begin,end;
MSList *result = NULL;
MSList *elem = NULL;
bctbx_list_t *result = NULL;
bctbx_list_t *elem = NULL;
if (!lc || lc->friends_db == NULL) {
ms_warning("Either lc is NULL or friends database wasn't initialized with linphone_core_friends_storage_init() yet");
@ -1443,7 +1466,7 @@ MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
begin = ortp_get_cur_time_ms();
linphone_sql_request_friends_list(lc->friends_db, buf, &result);
end = ortp_get_cur_time_ms();
ms_message("%s(): %i results fetched, completed in %i ms",__FUNCTION__, ms_list_size(result), (int)(end-begin));
ms_message("%s(): %u results fetched, completed in %i ms",__FUNCTION__, (unsigned int)bctbx_list_size(result), (int)(end-begin));
sqlite3_free(buf);
for(elem = result; elem != NULL; elem = elem->next) {
@ -1475,11 +1498,11 @@ void linphone_core_remove_friend_from_db(LinphoneCore *lc, LinphoneFriend *lf) {
void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
}
MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
bctbx_list_t* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
return NULL;
}
MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
bctbx_list_t* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
return NULL;
}
@ -1521,7 +1544,7 @@ void linphone_core_migrate_friends_from_rc_to_db(LinphoneCore *lc) {
return;
}
if (ms_list_size(linphone_friend_list_get_friends(lfl)) > 0 && lfl->storage_id == 0) {
if (bctbx_list_size(linphone_friend_list_get_friends(lfl)) > 0 && lfl->storage_id == 0) {
linphone_core_remove_friend_list(lc, lfl);
lfl = linphone_core_create_friend_list(lc);
linphone_core_add_friend_list(lc, lfl);

View file

@ -90,12 +90,12 @@ void linphone_friend_list_cbs_set_sync_status_changed(LinphoneFriendListCbs *cbs
static char * create_resource_list_xml(const LinphoneFriendList *list) {
char *xml_content = NULL;
MSList *elem;
bctbx_list_t *elem;
xmlBufferPtr buf;
xmlTextWriterPtr writer;
int err;
if (ms_list_size(list->friends) <= 0) return NULL;
if (bctbx_list_size(list->friends) <= 0) return NULL;
buf = xmlBufferCreate();
if (buf == NULL) {
@ -196,7 +196,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList
goto end;
}
if ((strcmp(full_state_str, "true") == 0) || (strcmp(full_state_str, "1") == 0)) {
MSList *l = list->friends;
bctbx_list_t *l = list->friends;
for (; l != NULL; l = l->next) {
lf = (LinphoneFriend *)l->data;
linphone_friend_set_presence_model(lf, NULL);
@ -253,7 +253,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList
if (resource_object != NULL) xmlXPathFreeObject(resource_object);
if (full_state == TRUE) {
MSList *l = list->friends;
bctbx_list_t *l = list->friends;
for (; l != NULL; l = l->next) {
lf = (LinphoneFriend *)l->data;
if (linphone_friend_is_presence_received(lf) == TRUE) {
@ -270,7 +270,7 @@ end:
}
static bool_t linphone_friend_list_has_subscribe_inactive(const LinphoneFriendList *list) {
MSList *l = list->friends;
bctbx_list_t *l = list->friends;
bool_t has_subscribe_inactive = FALSE;
for (; l != NULL; l = l->next) {
LinphoneFriend *lf = (LinphoneFriend *)l->data;
@ -301,8 +301,8 @@ static void linphone_friend_list_destroy(LinphoneFriendList *list) {
}
if (list->uri != NULL) ms_free(list->uri);
if (list->cbs) linphone_friend_list_cbs_unref(list->cbs);
if (list->dirty_friends_to_update) list->dirty_friends_to_update = ms_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
if (list->friends) list->friends = ms_list_free_with_data(list->friends, (void (*)(void *))_linphone_friend_release);
if (list->dirty_friends_to_update) list->dirty_friends_to_update = bctbx_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
if (list->friends) list->friends = bctbx_list_free_with_data(list->friends, (void (*)(void *))_linphone_friend_release);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneFriendList);
@ -338,10 +338,10 @@ void _linphone_friend_list_release(LinphoneFriendList *list){
list->cbs = NULL;
}
if (list->dirty_friends_to_update) {
list->dirty_friends_to_update = ms_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
list->dirty_friends_to_update = bctbx_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
}
if (list->friends) {
list->friends = ms_list_free_with_data(list->friends, (void (*)(void *))_linphone_friend_release);
list->friends = bctbx_list_free_with_data(list->friends, (void (*)(void *))_linphone_friend_release);
}
linphone_friend_list_unref(list);
}
@ -400,7 +400,7 @@ static LinphoneFriendListStatus _linphone_friend_list_add_friend(LinphoneFriendL
ms_error("linphone_friend_list_add_friend(): invalid friend, already in list");
return status;
}
if (ms_list_find(list->friends, lf) != NULL) {
if (bctbx_list_find(list->friends, lf) != NULL) {
char *tmp = NULL;
const LinphoneAddress *addr = linphone_friend_get_address(lf);
if (addr) tmp = linphone_address_as_string(addr);
@ -435,9 +435,9 @@ LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *
}
lf->friend_list = list;
lf->lc = list->lc;
list->friends = ms_list_append(list->friends, linphone_friend_ref(lf));
list->friends = bctbx_list_append(list->friends, linphone_friend_ref(lf));
if (synchronize) {
list->dirty_friends_to_update = ms_list_append(list->dirty_friends_to_update, linphone_friend_ref(lf));
list->dirty_friends_to_update = bctbx_list_append(list->dirty_friends_to_update, linphone_friend_ref(lf));
}
return LinphoneFriendListOK;
}
@ -450,7 +450,7 @@ static void carddav_done(LinphoneCardDavContext *cdc, bool_t success, const char
}
static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t remove_from_server) {
MSList *elem = ms_list_find(list->friends, lf);
bctbx_list_t *elem = bctbx_list_find(list->friends, lf);
if (elem == NULL) return LinphoneFriendListNonExistentFriend;
#ifdef SQLITE_STORAGE_ENABLED
@ -477,7 +477,7 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
lf->friend_list = NULL;
linphone_friend_unref(lf);
list->friends = ms_list_remove_link(list->friends, elem);
list->friends = bctbx_list_remove_link(list->friends, elem);
return LinphoneFriendListOK;
}
@ -485,12 +485,12 @@ LinphoneFriendListStatus linphone_friend_list_remove_friend(LinphoneFriendList *
return _linphone_friend_list_remove_friend(list, lf, TRUE);
}
const MSList * linphone_friend_list_get_friends(const LinphoneFriendList *list) {
const bctbx_list_t * linphone_friend_list_get_friends(const LinphoneFriendList *list) {
return list->friends;
}
void linphone_friend_list_update_dirty_friends(LinphoneFriendList *list) {
MSList *dirty_friends = list->dirty_friends_to_update;
bctbx_list_t *dirty_friends = list->dirty_friends_to_update;
while (dirty_friends) {
LinphoneCardDavContext *cdc = linphone_carddav_context_new(list);
@ -504,9 +504,9 @@ void linphone_friend_list_update_dirty_friends(LinphoneFriendList *list) {
linphone_carddav_put_vcard(cdc, lf);
}
}
dirty_friends = ms_list_next(dirty_friends);
dirty_friends = bctbx_list_next(dirty_friends);
}
list->dirty_friends_to_update = ms_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
list->dirty_friends_to_update = bctbx_list_free_with_data(list->dirty_friends_to_update, (void (*)(void *))linphone_friend_unref);
}
static void carddav_created(LinphoneCardDavContext *cdc, LinphoneFriend *lf) {
@ -532,7 +532,7 @@ static void carddav_removed(LinphoneCardDavContext *cdc, LinphoneFriend *lf) {
static void carddav_updated(LinphoneCardDavContext *cdc, LinphoneFriend *lf_new, LinphoneFriend *lf_old) {
if (cdc) {
LinphoneFriendList *lfl = cdc->friend_list;
MSList *elem = ms_list_find(lfl->friends, lf_old);
bctbx_list_t *elem = bctbx_list_find(lfl->friends, lf_old);
if (elem) {
elem->data = linphone_friend_ref(lf_new);
}
@ -568,7 +568,7 @@ void linphone_friend_list_synchronize_friends_from_server(LinphoneFriendList *li
LinphoneFriend * linphone_friend_list_find_friend_by_address(const LinphoneFriendList *list, const LinphoneAddress *address) {
LinphoneFriend *lf = NULL;
const MSList *elem;
const bctbx_list_t *elem;
for (elem = list->friends; elem != NULL; elem = elem->next) {
lf = (LinphoneFriend *)elem->data;
if (linphone_address_weak_equal(lf->uri, address))
@ -585,7 +585,7 @@ LinphoneFriend * linphone_friend_list_find_friend_by_uri(const LinphoneFriendLis
}
LinphoneFriend * linphone_friend_list_find_friend_by_ref_key(const LinphoneFriendList *list, const char *ref_key) {
const MSList *elem;
const bctbx_list_t *elem;
if (ref_key == NULL) return NULL;
for (elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
@ -595,16 +595,16 @@ LinphoneFriend * linphone_friend_list_find_friend_by_ref_key(const LinphoneFrien
}
LinphoneFriend * linphone_friend_list_find_friend_by_inc_subscribe(const LinphoneFriendList *list, SalOp *op) {
const MSList *elem;
const bctbx_list_t *elem;
for (elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
if (ms_list_find(lf->insubs, op)) return lf;
if (bctbx_list_find(lf->insubs, op)) return lf;
}
return NULL;
}
LinphoneFriend * linphone_friend_list_find_friend_by_out_subscribe(const LinphoneFriendList *list, SalOp *op) {
const MSList *elem;
const bctbx_list_t *elem;
for (elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
if (lf->outsub && ((lf->outsub == op) || sal_op_is_forked_of(lf->outsub, op))) return lf;
@ -619,11 +619,11 @@ static void linphone_friend_list_close_subscriptions(LinphoneFriendList *list) {
linphone_event_unref(list->event);
list->event = NULL;
}
ms_list_for_each(list->friends, (void (*)(void *))linphone_friend_close_subscriptions);
bctbx_list_for_each(list->friends, (void (*)(void *))linphone_friend_close_subscriptions);
}
void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, LinphoneProxyConfig *cfg, bool_t only_when_registered) {
const MSList *elem;
const bctbx_list_t *elem;
if (list->rls_uri != NULL) {
if (list->enable_subscriptions) {
LinphoneAddress *address = linphone_address_new(list->rls_uri);
@ -679,7 +679,7 @@ void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, Linphon
}
void linphone_friend_list_invalidate_subscriptions(LinphoneFriendList *list) {
const MSList *elem;
const bctbx_list_t *elem;
for (elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
linphone_friend_invalidate_subscription(lf);
@ -687,7 +687,7 @@ void linphone_friend_list_invalidate_subscriptions(LinphoneFriendList *list) {
}
void linphone_friend_list_notify_presence(LinphoneFriendList *list, LinphonePresenceModel *presence) {
const MSList *elem;
const bctbx_list_t *elem;
for(elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
linphone_friend_notify(lf, presence);
@ -768,24 +768,28 @@ LinphoneCore* linphone_friend_list_get_core(LinphoneFriendList *list) {
}
int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *list, const char *vcard_file) {
MSList *vcards = linphone_vcard_list_from_vcard4_file(vcard_file);
bctbx_list_t *vcards = NULL;
bctbx_list_t *vcards_iterator = NULL;
int count = 0;
#ifndef VCARD_ENABLED
ms_error("vCard support wasn't enabled at compilation time");
return -1;
#endif
if (!vcards) {
ms_error("Failed to parse the file %s", vcard_file);
return -1;
}
if (!list) {
ms_error("Can't import into a NULL list");
return -1;
}
vcards = linphone_vcard_list_from_vcard4_file(vcard_file);
vcards_iterator = vcards;
if (!vcards) {
ms_error("Failed to parse the file %s", vcard_file);
return -1;
}
while (vcards != NULL && vcards->data != NULL) {
LinphoneVcard *vcard = (LinphoneVcard *)vcards->data;
while (vcards_iterator != NULL && vcards_iterator->data != NULL) {
LinphoneVcard *vcard = (LinphoneVcard *)vcards_iterator->data;
LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard);
if (lf) {
if (LinphoneFriendListOK == linphone_friend_list_import_friend(list, lf, TRUE)) {
@ -795,31 +799,36 @@ int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *lis
} else {
linphone_vcard_free(vcard);
}
vcards = ms_list_next(vcards);
vcards_iterator = bctbx_list_next(vcards_iterator);
}
bctbx_list_free(vcards);
linphone_core_store_friends_list_in_db(list->lc, list);
return count;
}
int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *list, const char *vcard_buffer) {
MSList *vcards = linphone_vcard_list_from_vcard4_buffer(vcard_buffer);
bctbx_list_t *vcards = NULL;
bctbx_list_t *vcards_iterator = NULL;
int count = 0;
#ifndef VCARD_ENABLED
ms_error("vCard support wasn't enabled at compilation time");
return -1;
#endif
if (!vcards) {
ms_error("Failed to parse the buffer");
return -1;
}
if (!list) {
ms_error("Can't import into a NULL list");
return -1;
}
vcards = linphone_vcard_list_from_vcard4_buffer(vcard_buffer);
vcards_iterator = vcards;
if (!vcards) {
ms_error("Failed to parse the buffer");
return -1;
}
while (vcards != NULL && vcards->data != NULL) {
LinphoneVcard *vcard = (LinphoneVcard *)vcards->data;
while (vcards_iterator != NULL && vcards_iterator->data != NULL) {
LinphoneVcard *vcard = (LinphoneVcard *)vcards_iterator->data;
LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard);
if (lf) {
if (LinphoneFriendListOK == linphone_friend_list_import_friend(list, lf, TRUE)) {
@ -829,15 +838,16 @@ int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *l
} else {
linphone_vcard_free(vcard);
}
vcards = ms_list_next(vcards);
vcards_iterator = bctbx_list_next(vcards_iterator);
}
bctbx_list_free(vcards);
linphone_core_store_friends_list_in_db(list->lc, list);
return count;
}
void linphone_friend_list_export_friends_as_vcard4_file(LinphoneFriendList *list, const char *vcard_file) {
FILE *file = NULL;
const MSList *friends = linphone_friend_list_get_friends(list);
const bctbx_list_t *friends = linphone_friend_list_get_friends(list);
file = fopen(vcard_file, "wb");
if (file == NULL) {
@ -857,7 +867,7 @@ void linphone_friend_list_export_friends_as_vcard4_file(LinphoneFriendList *list
} else {
ms_warning("Couldn't export friend %s because it doesn't have a vCard attached", linphone_address_as_string(linphone_friend_get_address(lf)));
}
friends = ms_list_next(friends);
friends = bctbx_list_next(friends);
}
fclose(file);

View file

@ -89,7 +89,7 @@ LINPHONE_PUBLIC void linphone_core_remove_friend_list(LinphoneCore *lc, Linphone
* @param[in] lc LinphoneCore object
* @return \mslist{LinphoneFriendList} a list of LinphoneFriendList
*/
LINPHONE_PUBLIC const MSList * linphone_core_get_friends_lists(const LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_friends_lists(const LinphoneCore *lc);
/**
* Retrieves the first list of LinphoneFriend from the core.
@ -183,7 +183,7 @@ LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_remove_friend(Linp
* @param[in] list LinphoneFriendList object
* @return \mslist{LinphoneFriend} a list of LinphoneFriend
*/
LINPHONE_PUBLIC const MSList * linphone_friend_list_get_friends(const LinphoneFriendList *list);
LINPHONE_PUBLIC const bctbx_list_t * linphone_friend_list_get_friends(const LinphoneFriendList *list);
/**
* Find a friend in the friend list using a LinphoneAddress.

View file

@ -40,7 +40,7 @@ struct _LinphoneLDAPContactProvider
LinphoneDictionary* config;
LDAP* ld;
MSList* requests;
bctbx_list_t* requests;
unsigned int req_count;
// bind transaction
@ -78,7 +78,7 @@ struct _LinphoneLDAPContactSearch
int msgid;
char* filter;
bool_t complete;
MSList* found_entries;
bctbx_list_t* found_entries;
unsigned int found_count;
};
@ -116,8 +116,8 @@ unsigned int linphone_ldap_contact_search_result_count(LinphoneLDAPContactSearch
static void linphone_ldap_contact_search_destroy( LinphoneLDAPContactSearch* obj )
{
//ms_message("~LinphoneLDAPContactSearch(%p)", obj);
ms_list_for_each(obj->found_entries, linphone_ldap_contact_search_destroy_friend);
obj->found_entries = ms_list_free(obj->found_entries);
bctbx_list_for_each(obj->found_entries, linphone_ldap_contact_search_destroy_friend);
obj->found_entries = bctbx_list_free(obj->found_entries);
if( obj->filter ) ms_free(obj->filter);
}
@ -152,7 +152,7 @@ static void linphone_ldap_contact_provider_destroy( LinphoneLDAPContactProvider*
linphone_core_remove_iterate_hook(LINPHONE_CONTACT_PROVIDER(obj)->lc, linphone_ldap_contact_provider_iterate,obj);
// clean pending requests
ms_list_for_each(obj->requests, linphone_ldap_contact_provider_destroy_request_cb);
bctbx_list_for_each(obj->requests, linphone_ldap_contact_provider_destroy_request_cb);
if (obj->ld) ldap_unbind_ext(obj->ld, NULL, NULL);
obj->ld = NULL;
@ -223,7 +223,7 @@ static void linphone_ldap_contact_provider_handle_search_result( LinphoneLDAPCon
LinphoneFriend* lf = linphone_core_create_friend(lc);
linphone_friend_set_address(lf, la);
linphone_friend_set_name(lf, ldap_data.name);
req->found_entries = ms_list_append(req->found_entries, lf);
req->found_entries = bctbx_list_append(req->found_entries, lf);
req->found_count++;
//ms_message("Added friend %s / %s", ldap_data.name, ldap_data.sip);
ms_free(ldap_data.sip);
@ -313,7 +313,7 @@ static bool_t linphone_ldap_contact_provider_iterate(void *data)
unsigned int i;
for( i=0; i<obj->req_count; i++){
LinphoneLDAPContactSearch* search = (LinphoneLDAPContactSearch*)ms_list_nth_data( obj->requests, i );
LinphoneLDAPContactSearch* search = (LinphoneLDAPContactSearch*)bctbx_list_nth_data( obj->requests, i );
if( search && search->msgid == 0){
int ret;
ms_message("Found pending search %p (for %s), launching...", search, search->filter);
@ -618,10 +618,10 @@ static int linphone_ldap_request_entry_compare_strong(const void*a, const void*
static inline LinphoneLDAPContactSearch* linphone_ldap_contact_provider_request_search( LinphoneLDAPContactProvider* obj, int msgid )
{
LinphoneLDAPContactSearch dummy = {};
MSList* list_entry;
bctbx_list_t* list_entry;
dummy.msgid = msgid;
list_entry = ms_list_find_custom(obj->requests, linphone_ldap_request_entry_compare_weak, &dummy);
list_entry = bctbx_list_find_custom(obj->requests, linphone_ldap_request_entry_compare_weak, &dummy);
if( list_entry ) return list_entry->data;
else return NULL;
}
@ -632,10 +632,10 @@ static unsigned int linphone_ldap_contact_provider_cancel_search(LinphoneContact
LinphoneLDAPContactProvider* ldap_cp = LINPHONE_LDAP_CONTACT_PROVIDER(obj);
int ret = 1;
MSList* list_entry = ms_list_find_custom(ldap_cp->requests, linphone_ldap_request_entry_compare_strong, req);
bctbx_list_t* list_entry = bctbx_list_find_custom(ldap_cp->requests, linphone_ldap_request_entry_compare_strong, req);
if( list_entry ) {
ms_message("Delete search %p", req);
ldap_cp->requests = ms_list_remove_link(ldap_cp->requests, list_entry);
ldap_cp->requests = bctbx_list_remove_link(ldap_cp->requests, list_entry);
ldap_cp->req_count--;
ret = 0; // return OK if we found it in the monitored requests
} else {
@ -703,7 +703,7 @@ static LinphoneLDAPContactSearch* linphone_ldap_contact_provider_begin_search (
}
if( request != NULL ) {
obj->requests = ms_list_append ( obj->requests, request );
obj->requests = bctbx_list_append ( obj->requests, request );
obj->req_count++;
}

View file

@ -713,7 +713,7 @@ int lime_decryptMultipartMessage(xmlDocPtr cacheBuffer, uint8_t *message, uint8_
if ((!xmlStrcmp(cur->name, (const xmlChar *)"ZID"))){ /* sender ZID found, extract it */
peerZidHex = xmlNodeListGetString(xmlEncryptedMessage, cur->xmlChildrenNode, 1);
/* convert it from hexa string to bytes string and set the result in the associatedKey structure */
lime_strToUint8(associatedKey.peerZID, peerZidHex, strlen((char *)peerZidHex));
lime_strToUint8(associatedKey.peerZID, peerZidHex, (uint16_t)strlen((char *)peerZidHex));
cur = cur->next;
}
}
@ -825,8 +825,18 @@ void lime_freeKeys(limeURIKeys_t *associatedKeys){
int lime_getCachedSndKeysByURI(xmlDocPtr cacheBuffer, limeURIKeys_t *associatedKeys){
return LIME_NOT_ENABLED;
}
int lime_encryptMessage(limeKey_t *key, uint8_t *plainMessage, uint32_t messageLength, uint8_t selfZID[12], uint8_t *encryptedMessage) {
return LIME_NOT_ENABLED;
}
int lime_setCachedKey(xmlDocPtr cacheBuffer, limeKey_t *associatedKey, uint8_t role) {
return LIME_NOT_ENABLED;
}
int lime_getCachedRcvKeyByZid(xmlDocPtr cacheBuffer, limeKey_t *associatedKey) {
return LIME_NOT_ENABLED;
}
int lime_decryptMessage(limeKey_t *key, uint8_t *encryptedMessage, uint32_t messageLength, uint8_t selfZID[12], uint8_t *plainMessage) {
return LIME_NOT_ENABLED;
}
#endif /* HAVE_LIME */
char *lime_error_code_to_string(int errorCode) {

View file

@ -547,6 +547,24 @@ LINPHONE_PUBLIC const char * linphone_proxy_config_get_ref_key(const LinphonePro
**/
LINPHONE_PUBLIC void linphone_proxy_config_set_ref_key(LinphoneProxyConfig *cfg, const char *refkey);
/**
* Get The policy that is used to pass through NATs/firewalls when using this proxy config.
* If it is set to NULL, the default NAT policy from the core will be used instead.
* @param[in] cfg #LinphoneProxyConfig object
* @return LinphoneNatPolicy object in use.
* @see linphone_core_get_nat_policy()
*/
LINPHONE_PUBLIC LinphoneNatPolicy * linphone_proxy_config_get_nat_policy(const LinphoneProxyConfig *cfg);
/**
* Set the policy to use to pass through NATs/firewalls when using this proxy config.
* If it is set to NULL, the default NAT policy from the core will be used instead.
* @param[in] cfg #LinphoneProxyConfig object
* @param[in] policy LinphoneNatPolicy object
* @see linphone_core_set_nat_policy()
*/
LINPHONE_PUBLIC void linphone_proxy_config_set_nat_policy(LinphoneProxyConfig *cfg, LinphoneNatPolicy *policy);
/**
* @}
*/

View file

@ -35,7 +35,7 @@ LinphoneTunnel* linphone_core_get_tunnel(const LinphoneCore *lc){
struct _LinphoneTunnel {
belledonnecomm::TunnelManager *manager;
MSList *config_list;
bctbx_list_t *config_list;
};
extern "C" LinphoneTunnel* linphone_core_tunnel_new(LinphoneCore *lc){
@ -55,7 +55,7 @@ static inline _LpConfig *config(const LinphoneTunnel *tunnel){
void linphone_tunnel_destroy(LinphoneTunnel *tunnel){
delete tunnel->manager;
ms_list_free_with_data(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
bctbx_list_free_with_data(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
ms_free(tunnel);
}
@ -129,7 +129,7 @@ static LinphoneTunnelConfig *linphone_tunnel_config_from_string(const char *str)
static void linphone_tunnel_save_config(const LinphoneTunnel *tunnel) {
MSList *elem = NULL;
bctbx_list_t *elem = NULL;
char *tmp = NULL, *old_tmp = NULL, *tc_str = NULL;
for(elem = tunnel->config_list; elem != NULL; elem = elem->next) {
LinphoneTunnelConfig *tunnel_config = (LinphoneTunnelConfig *)elem->data;
@ -162,7 +162,7 @@ static void linphone_tunnel_add_server_intern(LinphoneTunnel *tunnel, LinphoneTu
linphone_tunnel_config_get_remote_udp_mirror_port(tunnel_config),
linphone_tunnel_config_get_delay(tunnel_config));
}
tunnel->config_list = ms_list_append(tunnel->config_list, linphone_tunnel_config_ref(tunnel_config));
tunnel->config_list = bctbx_list_append(tunnel->config_list, linphone_tunnel_config_ref(tunnel_config));
}
@ -192,7 +192,7 @@ static void linphone_tunnel_load_config(LinphoneTunnel *tunnel){
}
static void linphone_tunnel_refresh_config(LinphoneTunnel *tunnel) {
MSList *old_list = tunnel->config_list;
bctbx_list_t *old_list = tunnel->config_list;
tunnel->config_list = NULL;
bcTunnel(tunnel)->cleanServers();
while(old_list != NULL) {
@ -209,16 +209,16 @@ void linphone_tunnel_add_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tu
}
void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tunnel_config) {
MSList *elem = ms_list_find(tunnel->config_list, tunnel_config);
bctbx_list_t *elem = bctbx_list_find(tunnel->config_list, tunnel_config);
if(elem != NULL) {
tunnel->config_list = ms_list_remove(tunnel->config_list, tunnel_config);
tunnel->config_list = bctbx_list_remove(tunnel->config_list, tunnel_config);
linphone_tunnel_config_unref(tunnel_config);
linphone_tunnel_refresh_config(tunnel);
linphone_tunnel_save_config(tunnel);
}
}
const MSList *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel){
const bctbx_list_t *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel){
return tunnel->config_list;
}
@ -226,7 +226,7 @@ void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel){
bcTunnel(tunnel)->cleanServers();
/* Free the list */
ms_list_free_with_data(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
bctbx_list_free_with_data(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
tunnel->config_list = NULL;
linphone_tunnel_save_config(tunnel);
@ -296,7 +296,7 @@ static void tunnelLogHandler(int level, const char *fmt, va_list l){
void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler){
tunnelOrtpLogHandler=logHandler;
bcTunnel(tunnel)->enableLogs(enabled, tunnelLogHandler);
bcTunnel(tunnel)->enableLogs(enabled == FALSE ? false : true, tunnelLogHandler);
}
void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel *tunnel, const char* username,const char* passwd){
@ -323,7 +323,7 @@ void linphone_tunnel_reconnect(LinphoneTunnel *tunnel){
}
void linphone_tunnel_enable_sip(LinphoneTunnel *tunnel, bool_t enable) {
bcTunnel(tunnel)->tunnelizeSipPackets(enable);
bcTunnel(tunnel)->tunnelizeSipPackets(enable == FALSE ? false : true);
lp_config_set_int(config(tunnel), "tunnel", "sip", (enable ? TRUE : FALSE));
}
@ -332,7 +332,7 @@ bool_t linphone_tunnel_sip_enabled(const LinphoneTunnel *tunnel) {
}
void linphone_tunnel_verify_server_certificate(LinphoneTunnel *tunnel, bool_t enable) {
bcTunnel(tunnel)->verifyServerCertificate(enable);
bcTunnel(tunnel)->verifyServerCertificate(enable == FALSE ? false : true);
lp_config_set_int(config(tunnel), "tunnel", "verify_cert", (enable ? TRUE : FALSE));
}
@ -356,8 +356,10 @@ void linphone_tunnel_configure(LinphoneTunnel *tunnel){
linphone_tunnel_enable_logs_with_handler(tunnel,TRUE,my_ortp_logv);
linphone_tunnel_load_config(tunnel);
linphone_tunnel_enable_sip(tunnel, tunnelizeSIPPackets);
linphone_tunnel_set_mode(tunnel, mode);
linphone_tunnel_verify_server_certificate(tunnel, tunnelVerifyServerCertificate);
/*Tunnel is started here if mode equals true*/
linphone_tunnel_set_mode(tunnel, mode);
}
/* Deprecated functions */
@ -380,5 +382,5 @@ bool_t linphone_tunnel_auto_detect_enabled(LinphoneTunnel *tunnel) {
}
void linphone_tunnel_simulate_udp_loss(LinphoneTunnel *tunnel, bool_t enabled) {
bcTunnel(tunnel)->simulateUdpLoss(enabled);
bcTunnel(tunnel)->simulateUdpLoss(enabled == FALSE ? false : true);
}

View file

@ -229,7 +229,7 @@ LINPHONE_PUBLIC void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, Linph
* @param tunnel LinphoneTunnel object
* @return \mslist{LinphoneTunnelConfig}
*/
LINPHONE_PUBLIC const MSList *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel);
LINPHONE_PUBLIC const bctbx_list_t *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel);
/**
* Remove all tunnel server addresses previously entered with linphone_tunnel_add_server()

View file

@ -258,9 +258,9 @@ void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t
propagate_encryption_changed(call);
}
static int get_max_codec_sample_rate(const MSList *codecs){
static int get_max_codec_sample_rate(const bctbx_list_t *codecs){
int max_sample_rate=0;
const MSList *it;
const bctbx_list_t *it;
for(it=codecs;it!=NULL;it=it->next){
PayloadType *pt=(PayloadType*)it->data;
int sample_rate;
@ -274,8 +274,8 @@ static int get_max_codec_sample_rate(const MSList *codecs){
return max_sample_rate;
}
static int find_payload_type_number(const MSList *assigned, const PayloadType *pt){
const MSList *elem;
static int find_payload_type_number(const bctbx_list_t *assigned, const PayloadType *pt){
const bctbx_list_t *elem;
const PayloadType *candidate=NULL;
for(elem=assigned;elem!=NULL;elem=elem->next){
const PayloadType *it=(const PayloadType*)elem->data;
@ -292,8 +292,8 @@ static int find_payload_type_number(const MSList *assigned, const PayloadType *p
return candidate ? payload_type_get_number(candidate) : -1;
}
bool_t is_payload_type_number_available(const MSList *l, int number, const PayloadType *ignore){
const MSList *elem;
bool_t is_payload_type_number_available(const bctbx_list_t *l, int number, const PayloadType *ignore){
const bctbx_list_t *elem;
for (elem=l; elem!=NULL; elem=elem->next){
const PayloadType *pt=(PayloadType*)elem->data;
if (pt!=ignore && payload_type_get_number(pt)==number) return FALSE;
@ -301,8 +301,8 @@ bool_t is_payload_type_number_available(const MSList *l, int number, const Paylo
return TRUE;
}
static void linphone_core_assign_payload_type_numbers(LinphoneCore *lc, MSList *codecs){
MSList *elem;
static void linphone_core_assign_payload_type_numbers(LinphoneCore *lc, bctbx_list_t *codecs){
bctbx_list_t *elem;
int dyn_number=lc->codecs_conf.dyn_pt;
PayloadType *red = NULL, *t140 = NULL;
@ -347,8 +347,8 @@ static void linphone_core_assign_payload_type_numbers(LinphoneCore *lc, MSList *
}
}
static bool_t has_telephone_event_at_rate(const MSList *tev, int rate){
const MSList *it;
static bool_t has_telephone_event_at_rate(const bctbx_list_t *tev, int rate){
const bctbx_list_t *it;
for(it=tev;it!=NULL;it=it->next){
const PayloadType *pt=(PayloadType*)it->data;
if (pt->clock_rate==rate) return TRUE;
@ -356,9 +356,9 @@ static bool_t has_telephone_event_at_rate(const MSList *tev, int rate){
return FALSE;
}
static MSList * create_telephone_events(LinphoneCore *lc, const MSList *codecs){
const MSList *it;
MSList *ret=NULL;
static bctbx_list_t * create_telephone_events(LinphoneCore *lc, const bctbx_list_t *codecs){
const bctbx_list_t *it;
bctbx_list_t *ret=NULL;
for(it=codecs;it!=NULL;it=it->next){
const PayloadType *pt=(PayloadType*)it->data;
if (!has_telephone_event_at_rate(ret,pt->clock_rate)){
@ -372,18 +372,18 @@ static MSList * create_telephone_events(LinphoneCore *lc, const MSList *codecs){
payload_type_set_number(tev, lc->codecs_conf.telephone_event_pt);
}
}
ret=ms_list_append(ret,tev);
ret=bctbx_list_append(ret,tev);
}
}
return ret;
}
static MSList *create_special_payload_types(LinphoneCore *lc, const MSList *codecs){
MSList *ret=create_telephone_events(lc, codecs);
static bctbx_list_t *create_special_payload_types(LinphoneCore *lc, const bctbx_list_t *codecs){
bctbx_list_t *ret=create_telephone_events(lc, codecs);
if (linphone_core_generic_confort_noise_enabled(lc)){
PayloadType *cn=payload_type_clone(&payload_type_cn);
payload_type_set_number(cn, 13);
ret=ms_list_append(ret, cn);
ret=bctbx_list_append(ret, cn);
}
return ret;
}
@ -391,12 +391,12 @@ static MSList *create_special_payload_types(LinphoneCore *lc, const MSList *code
typedef struct _CodecConstraints{
int bandwidth_limit;
int max_codecs;
MSList *previously_used;
bctbx_list_t *previously_used;
}CodecConstraints;
static MSList *make_codec_list(LinphoneCore *lc, CodecConstraints * hints, SalStreamType stype, const MSList *codecs){
MSList *l=NULL;
const MSList *it;
static bctbx_list_t *make_codec_list(LinphoneCore *lc, CodecConstraints * hints, SalStreamType stype, const bctbx_list_t *codecs){
bctbx_list_t *l=NULL;
const bctbx_list_t *it;
int nb = 0;
for(it=codecs;it!=NULL;it=it->next){
@ -423,13 +423,13 @@ static MSList *make_codec_list(LinphoneCore *lc, CodecConstraints * hints, SalSt
payload_type_set_flag(pt, PAYLOAD_TYPE_FROZEN_NUMBER);
}
l=ms_list_append(l, pt);
l=bctbx_list_append(l, pt);
nb++;
if ((hints->max_codecs > 0) && (nb >= hints->max_codecs)) break;
}
if (stype==SalAudio){
MSList *specials=create_special_payload_types(lc,l);
l=ms_list_concat(l,specials);
bctbx_list_t *specials=create_special_payload_types(lc,l);
l=bctbx_list_concat(l,specials);
}
linphone_core_assign_payload_type_numbers(lc, l);
return l;
@ -542,7 +542,7 @@ static void setup_zrtp_hash(LinphoneCall *call, SalMediaDescription *md) {
}
static void setup_rtcp_fb(LinphoneCall *call, SalMediaDescription *md) {
MSList *pt_it;
bctbx_list_t *pt_it;
PayloadType *pt;
PayloadTypeAvpfParams avpf_params;
LinphoneCore *lc = call->core;
@ -683,7 +683,7 @@ static void force_streams_dir_according_to_state(LinphoneCall *call, SalMediaDes
}
void linphone_call_make_local_media_description(LinphoneCall *call) {
MSList *l;
bctbx_list_t *l;
SalMediaDescription *old_md=call->localdesc;
int i;
int max_index = 0;
@ -770,7 +770,7 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
} else {
ms_message("Don't put audio stream on local offer for call [%p]",call);
md->streams[call->main_audio_stream_index].dir = SalStreamInactive;
if(l) l=ms_list_free_with_data(l, (void (*)(void *))payload_type_destroy);
if(l) l=bctbx_list_free_with_data(l, (void (*)(void *))payload_type_destroy);
}
if (params->custom_sdp_media_attributes[LinphoneStreamTypeAudio])
md->streams[call->main_audio_stream_index].custom_sdp_attributes = sal_custom_sdp_attribute_clone(params->custom_sdp_media_attributes[LinphoneStreamTypeAudio]);
@ -805,7 +805,7 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
} else {
ms_message("Don't put video stream on local offer for call [%p]",call);
md->streams[call->main_video_stream_index].dir = SalStreamInactive;
if(l) l=ms_list_free_with_data(l, (void (*)(void *))payload_type_destroy);
if(l) l=bctbx_list_free_with_data(l, (void (*)(void *))payload_type_destroy);
}
if (params->custom_sdp_media_attributes[LinphoneStreamTypeVideo])
md->streams[call->main_video_stream_index].custom_sdp_attributes = sal_custom_sdp_attribute_clone(params->custom_sdp_media_attributes[LinphoneStreamTypeVideo]);
@ -877,7 +877,7 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
static int find_port_offset(LinphoneCore *lc, int stream_index, int base_port){
int offset;
MSList *elem;
bctbx_list_t *elem;
int tried_port;
int existing_port;
bool_t already_used=FALSE;
@ -903,7 +903,7 @@ static int find_port_offset(LinphoneCore *lc, int stream_index, int base_port){
}
static int select_random_port(LinphoneCore *lc, int stream_index, int min_port, int max_port) {
MSList *elem;
bctbx_list_t *elem;
int nb_tries;
int tried_port = 0;
int existing_port = 0;
@ -1113,7 +1113,15 @@ void linphone_call_fill_media_multicast_addr(LinphoneCall *call) {
call->media_ports[call->main_video_stream_index].multicast_ip[0]='\0';
}
static void linphone_call_create_ice_session(LinphoneCall *call, IceRole role){
void linphone_call_check_ice_session(LinphoneCall *call, IceRole role, bool_t is_reinvite){
if (call->ice_session) return; /*already created*/
if (!linphone_nat_policy_ice_enabled(linphone_core_get_nat_policy(call->core))){
return;
}
if (is_reinvite && lp_config_get_int(call->core->config, "net", "allow_late_ice", 0) == 0) return;
call->ice_session = ice_session_new();
/*for backward compatibility purposes, shall be enabled by default in futur*/
ice_session_enable_message_integrity_check(call->ice_session,lp_config_get_int(call->core->config,"net","ice_session_enable_message_integrity_check",1));
@ -1124,7 +1132,6 @@ static void linphone_call_create_ice_session(LinphoneCall *call, IceRole role){
types[2] = ICT_CandidateInvalid;
ice_session_set_default_candidates_types(call->ice_session, types);
}
ice_session_set_role(call->ice_session, role);
}
@ -1142,9 +1149,8 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
linphone_call_fill_media_multicast_addr(call);
if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) {
linphone_call_create_ice_session(call, IR_Controlling);
}
linphone_call_check_ice_session(call, IR_Controlling, FALSE);
if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) {
call->ping_time=linphone_core_run_stun_tests(call->core,call);
}
@ -1313,7 +1319,7 @@ static void linphone_call_compute_streams_indexes(LinphoneCall *call, const SalM
LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){
LinphoneCall *call = belle_sip_object_new(LinphoneCall);
SalMediaDescription *md;
LinphoneFirewallPolicy fpol;
LinphoneNatPolicy *nat_policy = NULL;
int i;
call->dir=LinphoneCallIncoming;
@ -1388,28 +1394,26 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
}
}
fpol=linphone_core_get_firewall_policy(call->core);
/*create the ice session now if ICE is required*/
if (fpol==LinphonePolicyUseIce){
if (call->dest_proxy != NULL) nat_policy = linphone_proxy_config_get_nat_policy(call->dest_proxy);
if (nat_policy == NULL) nat_policy = linphone_core_get_nat_policy(call->core);
if ((nat_policy != NULL) && linphone_nat_policy_ice_enabled(nat_policy)) {
/* Create the ice session now if ICE is required */
if (md){
linphone_call_create_ice_session(call, IR_Controlled);
linphone_call_check_ice_session(call, IR_Controlled, FALSE);
}else{
fpol=LinphonePolicyNoFirewall;
nat_policy = NULL;
ms_warning("ICE not supported for incoming INVITE without SDP.");
}
}
/*reserve the sockets immediately*/
linphone_call_init_media_streams(call);
switch (fpol) {
case LinphonePolicyUseIce:
if (nat_policy != NULL) {
if (linphone_nat_policy_ice_enabled(nat_policy)) {
call->defer_notify_incoming = linphone_call_prepare_ice(call,TRUE) == 1;
break;
case LinphonePolicyUseStun:
} else if (linphone_nat_policy_stun_enabled(nat_policy)) {
call->ping_time=linphone_core_run_stun_tests(call->core,call);
/* No break to also destroy ice session in this case. */
break;
case LinphonePolicyUseUpnp:
} else if (linphone_nat_policy_upnp_enabled(nat_policy)) {
#ifdef BUILD_UPNP
if(!lc->rtp_conf.disable_upnp) {
call->upnp_session = linphone_upnp_session_new(call);
@ -1421,9 +1425,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
}
}
#endif //BUILD_UPNP
break;
default:
break;
}
}
discover_mtu(lc,linphone_address_get_domain(from));
@ -1440,11 +1442,11 @@ void linphone_call_free_media_resources(LinphoneCall *call){
int i;
linphone_call_stop_media_streams(call);
linphone_call_delete_upnp_session(call);
linphone_call_delete_ice_session(call);
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++i){
ms_media_stream_sessions_uninit(&call->sessions[i]);
}
linphone_call_delete_upnp_session(call);
linphone_call_delete_ice_session(call);
linphone_call_stats_uninit(&call->stats[LINPHONE_CALL_STATS_AUDIO]);
linphone_call_stats_uninit(&call->stats[LINPHONE_CALL_STATS_VIDEO]);
linphone_call_stats_uninit(&call->stats[LINPHONE_CALL_STATS_TEXT]);
@ -2468,13 +2470,15 @@ void linphone_call_init_audio_stream(LinphoneCall *call){
/* init zrtp even if we didn't explicitely set it, just in case peer offers it */
if (ms_zrtp_available()) {
char *uri = linphone_address_as_string_uri_only((call->dir==LinphoneCallIncoming) ? call->log->from : call->log->to);
MSZrtpParams params;
memset(&params,0,sizeof(MSZrtpParams));
/*call->current_params.media_encryption will be set later when zrtp is activated*/
params.zid_file=lc->zrtp_secrets_cache;
params.uri= linphone_address_as_string_uri_only((call->dir==LinphoneCallIncoming) ? call->log->from : call->log->to);
params.uri=uri;
setZrtpCryptoTypesParameters(&params,call->core);
audio_stream_enable_zrtp(call->audiostream,&params);
if (uri != NULL) ms_free(uri);
}
media_stream_reclaim_sessions(&audiostream->ms, &call->sessions[call->main_audio_stream_index]);
@ -2704,14 +2708,14 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){
const char *gains=lp_config_get_string(lc->config,"sound","mic_eq_gains",NULL);
ms_filter_call_method(f,MS_EQUALIZER_SET_ACTIVE,&enabled);
if (enabled && gains){
MSList *gains_list = ms_parse_equalizer_string(gains);
MSList *it;
bctbx_list_t *gains_list = ms_parse_equalizer_string(gains);
bctbx_list_t *it;
for(it=gains_list; it; it=it->next) {
MSEqualizerGain *g = (MSEqualizerGain *)it->data;
ms_message("Read microphone equalizer gains: %f(~%f) --> %f",g->frequency,g->width,g->gain);
ms_filter_call_method(f,MS_EQUALIZER_SET_GAIN, g);
}
if(gains_list) ms_list_free_with_data(gains_list, ms_free);
if(gains_list) bctbx_list_free_with_data(gains_list, ms_free);
}
}
if (st->spk_equalizer){
@ -2720,14 +2724,14 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){
const char *gains=lp_config_get_string(lc->config,"sound","spk_eq_gains",NULL);
ms_filter_call_method(f,MS_EQUALIZER_SET_ACTIVE,&enabled);
if (enabled && gains){
MSList *gains_list = ms_parse_equalizer_string(gains);
MSList *it;
bctbx_list_t *gains_list = ms_parse_equalizer_string(gains);
bctbx_list_t *it;
for(it=gains_list; it; it=it->next) {
MSEqualizerGain *g = (MSEqualizerGain *)it->data;
ms_message("Read speaker equalizer gains: %f(~%f) --> %f",g->frequency,g->width,g->gain);
ms_filter_call_method(f,MS_EQUALIZER_SET_GAIN, g);
}
if(gains_list) ms_list_free_with_data(gains_list, ms_free);
if(gains_list) bctbx_list_free_with_data(gains_list, ms_free);
}
}
}
@ -2860,7 +2864,7 @@ static int get_video_bw(LinphoneCall *call, const SalMediaDescription *md, const
static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *md, const SalStreamDescription *desc, int *used_pt){
int bw=0;
const MSList *elem;
const bctbx_list_t *elem;
RtpProfile *prof=rtp_profile_new("Call profile");
bool_t first=TRUE;
LinphoneCore *lc=call->core;
@ -4636,16 +4640,16 @@ void linphone_call_log_completed(LinphoneCall *call){
}
#endif
if (!call_logs_sqlite_db_found) {
lc->call_logs=ms_list_prepend(lc->call_logs,linphone_call_log_ref(call->log));
if (ms_list_size(lc->call_logs)>lc->max_call_logs){
MSList *elem,*prevelem=NULL;
lc->call_logs=bctbx_list_prepend(lc->call_logs,linphone_call_log_ref(call->log));
if (bctbx_list_size(lc->call_logs)>(size_t)lc->max_call_logs){
bctbx_list_t *elem,*prevelem=NULL;
/*find the last element*/
for(elem=lc->call_logs;elem!=NULL;elem=elem->next){
prevelem=elem;
}
elem=prevelem;
linphone_call_log_unref((LinphoneCallLog*)elem->data);
lc->call_logs=ms_list_remove_link(lc->call_logs,elem);
lc->call_logs=bctbx_list_remove_link(lc->call_logs,elem);
}
call_logs_write_to_config_file(lc);
}

File diff suppressed because it is too large Load diff

View file

@ -406,6 +406,7 @@ LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
#include "content.h"
#include "event.h"
#include "linphonefriend.h"
#include "nat_policy.h"
#include "xmlrpc.h"
#include "conference.h"
#else
@ -415,6 +416,7 @@ LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
#include "linphone/content.h"
#include "linphone/event.h"
#include "linphone/linphonefriend.h"
#include "linphone/nat_policy.h"
#include "linphone/xmlrpc.h"
#include "linphone/conference.h"
#endif
@ -1474,7 +1476,7 @@ LINPHONE_PUBLIC int linphone_chat_room_get_history_size(LinphoneChatRoom *cr);
* @param[in] nb_message Number of message to retrieve. 0 means everything.
* @return \mslist{LinphoneChatMessage}
*/
LINPHONE_PUBLIC MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message);
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message);
/**
* Gets the partial list of messages in the given range, sorted from oldest to most recent.
@ -1483,7 +1485,7 @@ LINPHONE_PUBLIC MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int
* @param[in] end The last message of the range to be retrieved. History oldest message has index of history size - 1 (use #linphone_chat_room_get_history_size to retrieve history size)
* @return \mslist{LinphoneChatMessage}
*/
LINPHONE_PUBLIC MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end);
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end);
/**
* Notifies the destination of the chat message being composed that the user is typing a new message.
@ -1534,7 +1536,7 @@ LINPHONE_PUBLIC uint32_t linphone_chat_room_get_char(const LinphoneChatRoom *cr)
* @param[in] lc #LinphoneCore object
* @return \mslist{LinphoneChatRoom}
**/
LINPHONE_PUBLIC const MSList* linphone_core_get_chat_rooms(LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t* linphone_core_get_chat_rooms(LinphoneCore *lc);
LINPHONE_PUBLIC unsigned int linphone_chat_message_store(LinphoneChatMessage *msg);
/**
@ -2194,6 +2196,7 @@ typedef struct _LCCallbackObj
/**
* Policy to use to pass through firewalls.
* @ingroup network_parameters
* @deprecated Use LinphoneNatPolicy instead
**/
typedef enum _LinphoneFirewallPolicy {
LinphonePolicyNoFirewall, /**< Do not use any mechanism to pass through firewalls */
@ -2264,7 +2267,7 @@ LINPHONE_PUBLIC void linphone_core_set_log_collection_prefix(const char *prefix)
* Get the max file size in bytes of the files used for log collection.
* @return The max file size in bytes of the files used for log collection.
*/
LINPHONE_PUBLIC int linphone_core_get_log_collection_max_file_size(void);
LINPHONE_PUBLIC size_t linphone_core_get_log_collection_max_file_size(void);
/**
* Set the max file size in bytes of the files used for log collection.
@ -2274,7 +2277,7 @@ LINPHONE_PUBLIC int linphone_core_get_log_collection_max_file_size(void);
* on runtime, logs chronological order COULD be broken.
* @param[in] size The max file size in bytes of the files used for log collection.
*/
LINPHONE_PUBLIC void linphone_core_set_log_collection_max_file_size(int size);
LINPHONE_PUBLIC void linphone_core_set_log_collection_max_file_size(size_t size);
/**
* Set the url of the server where to upload the collected log files.
@ -2754,58 +2757,58 @@ LINPHONE_PUBLIC bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc);
/**
* Forces liblinphone to use the supplied list of dns servers, instead of system's ones.
* @param[in] lc #LinphoneCore object.
* @param[in] servers A #MSList of strings containing the IP addresses of DNS servers to be used.
* @param[in] servers A #bctbx_list_t of strings containing the IP addresses of DNS servers to be used.
* Setting to NULL restores default behaviour, which is to use the DNS server list provided by the system.
* The list is copied internally.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC void linphone_core_set_dns_servers(LinphoneCore *lc, const MSList *servers);
LINPHONE_PUBLIC void linphone_core_set_dns_servers(LinphoneCore *lc, const bctbx_list_t *servers);
/**
* Returns the list of available audio codecs.
* @param[in] lc The LinphoneCore object
* @return \mslist{PayloadType}
*
* This list is unmodifiable. The ->data field of the MSList points a PayloadType
* This list is unmodifiable. The ->data field of the bctbx_list_t points a PayloadType
* structure holding the codec information.
* It is possible to make copy of the list with ms_list_copy() in order to modify it
* It is possible to make copy of the list with bctbx_list_copy() in order to modify it
* (such as the order of codecs).
* @ingroup media_parameters
**/
LINPHONE_PUBLIC const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_audio_codecs(const LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs);
LINPHONE_PUBLIC int linphone_core_set_audio_codecs(LinphoneCore *lc, bctbx_list_t *codecs);
/**
* Returns the list of available video codecs.
* @param[in] lc The LinphoneCore object
* @return \mslist{PayloadType}
*
* This list is unmodifiable. The ->data field of the MSList points a PayloadType
* This list is unmodifiable. The ->data field of the bctbx_list_t points a PayloadType
* structure holding the codec information.
* It is possible to make copy of the list with ms_list_copy() in order to modify it
* It is possible to make copy of the list with bctbx_list_copy() in order to modify it
* (such as the order of codecs).
* @ingroup media_parameters
**/
LINPHONE_PUBLIC const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_video_codecs(const LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs);
LINPHONE_PUBLIC int linphone_core_set_video_codecs(LinphoneCore *lc, bctbx_list_t *codecs);
/**
* Returns the list of available text codecs.
* @param[in] lc The LinphoneCore object
* @return \mslist{PayloadType}
*
* This list is unmodifiable. The ->data field of the MSList points a PayloadType
* This list is unmodifiable. The ->data field of the bctbx_list_t points a PayloadType
* structure holding the codec information.
* It is possible to make copy of the list with ms_list_copy() in order to modify it
* It is possible to make copy of the list with bctbx_list_copy() in order to modify it
* (such as the order of codecs).
* @ingroup media_parameters
**/
LINPHONE_PUBLIC const MSList *linphone_core_get_text_codecs(const LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_text_codecs(const LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_set_text_codecs(LinphoneCore *lc, MSList *codecs);
LINPHONE_PUBLIC int linphone_core_set_text_codecs(LinphoneCore *lc, bctbx_list_t *codecs);
LINPHONE_PUBLIC void linphone_core_enable_generic_confort_noise(LinphoneCore *lc, bool_t enabled);
@ -2932,7 +2935,7 @@ LINPHONE_PUBLIC void linphone_core_remove_proxy_config(LinphoneCore *lc, Linphon
* @param[in] lc The LinphoneCore object
* @return \mslist{LinphoneProxyConfig}
**/
LINPHONE_PUBLIC const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_proxy_config_list(const LinphoneCore *lc);
/** @deprecated Use linphone_core_set_default_proxy_config() instead. */
#define linphone_core_set_default_proxy(lc, config) linphone_core_set_default_proxy_config(lc, config)
@ -2985,7 +2988,7 @@ LINPHONE_PUBLIC void linphone_core_add_auth_info(LinphoneCore *lc, const Linphon
LINPHONE_PUBLIC void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
LINPHONE_PUBLIC const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_auth_info_list(const LinphoneCore *lc);
/**
* Find authentication info matching realm, username, domain criteria.
@ -3192,6 +3195,7 @@ LINPHONE_PUBLIC const char *linphone_core_get_nat_address(const LinphoneCore *lc
* @param[in] lc #LinphoneCore object.
* @param[in] pol The #LinphoneFirewallPolicy to use.
* @ingroup network_parameters
* @deprecated Use linphone_core_set_nat_policy() instead.
*/
LINPHONE_PUBLIC void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol);
@ -3200,9 +3204,30 @@ LINPHONE_PUBLIC void linphone_core_set_firewall_policy(LinphoneCore *lc, Linphon
* @param[in] lc #LinphoneCore object.
* @return The #LinphoneFirewallPolicy that is being used.
* @ingroup network_parameters
* @deprecated Use linphone_core_get_nat_policy() instead.
*/
LINPHONE_PUBLIC LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc);
/**
* Set the policy to use to pass through NATs/firewalls.
* It may be overridden by a NAT policy for a specific proxy config.
* @param[in] lc #LinphoneCore object
* @param[in] policy LinphoneNatPolicy object
* @ingroup network_parameters
* @see linphone_proxy_config_set_nat_policy()
*/
LINPHONE_PUBLIC void linphone_core_set_nat_policy(LinphoneCore *lc, LinphoneNatPolicy *policy);
/**
* Get The policy that is used to pass through NATs/firewalls.
* It may be overridden by a NAT policy for a specific proxy config.
* @param[in] lc #LinphoneCore object
* @return LinphoneNatPolicy object in use.
* @ingroup network_parameters
* @see linphone_proxy_config_get_nat_policy()
*/
LINPHONE_PUBLIC LinphoneNatPolicy * linphone_core_get_nat_policy(const LinphoneCore *lc);
/* sound functions */
/* returns a null terminated static array of string describing the sound devices */
LINPHONE_PUBLIC const char** linphone_core_get_sound_devices(LinphoneCore *lc);
@ -3365,7 +3390,7 @@ LINPHONE_PUBLIC void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *l
* @param[in] lc LinphoneCore object
* @return \mslist{LinphoneCallLog}
**/
LINPHONE_PUBLIC const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_call_logs(LinphoneCore *lc);
/**
* Get the list of call logs (past calls) that matches the given #LinphoneAddress.
@ -3374,7 +3399,7 @@ LINPHONE_PUBLIC const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
* @param[in] addr LinphoneAddress object
* @return \mslist{LinphoneCallLog}
**/
LINPHONE_PUBLIC MSList * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr);
LINPHONE_PUBLIC bctbx_list_t * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr);
/**
* Get the latest outgoing call log.
@ -3862,7 +3887,7 @@ LINPHONE_PUBLIC LpConfig * linphone_core_create_lp_config(LinphoneCore *lc, cons
LINPHONE_PUBLIC void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneCoreWaitingCallback cb, void *user_context);
/*returns the list of registered SipSetup (linphonecore plugins) */
LINPHONE_PUBLIC const MSList * linphone_core_get_sip_setups(LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_sip_setups(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_destroy(LinphoneCore *lc);
@ -3886,7 +3911,7 @@ int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, r
LINPHONE_PUBLIC int linphone_core_get_calls_nb(const LinphoneCore *lc);
LINPHONE_PUBLIC const MSList *linphone_core_get_calls(LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_calls(LinphoneCore *lc);
LINPHONE_PUBLIC LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc);
/**
@ -4162,7 +4187,7 @@ typedef unsigned int ContactSearchID;
typedef struct _LinphoneContactSearch LinphoneContactSearch;
typedef struct _LinphoneContactProvider LinphoneContactProvider;
typedef void (*ContactSearchCallback)( LinphoneContactSearch* id, MSList* friends, void* data );
typedef void (*ContactSearchCallback)( LinphoneContactSearch* id, bctbx_list_t* friends, void* data );
/*
* Remote provisioning

File diff suppressed because it is too large Load diff

View file

@ -176,7 +176,7 @@ LINPHONE_PUBLIC void linphone_friend_add_address(LinphoneFriend *lf, const Linph
* @param lf #LinphoneFriend object
* @return \mslist{LinphoneAddress}
*/
LINPHONE_PUBLIC MSList* linphone_friend_get_addresses(LinphoneFriend *lf);
LINPHONE_PUBLIC bctbx_list_t* linphone_friend_get_addresses(LinphoneFriend *lf);
/**
* Removes an address in this friend
@ -197,7 +197,7 @@ LINPHONE_PUBLIC void linphone_friend_add_phone_number(LinphoneFriend *lf, const
* @param lf #LinphoneFriend object
* @return \mslist{const char *}
*/
LINPHONE_PUBLIC MSList* linphone_friend_get_phone_numbers(LinphoneFriend *lf);
LINPHONE_PUBLIC bctbx_list_t* linphone_friend_get_phone_numbers(LinphoneFriend *lf);
/**
* Removes a phone number in this friend
@ -430,7 +430,7 @@ LINPHONE_PUBLIC void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneF
* @return \mslist{LinphoneFriend}
* @deprecated use linphone_core_get_friends_lists() or linphone_friend_list_get_friends() instead.
*/
LINPHONE_PUBLIC const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_friend_list(const LinphoneCore *lc);
/**
* Notify all friends that have subscribed

View file

@ -74,8 +74,8 @@ typedef struct _LpSectionParam{
typedef struct _LpSection{
char *name;
MSList *items;
MSList *params;
bctbx_list_t *items;
bctbx_list_t *params;
bool_t overwrite; // If set to true, will add overwrite=true to all items of this section when converted to xml
bool_t skip; // If set to true, won't be dumped when converted to xml
} LpSection;
@ -85,7 +85,7 @@ struct _LpConfig{
bctbx_vfs_file_t* pFile;
char *filename;
char *tmpfilename;
MSList *sections;
bctbx_list_t *sections;
int modified;
int readonly;
bctbx_vfs_t* g_bctbx_vfs;
@ -156,31 +156,31 @@ void lp_section_param_destroy(void *section_param){
void lp_section_destroy(LpSection *sec){
ortp_free(sec->name);
ms_list_for_each(sec->items,lp_item_destroy);
ms_list_for_each(sec->params,lp_section_param_destroy);
ms_list_free(sec->items);
bctbx_list_for_each(sec->items,lp_item_destroy);
bctbx_list_for_each(sec->params,lp_section_param_destroy);
bctbx_list_free(sec->items);
free(sec);
}
void lp_section_add_item(LpSection *sec,LpItem *item){
sec->items=ms_list_append(sec->items,(void *)item);
sec->items=bctbx_list_append(sec->items,(void *)item);
}
void lp_config_add_section(LpConfig *lpconfig, LpSection *section){
lpconfig->sections=ms_list_append(lpconfig->sections,(void *)section);
lpconfig->sections=bctbx_list_append(lpconfig->sections,(void *)section);
}
void lp_config_add_section_param(LpSection *section, LpSectionParam *param){
section->params = ms_list_append(section->params, (void *)param);
section->params = bctbx_list_append(section->params, (void *)param);
}
void lp_config_remove_section(LpConfig *lpconfig, LpSection *section){
lpconfig->sections=ms_list_remove(lpconfig->sections,(void *)section);
lpconfig->sections=bctbx_list_remove(lpconfig->sections,(void *)section);
lp_section_destroy(section);
}
void lp_section_remove_item(LpSection *sec, LpItem *item){
sec->items=ms_list_remove(sec->items,(void *)item);
sec->items=bctbx_list_remove(sec->items,(void *)item);
lp_item_destroy(item);
}
@ -202,9 +202,9 @@ static int is_a_comment(const char *str){
LpSection *lp_config_find_section(const LpConfig *lpconfig, const char *name){
LpSection *sec;
MSList *elem;
bctbx_list_t *elem;
/*printf("Looking for section %s\n",name);*/
for (elem=lpconfig->sections;elem!=NULL;elem=ms_list_next(elem)){
for (elem=lpconfig->sections;elem!=NULL;elem=bctbx_list_next(elem)){
sec=(LpSection*)elem->data;
if (strcmp(sec->name,name)==0){
/*printf("Section %s found\n",name);*/
@ -215,9 +215,9 @@ LpSection *lp_config_find_section(const LpConfig *lpconfig, const char *name){
}
LpSectionParam *lp_section_find_param(const LpSection *sec, const char *key){
MSList *elem;
bctbx_list_t *elem;
LpSectionParam *param;
for (elem = sec->params; elem != NULL; elem = ms_list_next(elem)){
for (elem = sec->params; elem != NULL; elem = bctbx_list_next(elem)){
param = (LpSectionParam*)elem->data;
if (strcmp(param->key, key) == 0) {
return param;
@ -227,10 +227,10 @@ LpSectionParam *lp_section_find_param(const LpSection *sec, const char *key){
}
LpItem *lp_section_find_comment(const LpSection *sec, const char *comment){
MSList *elem;
bctbx_list_t *elem;
LpItem *item;
/*printf("Looking for item %s\n",name);*/
for (elem=sec->items;elem!=NULL;elem=ms_list_next(elem)){
for (elem=sec->items;elem!=NULL;elem=bctbx_list_next(elem)){
item=(LpItem*)elem->data;
if (item->is_comment && strcmp(item->value,comment)==0) {
/*printf("Item %s found\n",name);*/
@ -241,10 +241,10 @@ LpItem *lp_section_find_comment(const LpSection *sec, const char *comment){
}
LpItem *lp_section_find_item(const LpSection *sec, const char *name){
MSList *elem;
bctbx_list_t *elem;
LpItem *item;
/*printf("Looking for item %s\n",name);*/
for (elem=sec->items;elem!=NULL;elem=ms_list_next(elem)){
for (elem=sec->items;elem!=NULL;elem=bctbx_list_next(elem)){
item=(LpItem*)elem->data;
if (!item->is_comment && strcmp(item->key,name)==0) {
/*printf("Item %s found\n",name);*/
@ -488,8 +488,8 @@ void lp_item_set_value(LpItem *item, const char *value){
static void _lp_config_destroy(LpConfig *lpconfig){
if (lpconfig->filename!=NULL) ortp_free(lpconfig->filename);
if (lpconfig->tmpfilename) ortp_free(lpconfig->tmpfilename);
ms_list_for_each(lpconfig->sections,(void (*)(void*))lp_section_destroy);
ms_list_free(lpconfig->sections);
bctbx_list_for_each(lpconfig->sections,(void (*)(void*))lp_section_destroy);
bctbx_list_free(lpconfig->sections);
free(lpconfig);
}
@ -530,6 +530,31 @@ const char *lp_config_get_string(const LpConfig *lpconfig, const char *section,
return default_string;
}
bctbx_list_t * lp_config_get_string_list(const LpConfig *lpconfig, const char *section, const char *key, bctbx_list_t *default_list) {
LpItem *item;
LpSection *sec = lp_config_find_section(lpconfig, section);
if (sec != NULL) {
item = lp_section_find_item(sec, key);
if (item != NULL) {
bctbx_list_t *l = NULL;
char *str;
char *ptr;
str = ptr = ms_strdup(item->value);
while (ptr != NULL) {
char *next = strstr(ptr, ",");
if (next != NULL) {
*(next++) = '\0';
}
l = bctbx_list_append(l, ms_strdup(ptr));
ptr = next;
}
ms_free(str);
return l;
}
}
return default_list;
}
bool_t lp_config_get_range(const LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max) {
const char *str = lp_config_get_string(lpconfig, section, key, NULL);
if (str != NULL) {
@ -645,6 +670,22 @@ void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *ke
lpconfig->modified++;
}
void lp_config_set_string_list(LpConfig *lpconfig, const char *section, const char *key, const bctbx_list_t *value) {
char *strvalue = NULL;
char *tmp = NULL;
const bctbx_list_t *elem;
for (elem = value; elem != NULL; elem = elem->next) {
if (strvalue) {
tmp = ms_strdup_printf("%s,%s", strvalue, (const char *)elem->data);
ms_free(strvalue);
strvalue = tmp;
}
else strvalue = ms_strdup((const char *)elem->data);
}
lp_config_set_string(lpconfig, section, key, strvalue);
if (strvalue) ms_free(strvalue);
}
void lp_config_set_range(LpConfig *lpconfig, const char *section, const char *key, int min_value, int max_value) {
char tmp[30];
snprintf(tmp, sizeof(tmp), "%i-%i", min_value, max_value);
@ -742,10 +783,10 @@ void lp_section_param_write(LpSectionParam *param, LpConfig *lpconfig){
void lp_section_write(LpSection *sec,LpConfig *lpconfig){
if (bctbx_file_fprintf(lpconfig->pFile, 0, "[%s",sec->name) < 0) ms_error("lp_section_write : write error on %s", sec->name);
ms_list_for_each2(sec->params, (void (*)(void*, void*))lp_section_param_write, (void *)lpconfig);
bctbx_list_for_each2(sec->params, (void (*)(void*, void*))lp_section_param_write, (void *)lpconfig);
if (bctbx_file_fprintf(lpconfig->pFile, 0, "]\n")< 0) ms_error("lp_section_write : write error ");
ms_list_for_each2(sec->items, (void (*)(void*, void*))lp_item_write, (void *)lpconfig);
bctbx_list_for_each2(sec->items, (void (*)(void*, void*))lp_item_write, (void *)lpconfig);
if (bctbx_file_fprintf(lpconfig->pFile, 0, "\n")< 0) ms_error("lp_section_write : write error");
@ -770,7 +811,7 @@ int lp_config_sync(LpConfig *lpconfig){
return -1;
}
ms_list_for_each2(lpconfig->sections,(void (*)(void *,void*))lp_section_write,(void *)lpconfig);
bctbx_list_for_each2(lpconfig->sections,(void (*)(void *,void*))lp_section_write,(void *)lpconfig);
bctbx_file_close(pFile);
#ifdef RENAME_REQUIRES_NONEXISTENT_NEW_PATH
@ -794,8 +835,8 @@ int lp_config_has_section(const LpConfig *lpconfig, const char *section){
void lp_config_for_each_section(const LpConfig *lpconfig, void (*callback)(const char *section, void *ctx), void *ctx) {
LpSection *sec;
MSList *elem;
for (elem=lpconfig->sections;elem!=NULL;elem=ms_list_next(elem)){
bctbx_list_t *elem;
for (elem=lpconfig->sections;elem!=NULL;elem=bctbx_list_next(elem)){
sec=(LpSection*)elem->data;
callback(sec->name, ctx);
}
@ -803,10 +844,10 @@ void lp_config_for_each_section(const LpConfig *lpconfig, void (*callback)(const
void lp_config_for_each_entry(const LpConfig *lpconfig, const char *section, void (*callback)(const char *entry, void *ctx), void *ctx) {
LpItem *item;
MSList *elem;
bctbx_list_t *elem;
LpSection *sec=lp_config_find_section(lpconfig,section);
if (sec!=NULL){
for (elem=sec->items;elem!=NULL;elem=ms_list_next(elem)){
for (elem=sec->items;elem!=NULL;elem=bctbx_list_next(elem)){
item=(LpItem*)elem->data;
if (!item->is_comment)
callback(item->key, ctx);
@ -1003,11 +1044,11 @@ err:
const char** lp_config_get_sections_names(LpConfig *lpconfig) {
const char **sections_names;
const MSList *sections = lpconfig->sections;
const bctbx_list_t *sections = lpconfig->sections;
int ndev;
int i;
ndev = ms_list_size(sections);
ndev = bctbx_list_size(sections);
sections_names = ms_malloc((ndev + 1) * sizeof(const char *));
for (i = 0; sections != NULL; sections = sections->next, i++) {

View file

@ -104,6 +104,18 @@ LINPHONE_PUBLIC int lp_config_read_file(LpConfig *lpconfig, const char *filename
**/
LINPHONE_PUBLIC const char *lp_config_get_string(const LpConfig *lpconfig, const char *section, const char *key, const char *default_string);
/**
* Retrieves a configuration item as a list of strings, given its section, key, and default value.
* The default value is returned if the config item is not found.
* @ingroup misc
* @param[in] lpconfig A LpConfig object
* @param[in] section The section from which to retrieve a configuration item
* @param[in] key The name of the configuration item to retrieve
* @param[in] default_list \mslist{const char *}
* @return \mslist{const char *}
*/
LINPHONE_PUBLIC bctbx_list_t * lp_config_get_string_list(const LpConfig *lpconfig, const char *section, const char *key, bctbx_list_t *default_list);
/**
* Retrieves a configuration item as a range, given its section, key, and default min and max values.
*
@ -144,6 +156,16 @@ LINPHONE_PUBLIC float lp_config_get_float(const LpConfig *lpconfig,const char *s
**/
LINPHONE_PUBLIC void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *key, const char *value);
/**
* Sets a string list config item
* @ingroup misc
* @param[in] lpconfig A LpConfig object
* @param[in] section The name of the section to put the configuration item into
* @param[in] key The name of the configuration item to set
* @param[in] value \mslist{const char *} The value to set
*/
LINPHONE_PUBLIC void lp_config_set_string_list(LpConfig *lpconfig, const char *section, const char *key, const bctbx_list_t *value);
/**
* Sets a range config item
*

View file

@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "sqlite3.h"
#include <assert.h>
static char *utf8_convert(const char *filename){
char db_file_utf8[MAX_PATH_SIZE] = "";
#if defined(_WIN32)
@ -79,8 +80,11 @@ int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) {
flags |= SQLITE_OPEN_FILEPROTECTION_NONE;
#endif
/*since we plug our vfs into sqlite, we convert to UTF-8.
* On Windows, the filename has to be converted back to windows native charset.*/
char *utf8_filename = utf8_convert(db_file);
ret = sqlite3_open_v2(utf8_filename, db, flags, LINPHONE_SQLITE3_VFS);
//ret = sqlite3_open_v2(utf8_filename, db, flags, LINPHONE_SQLITE3_VFS);
ret = sqlite3_open_v2(utf8_filename, db, flags, NULL); // Do not use VFS until all issues are resolved
ms_free(utf8_filename);
if (ret != SQLITE_OK) return ret;
@ -109,7 +113,7 @@ int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) {
static ORTP_INLINE LinphoneChatMessage* get_transient_message(LinphoneChatRoom* cr, unsigned int storage_id){
MSList* transients = cr->transient_messages;
bctbx_list_t* transients = cr->transient_messages;
LinphoneChatMessage* chat;
while( transients ){
chat = (LinphoneChatMessage*)transients->data;
@ -195,7 +199,7 @@ static int callback_all(void *data, int argc, char **argv, char **colName){
*/
static int create_chat_message(void *data, int argc, char **argv, char **colName){
LinphoneChatRoom *cr = (LinphoneChatRoom *)data;
unsigned int storage_id = atoi(argv[0]);
unsigned int storage_id = (unsigned int)atoi(argv[0]);
// check if the message exists in the transient list, in which case we should return that one.
LinphoneChatMessage* new_message = get_transient_message(cr, storage_id);
@ -227,7 +231,7 @@ static int create_chat_message(void *data, int argc, char **argv, char **colName
}
}
}
cr->messages_hist=ms_list_prepend(cr->messages_hist,new_message);
cr->messages_hist=bctbx_list_prepend(cr->messages_hist,new_message);
return 0;
}
@ -326,7 +330,7 @@ unsigned int linphone_chat_message_store(LinphoneChatMessage *msg){
void linphone_chat_message_store_state(LinphoneChatMessage *msg){
LinphoneCore *lc=msg->chat_room->lc;
if (lc->db){
char *buf=sqlite3_mprintf("UPDATE history SET status=%i WHERE (id = %i);",
char *buf=sqlite3_mprintf("UPDATE history SET status=%i WHERE (id = %u);",
msg->state,msg->storage_id);
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
@ -336,7 +340,7 @@ void linphone_chat_message_store_state(LinphoneChatMessage *msg){
void linphone_chat_message_store_appdata(LinphoneChatMessage* msg){
LinphoneCore *lc=msg->chat_room->lc;
if (lc->db){
char *buf=sqlite3_mprintf("UPDATE history SET appdata=%Q WHERE id=%i;",
char *buf=sqlite3_mprintf("UPDATE history SET appdata=%Q WHERE id=%u;",
msg->appdata,msg->storage_id);
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
@ -370,7 +374,7 @@ void linphone_chat_room_update_url(LinphoneChatRoom *cr, LinphoneChatMessage *ms
if (lc->db==NULL) return ;
buf=sqlite3_mprintf("UPDATE history SET url=%Q WHERE id=%i;",msg->external_body_url,msg->storage_id);
buf=sqlite3_mprintf("UPDATE history SET url=%Q WHERE id=%u;",msg->external_body_url,msg->storage_id);
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
}
@ -421,7 +425,7 @@ void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage
if (lc->db==NULL) return ;
buf=sqlite3_mprintf("DELETE FROM history WHERE id = %i;", msg->storage_id);
buf=sqlite3_mprintf("DELETE FROM history WHERE id = %u;", msg->storage_id);
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
@ -446,9 +450,9 @@ void linphone_chat_room_delete_history(LinphoneChatRoom *cr){
if(cr->unread_count > 0) cr->unread_count = 0;
}
MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, int endm){
bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, int endm){
LinphoneCore *lc=linphone_chat_room_get_core(cr);
MSList *ret;
bctbx_list_t *ret;
char *buf,*buf2;
char *peer;
uint64_t begin,end;
@ -498,7 +502,7 @@ MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, i
return ret;
}
MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
return linphone_chat_room_get_history_range(cr, 0, nb_message-1);
}
@ -735,11 +739,11 @@ void linphone_chat_message_store_appdata(LinphoneChatMessage *msg){
void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr){
}
MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message){
return NULL;
}
LINPHONE_PUBLIC MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end){
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end){
return NULL;
}

View file

@ -62,7 +62,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void clear_ice_check_list(LinphoneCall *call, IceCheckList *removed);
bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const LinphonePayloadType *pt){
if (ms_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || ms_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt) || ms_list_find(lc->codecs_conf.text_codecs, (PayloadType*)pt)){
if (bctbx_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || bctbx_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt) || bctbx_list_find(lc->codecs_conf.text_codecs, (PayloadType*)pt)){
return payload_type_enabled(pt);
}
ms_error("Getting enablement status of codec not in audio or video list of PayloadType !");
@ -75,7 +75,7 @@ bool_t linphone_core_payload_type_is_vbr(LinphoneCore *lc, const LinphonePayload
}
int linphone_core_enable_payload_type(LinphoneCore *lc, LinphonePayloadType *pt, bool_t enabled){
if (ms_list_find(lc->codecs_conf.audio_codecs,pt) || ms_list_find(lc->codecs_conf.video_codecs,pt) || ms_list_find(lc->codecs_conf.text_codecs,pt)){
if (bctbx_list_find(lc->codecs_conf.audio_codecs,pt) || bctbx_list_find(lc->codecs_conf.video_codecs,pt) || bctbx_list_find(lc->codecs_conf.text_codecs,pt)){
payload_type_set_enable(pt,enabled);
_linphone_core_codec_config_write(lc);
linphone_core_update_allocated_audio_bandwidth(lc);
@ -107,7 +107,7 @@ const char *linphone_core_get_payload_type_description(LinphoneCore *lc, Payload
}
void linphone_core_set_payload_type_bitrate(LinphoneCore *lc, LinphonePayloadType *pt, int bitrate){
if (ms_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || ms_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt) || ms_list_find(lc->codecs_conf.text_codecs, (PayloadType*)pt)){
if (bctbx_list_find(lc->codecs_conf.audio_codecs, (PayloadType*) pt) || bctbx_list_find(lc->codecs_conf.video_codecs, (PayloadType*)pt) || bctbx_list_find(lc->codecs_conf.text_codecs, (PayloadType*)pt)){
if (pt->type==PAYLOAD_VIDEO || pt->flags & PAYLOAD_TYPE_IS_VBR){
pt->normal_bitrate=bitrate*1000;
pt->flags|=PAYLOAD_TYPE_BITRATE_OVERRIDE;
@ -204,7 +204,7 @@ void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call,
}
void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc){
const MSList *elem;
const bctbx_list_t *elem;
int maxbw=get_min_bandwidth(linphone_core_get_download_bandwidth(lc),
linphone_core_get_upload_bandwidth(lc));
int max_codec_bitrate=0;
@ -317,28 +317,30 @@ static ortp_socket_t create_socket(int local_port){
return sock;
}
static int sendStunRequest(int sock, const struct sockaddr *server, socklen_t addrlen, int id, bool_t changeAddr){
char buf[STUN_MAX_MESSAGE_SIZE];
int len = STUN_MAX_MESSAGE_SIZE;
StunAtrString username;
StunAtrString password;
StunMessage req;
int err;
memset(&req, 0, sizeof(StunMessage));
memset(&username,0,sizeof(username));
memset(&password,0,sizeof(password));
stunBuildReqSimple( &req, &username, changeAddr , changeAddr , id);
len = stunEncodeMessage( &req, buf, len, &password);
if (len<=0){
static int send_stun_request(int sock, const struct sockaddr *server, socklen_t addrlen, int id, bool_t change_addr){
char *buf = NULL;
int len;
int err = 0;
MSStunMessage *req = ms_stun_binding_request_create();
UInt96 tr_id = ms_stun_message_get_tr_id(req);
tr_id.octet[0] = id;
ms_stun_message_set_tr_id(req, tr_id);
ms_stun_message_enable_change_ip(req, change_addr);
ms_stun_message_enable_change_port(req, change_addr);
len = ms_stun_message_encode(req, &buf);
if (len <= 0) {
ms_error("Fail to encode stun message.");
return -1;
err = -1;
} else {
err = sendto(sock, buf, len, 0, server, addrlen);
if (err < 0) {
ms_error("sendto failed: %s",strerror(errno));
err = -1;
}
}
err=sendto(sock,buf,len,0,server,addrlen);
if (err<0){
ms_error("sendto failed: %s",strerror(errno));
return -1;
}
return 0;
if (buf != NULL) ms_free(buf);
ms_free(req);
return err;
}
int linphone_parse_host_port(const char *input, char *host, size_t hostlen, int *port){
@ -387,23 +389,32 @@ int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, sock
return 0;
}
static int recvStunResponse(ortp_socket_t sock, char *ipaddr, int *port, int *id){
char buf[STUN_MAX_MESSAGE_SIZE];
int len = STUN_MAX_MESSAGE_SIZE;
StunMessage resp;
len=recv(sock,buf,len,0);
if (len>0){
static int recv_stun_response(ortp_socket_t sock, char *ipaddr, int *port, int *id) {
char buf[MS_STUN_MAX_MESSAGE_SIZE];
int len = MS_STUN_MAX_MESSAGE_SIZE;
MSStunMessage *resp;
len = recv(sock, buf, len, 0);
if (len > 0) {
struct in_addr ia;
stunParseMessage(buf,len, &resp );
*id=resp.msgHdr.tr_id.octet[0];
if (resp.hasXorMappedAddress){
*port = resp.xorMappedAddress.ipv4.port;
ia.s_addr=htonl(resp.xorMappedAddress.ipv4.addr);
}else if (resp.hasMappedAddress){
*port = resp.mappedAddress.ipv4.port;
ia.s_addr=htonl(resp.mappedAddress.ipv4.addr);
}else return -1;
strncpy(ipaddr,inet_ntoa(ia),LINPHONE_IPADDR_SIZE);
resp = ms_stun_message_create_from_buffer_parsing((uint8_t *)buf, (ssize_t)len);
if (resp != NULL) {
const MSStunAddress *stun_addr;
UInt96 tr_id = ms_stun_message_get_tr_id(resp);
*id = tr_id.octet[0];
stun_addr = ms_stun_message_get_xor_mapped_address(resp);
if (stun_addr != NULL) {
*port = stun_addr->ip.v4.port;
ia.s_addr = htonl(stun_addr->ip.v4.addr);
} else {
stun_addr = ms_stun_message_get_mapped_address(resp);
if (stun_addr != NULL) {
*port = stun_addr->ip.v4.port;
ia.s_addr = htonl(stun_addr->ip.v4.addr);
} else len = -1;
}
if (len > 0) strncpy(ipaddr, inet_ntoa(ia), LINPHONE_IPADDR_SIZE);
}
}
return len;
}
@ -459,44 +470,32 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
int id;
if (loops%20==0){
ms_message("Sending stun requests...");
sendStunRequest((int)sock1,ai->ai_addr,(socklen_t)ai->ai_addrlen,11,TRUE);
sendStunRequest((int)sock1,ai->ai_addr,(socklen_t)ai->ai_addrlen,1,FALSE);
send_stun_request((int)sock1,ai->ai_addr,(socklen_t)ai->ai_addrlen,11,TRUE);
send_stun_request((int)sock1,ai->ai_addr,(socklen_t)ai->ai_addrlen,1,FALSE);
if (sock2!=-1){
sendStunRequest((int)sock2,ai->ai_addr,(socklen_t)ai->ai_addrlen,22,TRUE);
sendStunRequest((int)sock2,ai->ai_addr,(socklen_t)ai->ai_addrlen,2,FALSE);
send_stun_request((int)sock2,ai->ai_addr,(socklen_t)ai->ai_addrlen,22,TRUE);
send_stun_request((int)sock2,ai->ai_addr,(socklen_t)ai->ai_addrlen,2,FALSE);
}
if (sock3!=-1){
sendStunRequest((int)sock3,ai->ai_addr,(socklen_t)ai->ai_addrlen,33,TRUE);
sendStunRequest((int)sock3,ai->ai_addr,(socklen_t)ai->ai_addrlen,3,FALSE);
send_stun_request((int)sock3,ai->ai_addr,(socklen_t)ai->ai_addrlen,33,TRUE);
send_stun_request((int)sock3,ai->ai_addr,(socklen_t)ai->ai_addrlen,3,FALSE);
}
}
ms_usleep(10000);
if (recvStunResponse(sock1,ac->addr,
&ac->port,&id)>0){
ms_message("STUN test result: local audio port maps to %s:%i",
ac->addr,
ac->port);
if (id==11)
cone_audio=TRUE;
if (recv_stun_response(sock1, ac->addr, &ac->port, &id) > 0) {
ms_message("STUN test result: local audio port maps to %s:%i", ac->addr, ac->port);
if (id==11) cone_audio=TRUE;
got_audio=TRUE;
}
if (recvStunResponse(sock2,vc->addr,
&vc->port,&id)>0){
ms_message("STUN test result: local video port maps to %s:%i",
vc->addr,
vc->port);
if (id==22)
cone_video=TRUE;
if (recv_stun_response(sock2, vc->addr, &vc->port, &id) > 0) {
ms_message("STUN test result: local video port maps to %s:%i", vc->addr, vc->port);
if (id==22) cone_video=TRUE;
got_video=TRUE;
}
if (recvStunResponse(sock3,tc->addr,
&tc->port,&id)>0){
ms_message("STUN test result: local text port maps to %s:%i",
tc->addr,
tc->port);
if (id==33)
cone_text=TRUE;
if (recv_stun_response(sock3, tc->addr, &tc->port, &id)>0) {
ms_message("STUN test result: local text port maps to %s:%i", tc->addr, tc->port);
if (id==33) cone_text=TRUE;
got_text=TRUE;
}
ortp_gettimeofday(&cur,NULL);
@ -585,16 +584,20 @@ static void stun_server_resolved(LinphoneCore *lc, const char *name, struct addr
}
void linphone_core_resolve_stun_server(LinphoneCore *lc){
/*
* WARNING: stun server resolution only done in IPv4.
* TODO: use IPv6 resolution if linphone_core_ipv6_enabled()==TRUE and use V4Mapped addresses for ICE gathering.
*/
const char *server=lc->net_conf.stun_server;
if (lc->sal && server && !lc->net_conf.stun_res){
char host[NI_MAXHOST];
int port=3478;
linphone_parse_host_port(server,host,sizeof(host),&port);
lc->net_conf.stun_res=sal_resolve_a(lc->sal,host,port,AF_INET,(SalResolverCallback)stun_server_resolved,lc);
if (lc->nat_policy != NULL) {
linphone_nat_policy_resolve_stun_server(lc->nat_policy);
} else {
/*
* WARNING: stun server resolution only done in IPv4.
* TODO: use IPv6 resolution if linphone_core_ipv6_enabled()==TRUE and use V4Mapped addresses for ICE gathering.
*/
const char *server=linphone_core_get_stun_server(lc);
if (lc->sal && server && !lc->net_conf.stun_res){
char host[NI_MAXHOST];
int port=3478;
linphone_parse_host_port(server,host,sizeof(host),&port);
lc->net_conf.stun_res=sal_resolve_a(lc->sal,host,port,AF_INET,(SalResolverCallback)stun_server_resolved,lc);
}
}
}
@ -610,31 +613,87 @@ void linphone_core_resolve_stun_server(LinphoneCore *lc){
* changed.
**/
const struct addrinfo *linphone_core_get_stun_server_addrinfo(LinphoneCore *lc){
const char *server=linphone_core_get_stun_server(lc);
if (server){
int wait_ms=0;
int wait_limit=1000;
linphone_core_resolve_stun_server(lc);
while (!lc->net_conf.stun_addrinfo && lc->net_conf.stun_res!=NULL && wait_ms<wait_limit){
sal_iterate(lc->sal);
ms_usleep(50000);
wait_ms+=50;
if (lc->nat_policy != NULL) {
return linphone_nat_policy_get_stun_server_addrinfo(lc->nat_policy);
} else {
const char *server=linphone_core_get_stun_server(lc);
if (server){
int wait_ms=0;
int wait_limit=1000;
linphone_core_resolve_stun_server(lc);
while (!lc->net_conf.stun_addrinfo && lc->net_conf.stun_res!=NULL && wait_ms<wait_limit){
sal_iterate(lc->sal);
ms_usleep(50000);
wait_ms+=50;
}
}
return lc->net_conf.stun_addrinfo;
}
return lc->net_conf.stun_addrinfo;
}
void linphone_core_enable_forced_ice_relay(LinphoneCore *lc, bool_t enable) {
lc->forced_ice_relay = enable;
}
void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, bool_t enable) {
lc->short_turn_refresh = enable;
}
static void stun_auth_requested_cb(LinphoneCall *call, const char *realm, const char *nonce, const char **username, const char **password, const char **ha1) {
LinphoneProxyConfig *proxy = NULL;
const LinphoneNatPolicy *nat_policy = NULL;
const LinphoneAddress *addr = NULL;
const LinphoneAuthInfo *auth_info = NULL;
LinphoneCore *lc = call->core;
const char *user = NULL;
// Get the username from the nat policy or the proxy config
if (call->dest_proxy != NULL) proxy = call->dest_proxy;
else proxy = linphone_core_get_default_proxy_config(call->core);
if (proxy == NULL) return;
nat_policy = linphone_proxy_config_get_nat_policy(proxy);
if (nat_policy != NULL) {
user = linphone_nat_policy_get_stun_server_username(nat_policy);
} else {
nat_policy = linphone_core_get_nat_policy(call->core);
if (nat_policy != NULL) {
user = linphone_nat_policy_get_stun_server_username(nat_policy);
}
}
if (user == NULL) {
/* If the username has not been found in the nat_policy, take the username from the currently used proxy config. */
addr = linphone_proxy_config_get_identity_address(proxy);
if (addr == NULL) return;
user = linphone_address_get_username(addr);
}
if (user == NULL) return;
auth_info = linphone_core_find_auth_info(lc, realm, user, NULL);
if (auth_info != NULL) {
const char *hash = linphone_auth_info_get_ha1(auth_info);
if (hash != NULL) {
*ha1 = hash;
} else {
*password = linphone_auth_info_get_passwd(auth_info);
}
*username = user;
} else {
ms_warning("No auth info found for STUN auth request");
}
}
int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){
char local_addr[64];
const struct addrinfo *ai = NULL;
IceCheckList *audio_check_list;
IceCheckList *video_check_list;
IceCheckList *text_check_list;
const char *server = linphone_core_get_stun_server(lc);
LinphoneNatPolicy *nat_policy = NULL;
const char *server = NULL;
if (call->dest_proxy != NULL) nat_policy = linphone_proxy_config_get_nat_policy(call->dest_proxy);
if (nat_policy == NULL) nat_policy = linphone_core_get_nat_policy(lc);
if (nat_policy != NULL) server = linphone_nat_policy_get_stun_server(nat_policy);
if (call->ice_session == NULL) return -1;
audio_check_list = ice_session_check_list(call->ice_session, call->main_audio_stream_index);
@ -646,8 +705,8 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){
ms_warning("Ice gathering is not implemented for ipv6");
return -1;
}
if (server){
ai=linphone_core_get_stun_server_addrinfo(lc);
if ((nat_policy != NULL) && (server != NULL) && (server[0] != '\0')) {
ai=linphone_nat_policy_get_stun_server_addrinfo(nat_policy);
if (ai==NULL){
ms_warning("Fail to resolve STUN server for ICE gathering, continuing without stun.");
}
@ -657,32 +716,37 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){
linphone_core_notify_display_status(lc, _("ICE local candidates gathering in progress..."));
ice_session_enable_forced_relay(call->ice_session, lc->forced_ice_relay);
ice_session_enable_short_turn_refresh(call->ice_session, lc->short_turn_refresh);
// TODO: Handle IPv6
/* Gather local host candidates. */
if (linphone_core_get_local_ip_for(AF_INET, NULL, local_addr) < 0) {
ms_error("Fail to get local ip");
return -1;
}
if ((ice_check_list_state(audio_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(audio_check_list) == FALSE)) {
ice_add_local_candidate(audio_check_list, "host", local_addr, call->media_ports[call->main_audio_stream_index].rtp_port, 1, NULL);
ice_add_local_candidate(audio_check_list, "host", local_addr, call->media_ports[call->main_audio_stream_index].rtcp_port, 2, NULL);
ice_add_local_candidate(audio_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_audio_stream_index].rtp_port, 1, NULL);
ice_add_local_candidate(audio_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_audio_stream_index].rtcp_port, 2, NULL);
call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress;
}
if (linphone_core_video_enabled(lc) && (video_check_list != NULL)
&& (ice_check_list_state(video_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(video_check_list) == FALSE)) {
ice_add_local_candidate(video_check_list, "host", local_addr, call->media_ports[call->main_video_stream_index].rtp_port, 1, NULL);
ice_add_local_candidate(video_check_list, "host", local_addr, call->media_ports[call->main_video_stream_index].rtcp_port, 2, NULL);
ice_add_local_candidate(video_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_video_stream_index].rtp_port, 1, NULL);
ice_add_local_candidate(video_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_video_stream_index].rtcp_port, 2, NULL);
call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress;
}
if (call->params->realtimetext_enabled && (text_check_list != NULL)
&& (ice_check_list_state(text_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(text_check_list) == FALSE)) {
ice_add_local_candidate(text_check_list, "host", local_addr, call->media_ports[call->main_text_stream_index].rtp_port, 1, NULL);
ice_add_local_candidate(text_check_list, "host", local_addr, call->media_ports[call->main_text_stream_index].rtcp_port, 2, NULL);
ice_add_local_candidate(text_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_text_stream_index].rtp_port, 1, NULL);
ice_add_local_candidate(text_check_list, "host", AF_INET, local_addr, call->media_ports[call->main_text_stream_index].rtcp_port, 2, NULL);
call->stats[LINPHONE_CALL_STATS_TEXT].ice_state = LinphoneIceStateInProgress;
}
if (ai){
ms_message("ICE: gathering candidate from [%s]",server);
if ((ai != NULL) && (nat_policy != NULL)
&& (linphone_nat_policy_stun_enabled(nat_policy) || linphone_nat_policy_turn_enabled(nat_policy))) {
ms_message("ICE: gathering candidate from [%s] using %s", server, linphone_nat_policy_turn_enabled(nat_policy) ? "TURN" : "STUN");
/* Gather local srflx candidates. */
ice_session_enable_turn(call->ice_session, linphone_nat_policy_turn_enabled(nat_policy));
ice_session_set_stun_auth_requested_cb(call->ice_session, (MSStunAuthRequestedCb)stun_auth_requested_cb, call);
ice_session_gather_candidates(call->ice_session, ai->ai_addr, (socklen_t)ai->ai_addrlen);
return 1;
} else {
@ -835,19 +899,21 @@ void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDes
}
void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session, bool_t use_nortpproxy) {
const char *rtp_addr, *rtcp_addr;
IceCandidate *rtp_candidate = NULL;
IceCandidate *rtcp_candidate = NULL;
IceSessionState session_state = ice_session_state(session);
int nb_candidates;
int i, j;
int i;
size_t j;
bool_t result;
if (session_state == IS_Completed) {
if (use_nortpproxy) desc->set_nortpproxy = TRUE;
result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, 0), &rtp_addr, NULL, NULL, NULL);
result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, 0), &rtp_candidate, NULL);
if (result == TRUE) {
strncpy(desc->addr, rtp_addr, sizeof(desc->addr));
strncpy(desc->addr, rtp_candidate->taddr.ip, sizeof(desc->addr));
} else {
ms_warning("If ICE has completed successfully, rtp_addr should be set!");
ms_warning("If ICE has completed successfully, rtp_candidate should be set!");
}
}
else {
@ -859,17 +925,20 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess
SalStreamDescription *stream = &desc->streams[i];
IceCheckList *cl = ice_session_check_list(session, i);
nb_candidates = 0;
rtp_candidate = rtcp_candidate = NULL;
if (!sal_stream_description_active(stream) || (cl == NULL)) continue;
if (ice_check_list_state(cl) == ICL_Completed) {
if (use_nortpproxy) stream->set_nortpproxy = TRUE;
result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port);
result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_candidate, &rtcp_candidate);
} else {
stream->set_nortpproxy = FALSE;
result = ice_check_list_default_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port);
result = ice_check_list_default_local_candidate(ice_session_check_list(session, i), &rtp_candidate, &rtcp_candidate);
}
if (result == TRUE) {
strncpy(stream->rtp_addr, rtp_addr, sizeof(stream->rtp_addr));
strncpy(stream->rtcp_addr, rtcp_addr, sizeof(stream->rtcp_addr));
strncpy(stream->rtp_addr, rtp_candidate->taddr.ip, sizeof(stream->rtp_addr));
strncpy(stream->rtcp_addr, rtcp_candidate->taddr.ip, sizeof(stream->rtcp_addr));
stream->rtp_port = rtp_candidate->taddr.port;
stream->rtcp_port = rtcp_candidate->taddr.port;
} else {
memset(stream->rtp_addr, 0, sizeof(stream->rtp_addr));
memset(stream->rtcp_addr, 0, sizeof(stream->rtcp_addr));
@ -885,9 +954,9 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess
stream->ice_mismatch = ice_check_list_is_mismatch(cl);
if ((ice_check_list_state(cl) == ICL_Running) || (ice_check_list_state(cl) == ICL_Completed)) {
memset(stream->ice_candidates, 0, sizeof(stream->ice_candidates));
for (j = 0; j < MIN(ms_list_size(cl->local_candidates), SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES); j++) {
for (j = 0; j < MIN(bctbx_list_size(cl->local_candidates), SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES); j++) {
SalIceCandidate *sal_candidate = &stream->ice_candidates[nb_candidates];
IceCandidate *ice_candidate = ms_list_nth_data(cl->local_candidates, j);
IceCandidate *ice_candidate = bctbx_list_nth_data(cl->local_candidates, j);
const char *default_addr = NULL;
int default_port = 0;
if (ice_candidate->componentID == 1) {
@ -916,13 +985,12 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess
}
}
if ((ice_check_list_state(cl) == ICL_Completed) && (ice_session_role(session) == IR_Controlling)) {
int rtp_port, rtcp_port;
memset(stream->ice_remote_candidates, 0, sizeof(stream->ice_remote_candidates));
if (ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port) == TRUE) {
strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr));
stream->ice_remote_candidates[0].port = rtp_port;
strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr));
stream->ice_remote_candidates[1].port = rtcp_port;
if (ice_check_list_selected_valid_remote_candidate(cl, &rtp_candidate, &rtcp_candidate) == TRUE) {
strncpy(stream->ice_remote_candidates[0].addr, rtp_candidate->taddr.ip, sizeof(stream->ice_remote_candidates[0].addr));
stream->ice_remote_candidates[0].port = rtp_candidate->taddr.port;
strncpy(stream->ice_remote_candidates[1].addr, rtcp_candidate->taddr.ip, sizeof(stream->ice_remote_candidates[1].addr));
stream->ice_remote_candidates[1].port = rtcp_candidate->taddr.port;
} else {
ms_error("ice: Selected valid remote candidates should be present if the check list is in the Completed state");
}
@ -1066,7 +1134,8 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
get_default_addr_and_port(candidate->componentID, md, stream, &addr, &port);
if (addr && (candidate->port == port) && (strlen(candidate->addr) == strlen(addr)) && (strcmp(candidate->addr, addr) == 0))
default_candidate = TRUE;
ice_add_remote_candidate(cl, candidate->type, candidate->addr, candidate->port, candidate->componentID,
// TODO: Handle IPv6
ice_add_remote_candidate(cl, candidate->type, AF_INET, candidate->addr, candidate->port, candidate->componentID,
candidate->priority, candidate->foundation, default_candidate);
}
if (ice_restarted == FALSE) {
@ -1082,7 +1151,8 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
/* If we receive a re-invite and we finished ICE processing on our side, use the candidates given by the remote. */
ice_check_list_unselect_valid_pairs(cl);
}
ice_add_losing_pair(cl, j + 1, remote_candidate->addr, remote_candidate->port, addr, port);
// TODO: Handle IPv6
ice_add_losing_pair(cl, j + 1, AF_INET, remote_candidate->addr, remote_candidate->port, addr, port);
losing_pairs_added = TRUE;
}
if (losing_pairs_added == TRUE) ice_check_list_check_completed(cl);
@ -1555,7 +1625,7 @@ static int get_unique_transport(LinphoneCore *lc, LinphoneTransportType *type, i
}
static void linphone_core_migrate_proxy_config(LinphoneCore *lc, LinphoneTransportType type){
const MSList *elem;
const bctbx_list_t *elem;
for(elem=linphone_core_get_proxy_config_list(lc);elem!=NULL;elem=elem->next){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
const char *proxy=linphone_proxy_config_get_addr(cfg);
@ -1627,7 +1697,7 @@ void linphone_tone_description_destroy(LinphoneToneDescription *obj){
}
LinphoneToneDescription *linphone_core_get_call_error_tone(const LinphoneCore *lc, LinphoneReason reason){
const MSList *elem;
const bctbx_list_t *elem;
for (elem=lc->tones;elem!=NULL;elem=elem->next){
LinphoneToneDescription *tone=(LinphoneToneDescription*)elem->data;
if (tone->reason==reason) return tone;
@ -1636,7 +1706,7 @@ LinphoneToneDescription *linphone_core_get_call_error_tone(const LinphoneCore *l
}
const char *linphone_core_get_tone_file(const LinphoneCore *lc, LinphoneToneID id){
const MSList *elem;
const bctbx_list_t *elem;
for (elem=lc->tones;elem!=NULL;elem=elem->next){
LinphoneToneDescription *tone=(LinphoneToneDescription*)elem->data;
if (tone->toneid==id && tone->reason==LinphoneReasonNone && tone->audiofile!=NULL) return tone->audiofile;
@ -1647,11 +1717,11 @@ const char *linphone_core_get_tone_file(const LinphoneCore *lc, LinphoneToneID i
void _linphone_core_set_tone(LinphoneCore *lc, LinphoneReason reason, LinphoneToneID id, const char *audiofile){
LinphoneToneDescription *tone=linphone_core_get_call_error_tone(lc,reason);
if (tone){
lc->tones=ms_list_remove(lc->tones,tone);
lc->tones=bctbx_list_remove(lc->tones,tone);
linphone_tone_description_destroy(tone);
}
tone=linphone_tone_description_new(reason,id,audiofile);
lc->tones=ms_list_append(lc->tones,tone);
lc->tones=bctbx_list_append(lc->tones,tone);
}
/**
@ -1940,15 +2010,15 @@ static void hook_invoke(Hook *h){
}
void linphone_task_list_add(LinphoneTaskList *t, LinphoneCoreIterateHook hook, void *hook_data){
t->hooks = ms_list_append(t->hooks,hook_new(hook,hook_data));
t->hooks = bctbx_list_append(t->hooks,hook_new(hook,hook_data));
}
void linphone_task_list_remove(LinphoneTaskList *t, LinphoneCoreIterateHook hook, void *hook_data){
MSList *elem;
bctbx_list_t *elem;
for(elem=t->hooks;elem!=NULL;elem=elem->next){
Hook *h=(Hook*)elem->data;
if (h->fun==hook && h->data==hook_data){
t->hooks = ms_list_remove_link(t->hooks,elem);
t->hooks = bctbx_list_remove_link(t->hooks,elem);
ms_free(h);
return;
}
@ -1957,9 +2027,9 @@ void linphone_task_list_remove(LinphoneTaskList *t, LinphoneCoreIterateHook hook
}
void linphone_task_list_run(LinphoneTaskList *t){
ms_list_for_each(t->hooks,(void (*)(void*))hook_invoke);
bctbx_list_for_each(t->hooks,(void (*)(void*))hook_invoke);
}
void linphone_task_list_free(LinphoneTaskList *t){
t->hooks = ms_list_free_with_data(t->hooks, (void (*)(void*))ms_free);
t->hooks = bctbx_list_free_with_data(t->hooks, (void (*)(void*))ms_free);
}

305
coreapi/nat_policy.c Normal file
View file

@ -0,0 +1,305 @@
/*
linphone
Copyright (C) 2010-2016 Belledonne Communications SARL
This program 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 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphonecore.h"
#include "private.h"
static LinphoneNatPolicy * _linphone_nat_policy_new_with_ref(LinphoneCore *lc, const char *ref) {
LinphoneNatPolicy *policy = belle_sip_object_new(LinphoneNatPolicy);
belle_sip_object_ref(policy);
policy->lc = lc;
policy->ref = belle_sip_strdup(ref);
return policy;
}
static LinphoneNatPolicy * linphone_nat_policy_new(LinphoneCore *lc) {
char ref[17] = { 0 };
belle_sip_random_token(ref, 16);
return _linphone_nat_policy_new_with_ref(lc, ref);
}
static void linphone_nat_policy_destroy(LinphoneNatPolicy *policy) {
if (policy->ref) belle_sip_free(policy->ref);
if (policy->stun_server) belle_sip_free(policy->stun_server);
if (policy->stun_server_username) belle_sip_free(policy->stun_server_username);
if (policy->stun_addrinfo) bctbx_freeaddrinfo(policy->stun_addrinfo);
//if (policy->stun_resolver_context) sal_resolve_cancel(policy->stun_resolver_context);
}
static bool_t linphone_nat_policy_stun_server_activated(LinphoneNatPolicy *policy) {
const char *server = linphone_nat_policy_get_stun_server(policy);
return (server != NULL) && (server[0] != '\0')
&& ((linphone_nat_policy_stun_enabled(policy) == TRUE) || (linphone_nat_policy_turn_enabled(policy) == TRUE));
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneNatPolicy);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneNatPolicy, belle_sip_object_t,
(belle_sip_object_destroy_t)linphone_nat_policy_destroy,
NULL, // clone
NULL, // marshal
TRUE
);
static void _linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy, LpConfig *config, int index) {
char *section;
bctbx_list_t *l = NULL;
section = belle_sip_strdup_printf("nat_policy_%i", index);
lp_config_set_string(config, section, "ref", policy->ref);
lp_config_set_string(config, section, "stun_server", policy->stun_server);
lp_config_set_string(config, section, "stun_server_username", policy->stun_server_username);
if (linphone_nat_policy_upnp_enabled(policy)) {
l = bctbx_list_append(l, "upnp");
} else {
if (linphone_nat_policy_stun_enabled(policy)) l = bctbx_list_append(l, "stun");
if (linphone_nat_policy_turn_enabled(policy)) l = bctbx_list_append(l, "turn");
if (linphone_nat_policy_ice_enabled(policy)) l = bctbx_list_append(l, "ice");
}
lp_config_set_string_list(config, section, "protocols", l);
belle_sip_free(section);
bctbx_list_free(l);
}
void linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy) {
LpConfig *config = policy->lc->config;
char *section;
int index;
bool_t finished = FALSE;
for (index = 0; finished != TRUE; index++) {
section = belle_sip_strdup_printf("nat_policy_%i", index);
if (lp_config_has_section(config, section)) {
const char *config_ref = lp_config_get_string(config, section, "ref", NULL);
if ((config_ref != NULL) && (strcmp(config_ref, policy->ref) == 0)) {
_linphone_nat_policy_save_to_config(policy, config, index);
finished = TRUE;
}
} else {
_linphone_nat_policy_save_to_config(policy, config, index);
finished = TRUE;
}
belle_sip_free(section);
}
}
LinphoneNatPolicy * linphone_nat_policy_ref(LinphoneNatPolicy *policy) {
belle_sip_object_ref(policy);
return policy;
}
void linphone_nat_policy_unref(LinphoneNatPolicy *policy) {
belle_sip_object_unref(policy);
}
void *linphone_nat_policy_get_user_data(const LinphoneNatPolicy *policy) {
return policy->user_data;
}
void linphone_nat_policy_set_user_data(LinphoneNatPolicy *policy, void *ud) {
policy->user_data = ud;
}
void linphone_nat_policy_clear(LinphoneNatPolicy *policy) {
linphone_nat_policy_enable_stun(policy, FALSE);
linphone_nat_policy_enable_turn(policy, FALSE);
linphone_nat_policy_enable_ice(policy, FALSE);
linphone_nat_policy_enable_upnp(policy, FALSE);
linphone_nat_policy_set_stun_server(policy, NULL);
linphone_nat_policy_set_stun_server_username(policy, NULL);
}
bool_t linphone_nat_policy_stun_enabled(const LinphoneNatPolicy *policy) {
return policy->stun_enabled;
}
void linphone_nat_policy_enable_stun(LinphoneNatPolicy *policy, bool_t enable) {
policy->stun_enabled = enable;
}
bool_t linphone_nat_policy_turn_enabled(const LinphoneNatPolicy *policy) {
return policy->turn_enabled;
}
void linphone_nat_policy_enable_turn(LinphoneNatPolicy *policy, bool_t enable) {
policy->turn_enabled = enable;
}
bool_t linphone_nat_policy_ice_enabled(const LinphoneNatPolicy *policy) {
return policy->ice_enabled;
}
void linphone_nat_policy_enable_ice(LinphoneNatPolicy *policy, bool_t enable) {
policy->ice_enabled = enable;
}
bool_t linphone_nat_policy_upnp_enabled(const LinphoneNatPolicy *policy) {
return policy->upnp_enabled;
}
void linphone_nat_policy_enable_upnp(LinphoneNatPolicy *policy, bool_t enable) {
policy->upnp_enabled = enable;
if (enable) {
#ifdef BUILD_UPNP
policy->stun_enabled = policy->turn_enabled = policy->ice_enabled = FALSE;
ms_warning("Enabling uPnP NAT policy has disabled any other previously enabled policies");
#else
ms_warning("Cannot enable the uPnP NAT policy because the uPnP support is not compiled in");
#endif
}
}
const char * linphone_nat_policy_get_stun_server(const LinphoneNatPolicy *policy) {
return policy->stun_server;
}
void linphone_nat_policy_set_stun_server(LinphoneNatPolicy *policy, const char *stun_server) {
char *new_stun_server = NULL;
if (stun_server != NULL) new_stun_server = belle_sip_strdup(stun_server);
if (policy->stun_server != NULL) {
belle_sip_free(policy->stun_server);
policy->stun_server = NULL;
}
if (new_stun_server != NULL) {
policy->stun_server = new_stun_server;
linphone_nat_policy_resolve_stun_server(policy);
}
}
const char * linphone_nat_policy_get_stun_server_username(const LinphoneNatPolicy *policy) {
return policy->stun_server_username;
}
void linphone_nat_policy_set_stun_server_username(LinphoneNatPolicy *policy, const char *username) {
char *new_username = NULL;
if (username != NULL) new_username = belle_sip_strdup(username);
if (policy->stun_server_username != NULL) {
belle_sip_free(policy->stun_server_username);
policy->stun_server_username = NULL;
}
if (new_username != NULL) policy->stun_server_username = new_username;
}
static void stun_server_resolved(LinphoneNatPolicy *policy, const char *name, struct addrinfo *addrinfo) {
if (policy->stun_addrinfo) {
bctbx_freeaddrinfo(policy->stun_addrinfo);
policy->stun_addrinfo = NULL;
}
if (addrinfo) {
ms_message("Stun server resolution successful.");
} else {
ms_warning("Stun server resolution failed.");
}
policy->stun_addrinfo = addrinfo;
policy->stun_resolver_context = NULL;
}
void linphone_nat_policy_resolve_stun_server(LinphoneNatPolicy *policy) {
const char *service = NULL;
/*
* WARNING: stun server resolution only done in IPv4.
* TODO: use IPv6 resolution if linphone_core_ipv6_enabled()==TRUE and use V4Mapped addresses for ICE gathering.
*/
if (linphone_nat_policy_stun_server_activated(policy)
&& (policy->lc->sal != NULL)
&& !policy->stun_resolver_context) {
char host[NI_MAXHOST];
int port = 3478;
linphone_parse_host_port(policy->stun_server, host, sizeof(host), &port);
if (linphone_nat_policy_turn_enabled(policy)) service = "turn";
else if (linphone_nat_policy_stun_enabled(policy)) service = "stun";
if (service != NULL) {
policy->stun_resolver_context = sal_resolve(policy->lc->sal, service, "udp", host, port, AF_INET, (SalResolverCallback)stun_server_resolved, policy);
}
}
}
const struct addrinfo * linphone_nat_policy_get_stun_server_addrinfo(LinphoneNatPolicy *policy) {
/*
* It is critical not to block for a long time if it can't be resolved, otherwise this stucks the main thread when making a call.
* On the contrary, a fully asynchronous call initiation is complex to develop.
* The compromise is then:
* - have a cache of the stun server addrinfo
* - this cached value is returned when it is non-null
* - an asynchronous resolution is asked each time this function is called to ensure frequent refreshes of the cached value.
* - if no cached value exists, block for a short time; this case must be unprobable because the resolution will be asked each
* time the stun server value is changed.
*/
if (linphone_nat_policy_stun_server_activated(policy)) {
int wait_ms = 0;
int wait_limit = 1000;
linphone_nat_policy_resolve_stun_server(policy);
while ((policy->stun_addrinfo == NULL) && (policy->stun_resolver_context != NULL) && (wait_ms < wait_limit)) {
sal_iterate(policy->lc->sal);
ms_usleep(50000);
wait_ms += 50;
}
}
return policy->stun_addrinfo;
}
LinphoneNatPolicy * linphone_core_create_nat_policy(LinphoneCore *lc) {
return linphone_nat_policy_new(lc);
}
LinphoneNatPolicy * linphone_core_create_nat_policy_from_config(LinphoneCore *lc, const char *ref) {
LpConfig *config = lc->config;
LinphoneNatPolicy *policy = NULL;
char *section;
int index;
bool_t finished = FALSE;
for (index = 0; finished != TRUE; index++) {
section = belle_sip_strdup_printf("nat_policy_%i", index);
if (lp_config_has_section(config, section)) {
const char *config_ref = lp_config_get_string(config, section, "ref", NULL);
if ((config_ref != NULL) && (strcmp(config_ref, ref) == 0)) {
const char *server = lp_config_get_string(config, section, "stun_server", NULL);
const char *username = lp_config_get_string(config, section, "stun_server_username", NULL);
bctbx_list_t *l = lp_config_get_string_list(config, section, "protocols", NULL);
policy = _linphone_nat_policy_new_with_ref(lc, ref);
if (server != NULL) linphone_nat_policy_set_stun_server(policy, server);
if (username != NULL) linphone_nat_policy_set_stun_server_username(policy, username);
if (l != NULL) {
bool_t upnp_enabled = FALSE;
bctbx_list_t *elem;
for (elem = l; elem != NULL; elem = elem->next) {
const char *value = (const char *)elem->data;
if (strcmp(value, "stun") == 0) linphone_nat_policy_enable_stun(policy, TRUE);
else if (strcmp(value, "turn") == 0) linphone_nat_policy_enable_turn(policy, TRUE);
else if (strcmp(value, "ice") == 0) linphone_nat_policy_enable_ice(policy, TRUE);
else if (strcmp(value, "upnp") == 0) upnp_enabled = TRUE;
}
if (upnp_enabled) linphone_nat_policy_enable_upnp(policy, TRUE);
}
finished = TRUE;
}
} else finished = TRUE;
belle_sip_free(section);
}
return policy;
}

205
coreapi/nat_policy.h Normal file
View file

@ -0,0 +1,205 @@
/*
nat_policy.h
Copyright (C) 2010-2016 Belledonne Communications SARL
This program 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 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef LINPHONE_NAT_POLICY_H_
#define LINPHONE_NAT_POLICY_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup network_parameters
* @{
*/
/**
* Policy to use to pass through NATs/firewalls.
*/
typedef struct _LinphoneNatPolicy LinphoneNatPolicy;
/**
* Acquire a reference to the LinphoneNatPolicy object.
* @param[in] policy LinphoneNatPolicy object.
* @return The same LinphoneNatPolicy object.
**/
LINPHONE_PUBLIC LinphoneNatPolicy * linphone_nat_policy_ref(LinphoneNatPolicy *policy);
/**
* Release reference to the LinphoneNatPolicy object.
* @param[in] policy LinphoneNatPolicy object.
**/
LINPHONE_PUBLIC void linphone_nat_policy_unref(LinphoneNatPolicy *policy);
/**
* Retrieve the user pointer associated with the LinphoneNatPolicy object.
* @param[in] policy LinphoneNatPolicy object.
* @return The user pointer associated with the LinphoneNatPolicy object.
**/
LINPHONE_PUBLIC void *linphone_nat_policy_get_user_data(const LinphoneNatPolicy *policy);
/**
* Assign a user pointer to the LinphoneNatPolicy object.
* @param[in] policy LinphoneNatPolicy object.
* @param[in] ud The user pointer to associate with the LinphoneNatPolicy object.
**/
LINPHONE_PUBLIC void linphone_nat_policy_set_user_data(LinphoneNatPolicy *policy, void *ud);
/**
* Clear a NAT policy (deactivate all protocols and unset the STUN server).
* @param[in] policy LinphoneNatPolicy object.
*/
LINPHONE_PUBLIC void linphone_nat_policy_clear(LinphoneNatPolicy *policy);
/**
* Tell whether STUN is enabled.
* @param[in] policy LinphoneNatPolicy object
* @return Boolean value telling whether STUN is enabled.
*/
LINPHONE_PUBLIC bool_t linphone_nat_policy_stun_enabled(const LinphoneNatPolicy *policy);
/**
* Enable STUN.
* If TURN is also enabled, TURN will be used instead of STUN.
* @param[in] policy LinphoneNatPolicy object
* @param[in] enable Boolean value telling whether to enable STUN.
*/
LINPHONE_PUBLIC void linphone_nat_policy_enable_stun(LinphoneNatPolicy *policy, bool_t enable);
/**
* Tell whether TURN is enabled.
* @param[in] policy LinphoneNatPolicy object
* @return Boolean value telling whether TURN is enabled.
*/
LINPHONE_PUBLIC bool_t linphone_nat_policy_turn_enabled(const LinphoneNatPolicy *policy);
/**
* Enable TURN.
* If STUN is also enabled, it is ignored and TURN is used.
* @param[in] policy LinphoneNatPolicy object
* @param[in] enable Boolean value telling whether to enable TURN.
*/
LINPHONE_PUBLIC void linphone_nat_policy_enable_turn(LinphoneNatPolicy *policy, bool_t enable);
/**
* Tell whether ICE is enabled.
* @param[in] policy LinphoneNatPolicy object
* @return Boolean value telling whether ICE is enabled.
*/
LINPHONE_PUBLIC bool_t linphone_nat_policy_ice_enabled(const LinphoneNatPolicy *policy);
/**
* Enable ICE.
* ICE can be enabled without STUN/TURN, in which case only the local candidates will be used.
* @param[in] policy LinphoneNatPolicy object
* @param[in] enable Boolean value telling whether to enable ICE.
*/
LINPHONE_PUBLIC void linphone_nat_policy_enable_ice(LinphoneNatPolicy *policy, bool_t enable);
/**
* Tell whether uPnP is enabled.
* @param[in] policy LinphoneNatPolicy object
* @return Boolean value telling whether uPnP is enabled.
*/
LINPHONE_PUBLIC bool_t linphone_nat_policy_upnp_enabled(const LinphoneNatPolicy *policy);
/**
* Enable uPnP.
* This has the effect to disable every other policies (ICE, STUN and TURN).
* @param[in] policy LinphoneNatPolicy object
* @param[in] enable Boolean value telling whether to enable uPnP.
*/
LINPHONE_PUBLIC void linphone_nat_policy_enable_upnp(LinphoneNatPolicy *policy, bool_t enable);
/**
* Get the STUN/TURN server to use with this NAT policy.
* Used when STUN or TURN are enabled.
* @param[in] policy LinphoneNatPolicy object
* @return The STUN server used by this NAT policy.
*/
LINPHONE_PUBLIC const char * linphone_nat_policy_get_stun_server(const LinphoneNatPolicy *policy);
/**
* Set the STUN/TURN server to use with this NAT policy.
* Used when STUN or TURN are enabled.
* @param[in] policy LinphoneNatPolicy object
* @param[in] stun_server The STUN server to use with this NAT policy.
*/
LINPHONE_PUBLIC void linphone_nat_policy_set_stun_server(LinphoneNatPolicy *policy, const char *stun_server);
/**
* Get the username used to authenticate with the STUN/TURN server.
* The authentication will search for a LinphoneAuthInfo with this username.
* If it is not set the username of the currently used LinphoneProxyConfig is used to search for a LinphoneAuthInfo.
* @param[in] policy LinphoneNatPolicy object
* @return The username used to authenticate with the STUN/TURN server.
*/
LINPHONE_PUBLIC const char * linphone_nat_policy_get_stun_server_username(const LinphoneNatPolicy *policy);
/**
* Seth the username used to authenticate with the STUN/TURN server.
* The authentication will search for a LinphoneAuthInfo with this username.
* If it is not set the username of the currently used LinphoneProxyConfig is used to search for a LinphoneAuthInfo.
* @param[in] policy LinphoneNatPolicy object
* @param[in] username The username used to authenticate with the STUN/TURN server.
*/
LINPHONE_PUBLIC void linphone_nat_policy_set_stun_server_username(LinphoneNatPolicy *policy, const char *username);
/**
* Start a STUN server DNS resolution.
* @param[in] policy LinphoneNatPolicy object
*/
LINPHONE_PUBLIC void linphone_nat_policy_resolve_stun_server(LinphoneNatPolicy *policy);
/**
* Get the addrinfo representation of the STUN server address.
* WARNING: This function may block for up to 1 second.
* @param[in] policy LinphoneNatPolicy object
* @return addrinfo representation of the STUN server address.
*/
LINPHONE_PUBLIC const struct addrinfo * linphone_nat_policy_get_stun_server_addrinfo(LinphoneNatPolicy *policy);
/**
* Create a new LinphoneNatPolicy object with every policies being disabled.
* @param[in] lc LinphoneCore object
* @return A new LinphoneNatPolicy object.
*/
LINPHONE_PUBLIC LinphoneNatPolicy * linphone_core_create_nat_policy(LinphoneCore *lc);
/**
* Create a new LinphoneNatPolicy by reading the config of a LinphoneCore according to the passed ref.
* @param[in] lc LinphoneCore object
* @param[in] ref The reference of a NAT policy in the config of the LinphoneCore
* @return A new LinphoneNatPolicy object.
*/
LINPHONE_PUBLIC LinphoneNatPolicy * linphone_core_create_nat_policy_from_config(LinphoneCore *lc, const char *ref);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* LINPHONE_NAT_POLICY_H_ */

View file

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "offeranswer.h"
#include "private.h"
static bool_t only_telephone_event(const MSList *l){
static bool_t only_telephone_event(const bctbx_list_t *l){
for(;l!=NULL;l=l->next){
PayloadType *p=(PayloadType*)l->data;
if (strcasecmp(p->mime_type,"telephone-event")!=0){
@ -32,9 +32,9 @@ static bool_t only_telephone_event(const MSList *l){
}
static PayloadType * opus_match(MSOfferAnswerContext *ctx, const MSList *local_payloads, const PayloadType *refpt, const MSList *remote_payloads, bool_t reading_response){
static PayloadType * opus_match(MSOfferAnswerContext *ctx, const bctbx_list_t *local_payloads, const PayloadType *refpt, const bctbx_list_t *remote_payloads, bool_t reading_response){
PayloadType *pt;
const MSList *elem;
const bctbx_list_t *elem;
PayloadType *legacy_opus=NULL;
for (elem=local_payloads;elem!=NULL;elem=elem->next){
@ -68,9 +68,9 @@ MSOfferAnswerProvider opus_offer_answer_provider={
};
/* the reason for this matcher is for some stupid uncompliant phone that offer G729a mime type !*/
static PayloadType * g729A_match(MSOfferAnswerContext *ctx, const MSList *local_payloads, const PayloadType *refpt, const MSList *remote_payloads, bool_t reading_response){
static PayloadType * g729A_match(MSOfferAnswerContext *ctx, const bctbx_list_t *local_payloads, const PayloadType *refpt, const bctbx_list_t *remote_payloads, bool_t reading_response){
PayloadType *pt;
const MSList *elem;
const bctbx_list_t *elem;
PayloadType *candidate=NULL;
for (elem=local_payloads;elem!=NULL;elem=elem->next){
@ -93,8 +93,8 @@ MSOfferAnswerProvider g729a_offer_answer_provider={
g729a_offer_answer_create_context
};
static PayloadType * red_match(MSOfferAnswerContext *ctx, const MSList *local_payloads, const PayloadType *refpt, const MSList *remote_payloads, bool_t reading_response) {
const MSList *elem_local, *elem_remote;
static PayloadType * red_match(MSOfferAnswerContext *ctx, const bctbx_list_t *local_payloads, const PayloadType *refpt, const bctbx_list_t *remote_payloads, bool_t reading_response) {
const bctbx_list_t *elem_local, *elem_remote;
PayloadType *red = NULL;
for (elem_local = local_payloads; elem_local != NULL; elem_local = elem_local->next) {
@ -131,9 +131,9 @@ MSOfferAnswerProvider red_offer_answer_provider={
red_offer_answer_create_context
};
static PayloadType * generic_match(const MSList *local_payloads, const PayloadType *refpt, const MSList *remote_payloads){
static PayloadType * generic_match(const bctbx_list_t *local_payloads, const PayloadType *refpt, const bctbx_list_t *remote_payloads){
PayloadType *pt;
const MSList *elem;
const bctbx_list_t *elem;
for (elem=local_payloads;elem!=NULL;elem=elem->next){
pt=(PayloadType*)elem->data;
@ -158,8 +158,8 @@ void linphone_core_register_offer_answer_providers(LinphoneCore *lc){
/*
* Returns a PayloadType from the local list that matches a PayloadType offered or answered in the remote list
*/
static PayloadType * find_payload_type_best_match(MSFactory *factory, const MSList *local_payloads, const PayloadType *refpt,
const MSList *remote_payloads, bool_t reading_response){
static PayloadType * find_payload_type_best_match(MSFactory *factory, const bctbx_list_t *local_payloads, const PayloadType *refpt,
const bctbx_list_t *remote_payloads, bool_t reading_response){
PayloadType *ret = NULL;
MSOfferAnswerContext *ctx = NULL;
@ -174,9 +174,9 @@ static PayloadType * find_payload_type_best_match(MSFactory *factory, const MSLi
}
static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSList *remote, bool_t reading_response, bool_t one_matching_codec){
const MSList *e2,*e1;
MSList *res=NULL;
static bctbx_list_t *match_payloads(MSFactory *factory, const bctbx_list_t *local, const bctbx_list_t *remote, bool_t reading_response, bool_t one_matching_codec){
const bctbx_list_t *e2,*e1;
bctbx_list_t *res=NULL;
PayloadType *matched;
bool_t found_codec=FALSE;
@ -211,7 +211,7 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL
}else{
payload_type_unset_flag(matched, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED);
}
res=ms_list_append(res,matched);
res=bctbx_list_append(res,matched);
/* we should use the remote numbering even when parsing a response */
payload_type_set_number(matched,remote_number);
payload_type_set_flag(matched, PAYLOAD_TYPE_FROZEN_NUMBER);
@ -227,7 +227,7 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL
payload_type_set_number(matched,local_number);
payload_type_set_flag(matched, PAYLOAD_TYPE_FLAG_CAN_RECV);
payload_type_set_flag(matched, PAYLOAD_TYPE_FROZEN_NUMBER);
res=ms_list_append(res,matched);
res=bctbx_list_append(res,matched);
}
}else{
if (p2->channels>0)
@ -252,7 +252,7 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL
p1=payload_type_clone(p1);
payload_type_set_flag(p1, PAYLOAD_TYPE_FLAG_CAN_RECV);
payload_type_set_flag(p1, PAYLOAD_TYPE_FROZEN_NUMBER);
res=ms_list_append(res,p1);
res=bctbx_list_append(res,p1);
}
}
}

View file

@ -108,8 +108,8 @@ static void fill_buddy_info(BLReq *blreq, BuddyInfo *bi, GHashTable *ht){
}
static MSList * make_buddy_list(BLReq *blreq, GValue *retval){
MSList *ret=NULL;
static bctbx_list_t * make_buddy_list(BLReq *blreq, GValue *retval){
bctbx_list_t *ret=NULL;
if (G_VALUE_TYPE(retval)==G_TYPE_VALUE_ARRAY){
GValueArray *array=(GValueArray*)g_value_get_boxed(retval);
GValue *gelem;
@ -120,7 +120,7 @@ static MSList * make_buddy_list(BLReq *blreq, GValue *retval){
GHashTable *ht=(GHashTable*)g_value_get_boxed(gelem);
BuddyInfo *bi=buddy_info_new();
fill_buddy_info(blreq,bi,ht);
ret=ms_list_append(ret,bi);
ret=bctbx_list_append(ret,bi);
}else{
ms_error("Element is not a hash table");
}

View file

@ -41,7 +41,7 @@ struct _LinphonePresenceService {
char *id;
LinphonePresenceBasicStatus status;
char *contact;
MSList *notes; /**< A list of _LinphonePresenceNote structures. */
bctbx_list_t *notes; /**< A list of _LinphonePresenceNote structures. */
time_t timestamp;
};
@ -56,9 +56,9 @@ struct _LinphonePresencePerson {
void *user_data;
int refcnt;
char *id;
MSList *activities; /**< A list of _LinphonePresenceActivity structures. */
MSList *activities_notes; /**< A list of _LinphonePresenceNote structures. */
MSList *notes; /**< A list of _LinphonePresenceNote structures. */
bctbx_list_t *activities; /**< A list of _LinphonePresenceActivity structures. */
bctbx_list_t *activities_notes; /**< A list of _LinphonePresenceNote structures. */
bctbx_list_t *notes; /**< A list of _LinphonePresenceNote structures. */
time_t timestamp;
};
@ -70,9 +70,9 @@ struct _LinphonePresenceModel {
LinphoneAddress *presentity; /* "The model seeks to describe the presentity, identified by a presentity URI.*/
void *user_data;
int refcnt;
MSList *services; /**< A list of _LinphonePresenceService structures. Also named tuples in the RFC. */
MSList *persons; /**< A list of _LinphonePresencePerson structures. */
MSList *notes; /**< A list of _LinphonePresenceNote structures. */
bctbx_list_t *services; /**< A list of _LinphonePresenceService structures. Also named tuples in the RFC. */
bctbx_list_t *persons; /**< A list of _LinphonePresencePerson structures. */
bctbx_list_t *notes; /**< A list of _LinphonePresenceNote structures. */
};
@ -137,8 +137,8 @@ static void presence_service_delete(LinphonePresenceService *service) {
if (service->contact != NULL) {
ms_free(service->contact);
}
ms_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(service->notes);
bctbx_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(service->notes);
ms_free(service);
};
@ -147,7 +147,7 @@ static void presence_service_set_timestamp(LinphonePresenceService *service, tim
}
static void presence_service_add_note(LinphonePresenceService *service, LinphonePresenceNote *note) {
service->notes = ms_list_append(service->notes, note);
service->notes = bctbx_list_append(service->notes, note);
}
static void presence_activity_delete(LinphonePresenceActivity *activity) {
@ -216,21 +216,21 @@ static void presence_person_delete(LinphonePresencePerson *person) {
if (person->id != NULL) {
ms_free(person->id);
}
ms_list_for_each(person->activities, (MSIterateFunc)linphone_presence_activity_unref);
ms_list_free(person->activities);
ms_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(person->activities_notes);
ms_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(person->notes);
bctbx_list_for_each(person->activities, (MSIterateFunc)linphone_presence_activity_unref);
bctbx_list_free(person->activities);
bctbx_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(person->activities_notes);
bctbx_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(person->notes);
ms_free(person);
}
static void presence_person_add_activities_note(LinphonePresencePerson *person, LinphonePresenceNote *note) {
person->activities_notes = ms_list_append(person->activities_notes, note);
person->activities_notes = bctbx_list_append(person->activities_notes, note);
}
static void presence_person_add_note(LinphonePresencePerson *person, LinphonePresenceNote *note) {
person->notes = ms_list_append(person->notes, note);
person->notes = bctbx_list_append(person->notes, note);
}
static int presence_model_insert_person_by_timestamp(LinphonePresencePerson *current, LinphonePresencePerson *to_insert) {
@ -238,11 +238,11 @@ static int presence_model_insert_person_by_timestamp(LinphonePresencePerson *cur
}
static void presence_model_add_person(LinphonePresenceModel *model, LinphonePresencePerson *person) {
model->persons = ms_list_insert_sorted(model->persons, linphone_presence_person_ref(person), (MSCompareFunc)presence_model_insert_person_by_timestamp);
model->persons = bctbx_list_insert_sorted(model->persons, linphone_presence_person_ref(person), (bctbx_compare_func)presence_model_insert_person_by_timestamp);
}
static void presence_model_add_note(LinphonePresenceModel *model, LinphonePresenceNote *note) {
model->notes = ms_list_append(model->notes, note);
model->notes = bctbx_list_append(model->notes, note);
}
static void presence_model_find_open_basic_status(LinphonePresenceService *service, LinphonePresenceBasicStatus *status) {
@ -255,12 +255,12 @@ static void presence_model_delete(LinphonePresenceModel *model) {
if (model == NULL) return;
if (model->presentity)
linphone_address_unref(model->presentity);
ms_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref);
ms_list_free(model->services);
ms_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
ms_list_free(model->persons);
ms_list_for_each(model->notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(model->notes);
bctbx_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref);
bctbx_list_free(model->services);
bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
bctbx_list_free(model->persons);
bctbx_list_for_each(model->notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(model->notes);
ms_free(model);
}
@ -291,7 +291,7 @@ LinphonePresenceModel * linphone_presence_model_new_with_activity_and_note(Linph
LinphonePresenceBasicStatus linphone_presence_model_get_basic_status(const LinphonePresenceModel *model) {
LinphonePresenceBasicStatus status = LinphonePresenceBasicStatusClosed;
if (model != NULL) {
ms_list_for_each2(model->services, (MSIterate2Func)presence_model_find_open_basic_status, &status);
bctbx_list_for_each2(model->services, (MSIterate2Func)presence_model_find_open_basic_status, &status);
}
return status;
}
@ -327,8 +327,8 @@ time_t linphone_presence_model_get_timestamp(const LinphonePresenceModel *model)
if (model == NULL)
return timestamp;
ms_list_for_each2(model->services, (MSIterate2Func)presence_service_find_newer_timestamp, &timestamp);
ms_list_for_each2(model->persons, (MSIterate2Func)presence_person_find_newer_timestamp, &timestamp);
bctbx_list_for_each2(model->services, (MSIterate2Func)presence_service_find_newer_timestamp, &timestamp);
bctbx_list_for_each2(model->persons, (MSIterate2Func)presence_person_find_newer_timestamp, &timestamp);
return timestamp;
}
@ -340,7 +340,7 @@ static void presence_model_find_contact(LinphonePresenceService *service, char *
char * linphone_presence_model_get_contact(const LinphonePresenceModel *model) {
char *contact = NULL;
ms_list_for_each2(model->services, (MSIterate2Func)presence_model_find_contact, &contact);
bctbx_list_for_each2(model->services, (MSIterate2Func)presence_model_find_contact, &contact);
if (contact == NULL) return NULL;
return ms_strdup(contact);
}
@ -360,7 +360,7 @@ int linphone_presence_model_set_contact(LinphonePresenceModel *model, const char
}
static void presence_model_count_activities(const LinphonePresencePerson *person, unsigned int *nb) {
*nb += ms_list_size(person->activities);
*nb += bctbx_list_size(person->activities);
}
struct _get_activity_st {
@ -371,9 +371,9 @@ struct _get_activity_st {
static void presence_model_get_activity(const LinphonePresencePerson *person, struct _get_activity_st *st) {
if (st->current_idx != (unsigned)-1) {
unsigned int size = ms_list_size(person->activities);
unsigned int size = bctbx_list_size(person->activities);
if (st->requested_idx < (st->current_idx + size)) {
st->activity = (LinphonePresenceActivity *)ms_list_nth_data(person->activities, st->requested_idx - st->current_idx);
st->activity = (LinphonePresenceActivity *)bctbx_list_nth_data(person->activities, st->requested_idx - st->current_idx);
st->current_idx = (unsigned)-1;
} else {
st->current_idx += size;
@ -416,7 +416,7 @@ int linphone_presence_model_set_activity(LinphonePresenceModel *model, LinphoneP
unsigned int linphone_presence_model_get_nb_activities(const LinphonePresenceModel *model) {
unsigned int nb = 0;
ms_list_for_each2(model->persons, (MSIterate2Func)presence_model_count_activities, &nb);
bctbx_list_for_each2(model->persons, (MSIterate2Func)presence_model_count_activities, &nb);
return nb;
}
@ -428,7 +428,7 @@ LinphonePresenceActivity * linphone_presence_model_get_nth_activity(const Linpho
memset(&st, 0, sizeof(st));
st.requested_idx = idx;
ms_list_for_each2(model->persons, (MSIterate2Func)presence_model_get_activity, &st);
bctbx_list_for_each2(model->persons, (MSIterate2Func)presence_model_get_activity, &st);
return st.activity;
}
@ -439,7 +439,7 @@ int linphone_presence_model_add_activity(LinphonePresenceModel *model, LinphoneP
if ((model == NULL) || (activity == NULL)) return -1;
if (ms_list_size(model->persons) == 0) {
if (bctbx_list_size(model->persons) == 0) {
/* There is no person in the presence model, add one. */
id = generate_presence_id();
person = presence_person_new(id, time(NULL));
@ -448,9 +448,10 @@ int linphone_presence_model_add_activity(LinphonePresenceModel *model, LinphoneP
return -1;
presence_model_add_person(model, person);
linphone_presence_person_unref(person);
} else {
/* Add the activity to the first person in the model. */
person = (LinphonePresencePerson *)ms_list_nth_data(model->persons, 0);
person = (LinphonePresencePerson *)bctbx_list_nth_data(model->persons, 0);
}
linphone_presence_person_add_activity(person, activity);
@ -460,7 +461,7 @@ int linphone_presence_model_add_activity(LinphonePresenceModel *model, LinphoneP
int linphone_presence_model_clear_activities(LinphonePresenceModel *model) {
if (model == NULL) return -1;
ms_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_clear_activities);
bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_clear_activities);
return 0;
}
@ -469,13 +470,13 @@ struct _find_note_st {
LinphonePresenceNote *note;
};
static LinphonePresenceNote * find_presence_note_in_list(MSList *list, const char *lang) {
static LinphonePresenceNote * find_presence_note_in_list(bctbx_list_t *list, const char *lang) {
int nb;
int i;
nb = ms_list_size(list);
nb = bctbx_list_size(list);
for (i = 0; i < nb; i++) {
LinphonePresenceNote *note = (LinphonePresenceNote *)ms_list_nth_data(list, i);
LinphonePresenceNote *note = (LinphonePresenceNote *)bctbx_list_nth_data(list, i);
if (lang == NULL) {
if (note->lang == NULL) {
return note;
@ -503,8 +504,8 @@ static void find_presence_service_note(LinphonePresenceService *service, struct
st->note = find_presence_note_in_list(service->notes, st->lang);
}
static LinphonePresenceNote * get_first_presence_note_in_list(MSList *list) {
return (LinphonePresenceNote *)ms_list_nth_data(list, 0);
static LinphonePresenceNote * get_first_presence_note_in_list(bctbx_list_t *list) {
return (LinphonePresenceNote *)bctbx_list_nth_data(list, 0);
}
static void get_first_presence_person_note(LinphonePresencePerson *person, struct _find_note_st *st) {
@ -526,9 +527,9 @@ LinphonePresenceNote * linphone_presence_model_get_note(const LinphonePresenceMo
if (lang != NULL) {
/* First try to find a note in the specified language exactly. */
st.lang = lang;
ms_list_for_each2(model->persons, (MSIterate2Func)find_presence_person_note, &st);
bctbx_list_for_each2(model->persons, (MSIterate2Func)find_presence_person_note, &st);
if (st.note == NULL) {
ms_list_for_each2(model->services, (MSIterate2Func)find_presence_service_note, &st);
bctbx_list_for_each2(model->services, (MSIterate2Func)find_presence_service_note, &st);
}
if (st.note == NULL) {
st.note = find_presence_note_in_list(model->notes, lang);
@ -538,9 +539,9 @@ LinphonePresenceNote * linphone_presence_model_get_note(const LinphonePresenceMo
if (st.note == NULL) {
/* No notes in the specified language has been found, try to find one without language. */
st.lang = NULL;
ms_list_for_each2(model->persons, (MSIterate2Func)find_presence_person_note, &st);
bctbx_list_for_each2(model->persons, (MSIterate2Func)find_presence_person_note, &st);
if (st.note == NULL) {
ms_list_for_each2(model->services, (MSIterate2Func)find_presence_service_note, &st);
bctbx_list_for_each2(model->services, (MSIterate2Func)find_presence_service_note, &st);
}
if (st.note == NULL) {
st.note = find_presence_note_in_list(model->notes, NULL);
@ -549,9 +550,9 @@ LinphonePresenceNote * linphone_presence_model_get_note(const LinphonePresenceMo
if (st.note == NULL) {
/* Still no result, so get the first note even if it is not in the specified language. */
ms_list_for_each2(model->persons, (MSIterate2Func)get_first_presence_person_note, &st);
bctbx_list_for_each2(model->persons, (MSIterate2Func)get_first_presence_person_note, &st);
if (st.note == NULL) {
ms_list_for_each2(model->services, (MSIterate2Func)get_first_presence_service_note, &st);
bctbx_list_for_each2(model->services, (MSIterate2Func)get_first_presence_service_note, &st);
}
if (st.note == NULL) {
st.note = get_first_presence_note_in_list(model->notes);
@ -569,7 +570,7 @@ int linphone_presence_model_add_note(LinphonePresenceModel *model, const char *n
return -1;
/* Will put the note in the first service. */
service = ms_list_nth_data(model->services, 0);
service = bctbx_list_nth_data(model->services, 0);
if (service == NULL) {
/* If no service exists, create one. */
service = presence_service_new(generate_presence_id(), LinphonePresenceBasicStatusClosed);
@ -593,17 +594,17 @@ int linphone_presence_model_add_note(LinphonePresenceModel *model, const char *n
}
static void clear_presence_person_notes(LinphonePresencePerson *person) {
ms_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(person->activities_notes);
bctbx_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(person->activities_notes);
person->activities_notes = NULL;
ms_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(person->notes);
bctbx_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(person->notes);
person->notes = NULL;
}
static void clear_presence_service_notes(LinphonePresenceService *service) {
ms_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(service->notes);
bctbx_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(service->notes);
service->notes = NULL;
}
@ -611,10 +612,10 @@ int linphone_presence_model_clear_notes(LinphonePresenceModel *model) {
if (model == NULL)
return -1;
ms_list_for_each(model->persons, (MSIterateFunc)clear_presence_person_notes);
ms_list_for_each(model->services, (MSIterateFunc)clear_presence_service_notes);
ms_list_for_each(model->notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(model->notes);
bctbx_list_for_each(model->persons, (MSIterateFunc)clear_presence_person_notes);
bctbx_list_for_each(model->services, (MSIterateFunc)clear_presence_service_notes);
bctbx_list_for_each(model->notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(model->notes);
model->notes = NULL;
return 0;
@ -631,40 +632,40 @@ LinphonePresenceModel * linphone_presence_model_new(void) {
}
unsigned int linphone_presence_model_get_nb_services(const LinphonePresenceModel *model) {
return ms_list_size(model->services);
return bctbx_list_size(model->services);
}
LinphonePresenceService * linphone_presence_model_get_nth_service(const LinphonePresenceModel *model, unsigned int idx) {
if ((model == NULL) || (idx >= linphone_presence_model_get_nb_services(model)))
return NULL;
return (LinphonePresenceService *)ms_list_nth_data(model->services, idx);
return (LinphonePresenceService *)bctbx_list_nth_data(model->services, idx);
}
int linphone_presence_model_add_service(LinphonePresenceModel *model, LinphonePresenceService *service) {
if ((model == NULL) || (service == NULL)) return -1;
model->services = ms_list_append(model->services, linphone_presence_service_ref(service));
model->services = bctbx_list_append(model->services, linphone_presence_service_ref(service));
return 0;
}
int linphone_presence_model_clear_services(LinphonePresenceModel *model) {
if (model == NULL) return -1;
ms_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref);
ms_list_free(model->services);
bctbx_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref);
bctbx_list_free(model->services);
model->services = NULL;
return 0;
}
unsigned int linphone_presence_model_get_nb_persons(const LinphonePresenceModel *model) {
return ms_list_size(model->persons);
return bctbx_list_size(model->persons);
}
LinphonePresencePerson * linphone_presence_model_get_nth_person(const LinphonePresenceModel *model, unsigned int idx) {
if ((model == NULL) || (idx >= linphone_presence_model_get_nb_persons(model)))
return NULL;
return (LinphonePresencePerson *)ms_list_nth_data(model->persons, idx);
return (LinphonePresencePerson *)bctbx_list_nth_data(model->persons, idx);
}
int linphone_presence_model_add_person(LinphonePresenceModel *model, LinphonePresencePerson *person) {
@ -676,8 +677,8 @@ int linphone_presence_model_add_person(LinphonePresenceModel *model, LinphonePre
int linphone_presence_model_clear_persons(LinphonePresenceModel *model) {
if (model == NULL) return -1;
ms_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
ms_list_free(model->persons);
bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
bctbx_list_free(model->persons);
model->persons = NULL;
return 0;
}
@ -761,27 +762,27 @@ int linphone_presence_service_set_contact(LinphonePresenceService *service, cons
}
unsigned int linphone_presence_service_get_nb_notes(const LinphonePresenceService *service) {
return ms_list_size(service->notes);
return bctbx_list_size(service->notes);
}
LinphonePresenceNote * linphone_presence_service_get_nth_note(const LinphonePresenceService *service, unsigned int idx) {
if ((service == NULL) || (idx >= linphone_presence_service_get_nb_notes(service)))
return NULL;
return (LinphonePresenceNote *)ms_list_nth_data(service->notes, idx);
return (LinphonePresenceNote *)bctbx_list_nth_data(service->notes, idx);
}
int linphone_presence_service_add_note(LinphonePresenceService *service, LinphonePresenceNote *note) {
if ((service == NULL) || (note == NULL)) return -1;
service->notes = ms_list_append(service->notes, linphone_presence_note_ref(note));
service->notes = bctbx_list_append(service->notes, linphone_presence_note_ref(note));
return 0;
}
int linphone_presence_service_clear_notes(LinphonePresenceService *service) {
if (service == NULL) return -1;
ms_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(service->notes);
bctbx_list_for_each(service->notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(service->notes);
service->notes = NULL;
return 0;
}
@ -814,76 +815,76 @@ int linphone_presence_person_set_id(LinphonePresencePerson *person, const char *
unsigned int linphone_presence_person_get_nb_activities(const LinphonePresencePerson *person) {
if (person == NULL) return 0;
return ms_list_size(person->activities);
return bctbx_list_size(person->activities);
}
LinphonePresenceActivity * linphone_presence_person_get_nth_activity(const LinphonePresencePerson *person, unsigned int idx) {
if ((person == NULL) || (idx >= linphone_presence_person_get_nb_activities(person)))
return NULL;
return (LinphonePresenceActivity *)ms_list_nth_data(person->activities, idx);
return (LinphonePresenceActivity *)bctbx_list_nth_data(person->activities, idx);
}
int linphone_presence_person_add_activity(LinphonePresencePerson *person, LinphonePresenceActivity *activity) {
if ((person == NULL) || (activity == NULL)) return -1;
// insert in first position since its the most recent activity!
person->activities = ms_list_prepend(person->activities, linphone_presence_activity_ref(activity));
person->activities = bctbx_list_prepend(person->activities, linphone_presence_activity_ref(activity));
return 0;
}
int linphone_presence_person_clear_activities(LinphonePresencePerson *person) {
if (person == NULL) return -1;
ms_list_for_each(person->activities, (MSIterateFunc)linphone_presence_activity_unref);
ms_list_free(person->activities);
bctbx_list_for_each(person->activities, (MSIterateFunc)linphone_presence_activity_unref);
bctbx_list_free(person->activities);
person->activities = NULL;
return 0;
}
unsigned int linphone_presence_person_get_nb_notes(const LinphonePresencePerson *person) {
if (person == NULL) return 0;
return ms_list_size(person->notes);
return bctbx_list_size(person->notes);
}
LinphonePresenceNote * linphone_presence_person_get_nth_note(const LinphonePresencePerson *person, unsigned int idx) {
if ((person == NULL) || (idx >= linphone_presence_person_get_nb_notes(person)))
return NULL;
return (LinphonePresenceNote *)ms_list_nth_data(person->notes, idx);
return (LinphonePresenceNote *)bctbx_list_nth_data(person->notes, idx);
}
int linphone_presence_person_add_note(LinphonePresencePerson *person, LinphonePresenceNote *note) {
if ((person == NULL) || (note == NULL)) return -1;
person->notes = ms_list_append(person->notes, linphone_presence_note_ref(note));
person->notes = bctbx_list_append(person->notes, linphone_presence_note_ref(note));
return 0;
}
int linphone_presence_person_clear_notes(LinphonePresencePerson *person) {
if (person == NULL) return -1;
ms_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(person->notes);
bctbx_list_for_each(person->notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(person->notes);
person->notes = NULL;
return 0;
}
unsigned int linphone_presence_person_get_nb_activities_notes(const LinphonePresencePerson *person) {
if (person == NULL) return 0;
return ms_list_size(person->activities_notes);
return bctbx_list_size(person->activities_notes);
}
LinphonePresenceNote * linphone_presence_person_get_nth_activities_note(const LinphonePresencePerson *person, unsigned int idx) {
if ((person == NULL) || (idx >= linphone_presence_person_get_nb_activities_notes(person)))
return NULL;
return (LinphonePresenceNote *)ms_list_nth_data(person->activities_notes, idx);
return (LinphonePresenceNote *)bctbx_list_nth_data(person->activities_notes, idx);
}
int linphone_presence_person_add_activities_note(LinphonePresencePerson *person, LinphonePresenceNote *note) {
if ((person == NULL) || (note == NULL)) return -1;
person->notes = ms_list_append(person->activities_notes, linphone_presence_note_ref(note));
person->notes = bctbx_list_append(person->activities_notes, linphone_presence_note_ref(note));
return 0;
}
int linphone_presence_person_clear_activities_notes(LinphonePresencePerson *person) {
if (person == NULL) return -1;
ms_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
ms_list_free(person->activities_notes);
bctbx_list_for_each(person->activities_notes, (MSIterateFunc)linphone_presence_note_unref);
bctbx_list_free(person->activities_notes);
person->activities_notes = NULL;
return 0;
}
@ -1407,7 +1408,7 @@ static int process_pidf_xml_presence_persons(xmlparsing_context_t *xml_ctx, Linp
if (err < 0) {
/* Remove all the persons added since there was an error. */
ms_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
bctbx_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref);
}
return err;
}
@ -1480,7 +1481,7 @@ void linphone_core_add_subscriber(LinphoneCore *lc, const char *subscriber, SalO
linphone_friend_set_inc_subscribe_policy(fl,LinphoneSPAccept);
fl->inc_subscribe_pending=TRUE;
/* the newly created "not yet" friend ownership is transfered to the lc->subscribers list*/
lc->subscribers=ms_list_append(lc->subscribers,fl);
lc->subscribers=bctbx_list_append(lc->subscribers,fl);
tmp = linphone_address_as_string(fl->uri);
linphone_core_notify_new_subscription_requested(lc,fl,tmp);
@ -1495,9 +1496,15 @@ void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf){
void linphone_core_notify_all_friends(LinphoneCore *lc, LinphonePresenceModel *presence){
LinphonePresenceActivity *activity = linphone_presence_model_get_activity(presence);
char *activity_str = linphone_presence_activity_to_string(activity);
LinphoneFriendList *lfl = linphone_core_get_default_friend_list(lc);
ms_message("Notifying all friends that we are [%s]", activity_str);
if (activity_str != NULL) ms_free(activity_str);
linphone_friend_list_notify_presence(linphone_core_get_default_friend_list(lc), presence);
if (lfl) {
linphone_friend_list_notify_presence(lfl, presence);
} else {
ms_error("Default friend list is null, skipping...");
}
}
void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
@ -1687,7 +1694,7 @@ static int write_xml_presence_service(xmlTextWriterPtr writer, LinphonePresenceS
st.writer = writer;
st.ns = NULL;
st.err = &err;
ms_list_for_each2(service->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
bctbx_list_for_each2(service->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
}
if (err >= 0) {
if (service == NULL)
@ -1735,7 +1742,7 @@ static void person_has_valid_activity(LinphonePresenceActivity *activity, bool_t
static bool_t person_has_valid_activities(LinphonePresencePerson *person) {
bool_t has_valid_activities = FALSE;
ms_list_for_each2(person->activities, (MSIterate2Func)person_has_valid_activity, &has_valid_activities);
bctbx_list_for_each2(person->activities, (MSIterate2Func)person_has_valid_activity, &has_valid_activities);
return has_valid_activities;
}
@ -1761,13 +1768,13 @@ static int write_xml_presence_person(xmlTextWriterPtr writer, LinphonePresencePe
st.writer = writer;
st.ns = "rpid";
st.err = &err;
ms_list_for_each2(person->activities_notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
bctbx_list_for_each2(person->activities_notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
}
if ((err >= 0) && (person->activities != NULL)) {
struct _presence_activity_obj_st st;
st.writer = writer;
st.err = &err;
ms_list_for_each2(person->activities, (MSIterate2Func)write_xml_presence_activity_obj, &st);
bctbx_list_for_each2(person->activities, (MSIterate2Func)write_xml_presence_activity_obj, &st);
}
if (err >= 0) {
/* Close the "activities" element. */
@ -1779,7 +1786,7 @@ static int write_xml_presence_person(xmlTextWriterPtr writer, LinphonePresencePe
st.writer = writer;
st.ns = "dm";
st.err = &err;
ms_list_for_each2(person->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
bctbx_list_for_each2(person->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
}
if (err >= 0) {
write_xml_presence_timestamp(writer, person->timestamp);
@ -1850,21 +1857,21 @@ char *linphone_presence_model_to_xml(LinphonePresenceModel *model) {
st.writer = writer;
st.contact = contact; /*default value*/
st.err = &err;
ms_list_for_each2(model->services, (MSIterate2Func)write_xml_presence_service_obj, &st);
bctbx_list_for_each2(model->services, (MSIterate2Func)write_xml_presence_service_obj, &st);
}
}
if ((err >= 0) && (model != NULL)) {
struct _presence_person_obj_st st={0};
st.writer = writer;
st.err = &err;
ms_list_for_each2(model->persons, (MSIterate2Func)write_xml_presence_person_obj, &st);
bctbx_list_for_each2(model->persons, (MSIterate2Func)write_xml_presence_person_obj, &st);
}
if ((err >= 0) && (model != NULL)) {
struct _presence_note_obj_st st={0};
st.writer = writer;
st.ns = NULL;
st.err = &err;
ms_list_for_each2(model->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
bctbx_list_for_each2(model->notes, (MSIterate2Func)write_xml_presence_note_obj, &st);
}
if (err >= 0) {
/* Close the "presence" element. */

View file

@ -255,12 +255,17 @@ struct _LinphoneChatMessage {
belle_http_request_listener_t *http_listener; /* our listener, only owned by us*/
char *file_transfer_filepath;
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#if defined(__clang__) || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef _MSC_VER
#pragma deprecated(message_state_changed_cb)
#endif
LinphoneChatMessageStateChangedCb message_state_changed_cb;
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#if defined(__clang__) || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
};
@ -440,6 +445,7 @@ LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, Li
LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc);
LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize);
int linphone_parse_host_port(const char *input, char *host, size_t hostlen, int *port);
int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen, int default_port);
bool_t host_has_ipv6_network(void);
@ -504,6 +510,7 @@ LINPHONE_PUBLIC const struct addrinfo *linphone_core_get_stun_server_addrinfo(Li
void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params);
int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call);
LINPHONE_PUBLIC void linphone_core_enable_forced_ice_relay(LinphoneCore *lc, bool_t enable);
LINPHONE_PUBLIC void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, bool_t enable);
void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call);
void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev);
void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDescription *result);
@ -616,6 +623,7 @@ struct _LinphoneProxyConfig
char *dial_prefix;
LinphoneRegistrationState state;
LinphoneAVPFMode avpf_mode;
LinphoneNatPolicy *nat_policy;
bool_t commit;
bool_t reg_sendregister;
@ -800,7 +808,6 @@ typedef struct net_config
{
char *nat_address; /* may be IP or host name */
char *nat_address_ip; /* ip translated from nat_address */
char *stun_server;
struct addrinfo *stun_addrinfo;
SalResolverContext * stun_res;
int download_bw;
@ -933,7 +940,7 @@ struct _LinphoneCore
MSList *queued_calls; /* used by the autoreplier */
MSList *call_logs;
MSList *chatrooms;
int max_call_logs;
unsigned int max_call_logs;
int missed_calls;
VideoPreview *previewstream;
struct _MSEventQueue *msevq;
@ -959,6 +966,7 @@ struct _LinphoneCore
char* user_certificates_path;
LinphoneVideoPolicy video_policy;
time_t network_last_check;
LinphoneNatPolicy *nat_policy;
bool_t use_files;
bool_t apply_nat_settings;
@ -978,7 +986,7 @@ struct _LinphoneCore
bool_t vtables_running;
bool_t send_call_stats_periodical_updates;
bool_t forced_ice_relay;
bool_t pad;
bool_t short_turn_refresh;
char localip[LINPHONE_IPADDR_SIZE];
int device_rotation;
int max_calls;
@ -1187,6 +1195,25 @@ struct _LinphoneBuffer {
BELLE_SIP_DECLARE_VPTR(LinphoneBuffer);
struct _LinphoneNatPolicy {
belle_sip_object_t base;
void *user_data;
LinphoneCore *lc;
SalResolverContext *stun_resolver_context;
struct addrinfo *stun_addrinfo;
char *stun_server;
char *stun_server_username;
char *ref;
bool_t stun_enabled;
bool_t turn_enabled;
bool_t ice_enabled;
bool_t upnp_enabled;
};
BELLE_SIP_DECLARE_VPTR(LinphoneNatPolicy);
void linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy);
/*****************************************************************************
* XML-RPC interface *
@ -1407,7 +1434,8 @@ BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequestCbs),
BELLE_SIP_TYPE_ID(LinphoneXmlRpcSession),
BELLE_SIP_TYPE_ID(LinphoneTunnelConfig),
BELLE_SIP_TYPE_ID(LinphoneFriendListCbs),
BELLE_SIP_TYPE_ID(LinphoneEvent)
BELLE_SIP_TYPE_ID(LinphoneEvent),
BELLE_SIP_TYPE_ID(LinphoneNatPolicy)
BELLE_SIP_DECLARE_TYPES_END
@ -1524,6 +1552,8 @@ char *linphone_presence_model_to_xml(LinphonePresenceModel *model) ;
#define LINPHONE_SQLITE3_VFS "sqlite3bctbx_vfs"
void linphone_call_check_ice_session(LinphoneCall *call, IceRole role, bool_t is_reinvite);
#ifdef __cplusplus
}
#endif

View file

@ -83,11 +83,11 @@ LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_confi
}
void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc){
MSList *elem;
bctbx_list_t *elem;
int i;
if (!linphone_core_ready(lc)) return;
for(elem=lc->sip_conf.proxies,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
for(elem=lc->sip_conf.proxies,i=0;elem!=NULL;elem=bctbx_list_next(elem),i++){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
linphone_proxy_config_write_to_config_file(lc->config,cfg,i);
}
@ -221,6 +221,9 @@ void _linphone_proxy_config_destroy(LinphoneProxyConfig *cfg){
if (cfg->sent_headers!=NULL) sal_custom_header_free(cfg->sent_headers);
if (cfg->pending_contact) linphone_address_unref(cfg->pending_contact);
if (cfg->refkey) ms_free(cfg->refkey);
if (cfg->nat_policy != NULL) {
linphone_nat_policy_unref(cfg->nat_policy);
}
_linphone_proxy_config_release_ops(cfg);
}
@ -1224,24 +1227,24 @@ int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cfg){
if (!linphone_proxy_config_check(lc,cfg)) {
return -1;
}
if (ms_list_find(lc->sip_conf.proxies,cfg)!=NULL){
if (bctbx_list_find(lc->sip_conf.proxies,cfg)!=NULL){
ms_warning("ProxyConfig already entered, ignored.");
return 0;
}
lc->sip_conf.proxies=ms_list_append(lc->sip_conf.proxies,(void *)linphone_proxy_config_ref(cfg));
lc->sip_conf.proxies=bctbx_list_append(lc->sip_conf.proxies,(void *)linphone_proxy_config_ref(cfg));
linphone_proxy_config_apply(cfg,lc);
return 0;
}
void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cfg){
/* check this proxy config is in the list before doing more*/
if (ms_list_find(lc->sip_conf.proxies,cfg)==NULL){
if (bctbx_list_find(lc->sip_conf.proxies,cfg)==NULL){
ms_error("linphone_core_remove_proxy_config: LinphoneProxyConfig [%p] is not known by LinphoneCore (programming error?)",cfg);
return;
}
lc->sip_conf.proxies=ms_list_remove(lc->sip_conf.proxies,cfg);
lc->sip_conf.proxies=bctbx_list_remove(lc->sip_conf.proxies,cfg);
/* add to the list of destroyed proxies, so that the possible unREGISTER request can succeed authentication */
lc->sip_conf.deleted_proxies=ms_list_append(lc->sip_conf.deleted_proxies,cfg);
lc->sip_conf.deleted_proxies=bctbx_list_append(lc->sip_conf.deleted_proxies,cfg);
if (lc->default_proxy==cfg){
lc->default_proxy=NULL;
@ -1261,19 +1264,19 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
}
void linphone_core_clear_proxy_config(LinphoneCore *lc){
MSList* list=ms_list_copy(linphone_core_get_proxy_config_list((const LinphoneCore*)lc));
MSList* copy=list;
bctbx_list_t* list=bctbx_list_copy(linphone_core_get_proxy_config_list((const LinphoneCore*)lc));
bctbx_list_t* copy=list;
for(;list!=NULL;list=list->next){
linphone_core_remove_proxy_config(lc,(LinphoneProxyConfig *)list->data);
}
ms_list_free(copy);
bctbx_list_free(copy);
linphone_proxy_config_write_all_to_config_file(lc);
}
int linphone_core_get_default_proxy_config_index(LinphoneCore *lc) {
int pos = -1;
if (lc->default_proxy != NULL) {
pos = ms_list_position(lc->sip_conf.proxies, ms_list_find(lc->sip_conf.proxies, (void *)lc->default_proxy));
pos = bctbx_list_position(lc->sip_conf.proxies, bctbx_list_find(lc->sip_conf.proxies, (void *)lc->default_proxy));
}
return pos;
}
@ -1281,7 +1284,7 @@ int linphone_core_get_default_proxy_config_index(LinphoneCore *lc) {
void linphone_core_set_default_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config){
/* check if this proxy is in our list */
if (config!=NULL){
if (ms_list_find(lc->sip_conf.proxies,config)==NULL){
if (bctbx_list_find(lc->sip_conf.proxies,config)==NULL){
ms_warning("Bad proxy address: it is not in the list !");
lc->default_proxy=NULL;
return ;
@ -1294,7 +1297,7 @@ void linphone_core_set_default_proxy_config(LinphoneCore *lc, LinphoneProxyConfi
void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index){
if (index<0) linphone_core_set_default_proxy(lc,NULL);
else linphone_core_set_default_proxy(lc,ms_list_nth_data(lc->sip_conf.proxies,index));
else linphone_core_set_default_proxy(lc,bctbx_list_nth_data(lc->sip_conf.proxies,index));
}
int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config){
@ -1306,7 +1309,7 @@ LinphoneProxyConfig * linphone_core_get_default_proxy_config(LinphoneCore *lc) {
return lc->default_proxy;
}
const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc){
const bctbx_list_t *linphone_core_get_proxy_config_list(const LinphoneCore *lc){
return lc->sip_conf.proxies;
}
@ -1355,6 +1358,11 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC
lp_config_set_int(config,key,"privacy",cfg->privacy);
if (cfg->refkey) lp_config_set_string(config,key,"refkey",cfg->refkey);
lp_config_set_int(config, key, "publish_expires", cfg->publish_expires);
if (cfg->nat_policy != NULL) {
lp_config_set_string(config, key, "nat_policy_ref", cfg->nat_policy->ref);
linphone_nat_policy_save_to_config(cfg->nat_policy);
}
}
@ -1377,6 +1385,7 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc
LinphoneProxyConfig *cfg;
char key[50];
LpConfig *config=lc->config;
const char *nat_policy_ref;
sprintf(key,"proxy_%i",index);
@ -1415,6 +1424,11 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc
CONFIGURE_STRING_VALUE(cfg,config,key,ref_key,"refkey")
CONFIGURE_INT_VALUE(cfg,config,key,publish_expires,"publish_expires")
nat_policy_ref = lp_config_get_string(config, key, "nat_policy_ref", NULL);
if (nat_policy_ref != NULL) {
cfg->nat_policy = linphone_core_create_nat_policy_from_config(lc, nat_policy_ref);
}
return cfg;
}
@ -1677,3 +1691,13 @@ void linphone_proxy_config_set_ref_key(LinphoneProxyConfig *cfg, const char *ref
}
if (refkey) cfg->refkey=ms_strdup(refkey);
}
LinphoneNatPolicy * linphone_proxy_config_get_nat_policy(const LinphoneProxyConfig *cfg) {
return cfg->nat_policy;
}
void linphone_proxy_config_set_nat_policy(LinphoneProxyConfig *cfg, LinphoneNatPolicy *policy) {
if (policy != NULL) policy = linphone_nat_policy_ref(policy); /* Prevent object destruction if the same policy is used */
if (cfg->nat_policy != NULL) linphone_nat_policy_unref(cfg->nat_policy);
if (policy != NULL) cfg->nat_policy = policy;
}

View file

@ -69,8 +69,8 @@ SalMediaDescription *sal_media_description_new(){
static void sal_media_description_destroy(SalMediaDescription *md){
int i;
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;i++){
ms_list_free_with_data(md->streams[i].payloads,(void (*)(void *))payload_type_destroy);
ms_list_free_with_data(md->streams[i].already_assigned_payloads,(void (*)(void *))payload_type_destroy);
bctbx_list_free_with_data(md->streams[i].payloads,(void (*)(void *))payload_type_destroy);
bctbx_list_free_with_data(md->streams[i].already_assigned_payloads,(void (*)(void *))payload_type_destroy);
md->streams[i].payloads=NULL;
md->streams[i].already_assigned_payloads=NULL;
sal_custom_sdp_attribute_free(md->streams[i].custom_sdp_attributes);
@ -356,8 +356,8 @@ static bool_t is_recv_only(PayloadType *p){
return (p->flags & PAYLOAD_TYPE_FLAG_CAN_RECV) && ! (p->flags & PAYLOAD_TYPE_FLAG_CAN_SEND);
}
static bool_t payload_list_equals(const MSList *l1, const MSList *l2){
const MSList *e1,*e2;
static bool_t payload_list_equals(const bctbx_list_t *l1, const bctbx_list_t *l2){
const bctbx_list_t *e1,*e2;
for(e1=l1,e2=l2;e1!=NULL && e2!=NULL; e1=e1->next,e2=e2->next){
PayloadType *p1=(PayloadType*)e1->data;
PayloadType *p2=(PayloadType*)e2->data;
@ -527,18 +527,18 @@ void sal_op_set_route(SalOp *op, const char *route){
char* route_string=(void *)0;
SalOpBase* op_base = (SalOpBase*)op;
if (op_base->route_addresses) {
ms_list_for_each(op_base->route_addresses,(void (*)(void *))sal_address_destroy);
op_base->route_addresses=ms_list_free(op_base->route_addresses);
bctbx_list_for_each(op_base->route_addresses,(void (*)(void *))sal_address_destroy);
op_base->route_addresses=bctbx_list_free(op_base->route_addresses);
}
if (route) {
op_base->route_addresses=ms_list_append(NULL,NULL);
op_base->route_addresses=bctbx_list_append(NULL,NULL);
assign_address((SalAddress**)&(op_base->route_addresses->data),route);
route_string=sal_address_as_string((SalAddress*)op_base->route_addresses->data); \
}
assign_string(&op_base->route,route_string); \
if(route_string) ms_free(route_string);
}
const MSList* sal_op_get_route_addresses(const SalOp *op) {
const bctbx_list_t* sal_op_get_route_addresses(const SalOp *op) {
return ((SalOpBase*)op)->route_addresses;
}
void sal_op_set_route_address(SalOp *op, const SalAddress *address){
@ -549,7 +549,7 @@ void sal_op_set_route_address(SalOp *op, const SalAddress *address){
void sal_op_add_route_address(SalOp *op, const SalAddress *address){
SalOpBase* op_base = (SalOpBase*)op;
if (op_base->route_addresses) {
op_base->route_addresses=ms_list_append(op_base->route_addresses,(void*)sal_address_clone(address));
op_base->route_addresses=bctbx_list_append(op_base->route_addresses,(void*)sal_address_clone(address));
} else {
sal_op_set_route_address(op,address);
}
@ -713,8 +713,8 @@ void __sal_op_free(SalOp *op){
sal_address_destroy(b->service_route);
}
if (b->route_addresses){
ms_list_for_each(b->route_addresses,(void (*)(void*)) sal_address_destroy);
b->route_addresses=ms_list_free(b->route_addresses);
bctbx_list_for_each(b->route_addresses,(void (*)(void*)) sal_address_destroy);
b->route_addresses=bctbx_list_free(b->route_addresses);
}
if (b->recv_custom_headers)
sal_custom_header_free(b->recv_custom_headers);

View file

@ -29,10 +29,10 @@ static SipSetup *all_sip_setups[]={
NULL
};
static MSList *registered_sip_setups=NULL;
static bctbx_list_t *registered_sip_setups=NULL;
void sip_setup_register(SipSetup *ss){
registered_sip_setups=ms_list_append(registered_sip_setups,ss);
registered_sip_setups=bctbx_list_append(registered_sip_setups,ss);
}
void sip_setup_register_all(MSFactory *factory){
@ -45,12 +45,12 @@ void sip_setup_register_all(MSFactory *factory){
}
}
const MSList * linphone_core_get_sip_setups(LinphoneCore *lc){
const bctbx_list_t * linphone_core_get_sip_setups(LinphoneCore *lc){
return registered_sip_setups;
}
SipSetup *sip_setup_lookup(const char *type_name){
MSList *elem;
bctbx_list_t *elem;
for(elem=registered_sip_setups;elem!=NULL;elem=elem->next){
SipSetup *ss=(SipSetup*)elem->data;
if ( strcasecmp(ss->name,type_name)==0){
@ -69,7 +69,7 @@ SipSetup *sip_setup_lookup(const char *type_name){
}
void sip_setup_unregister_all(void){
MSList *elem;
bctbx_list_t *elem;
for(elem=registered_sip_setups;elem!=NULL;elem=elem->next){
SipSetup *ss=(SipSetup*)elem->data;
if (ss->initialized){
@ -77,7 +77,7 @@ void sip_setup_unregister_all(void){
ss->initialized=FALSE;
}
}
registered_sip_setups = ms_list_free(registered_sip_setups);
registered_sip_setups = bctbx_list_free(registered_sip_setups);
}
void buddy_lookup_request_set_key(BuddyLookupRequest *req, const char *key){
@ -95,8 +95,8 @@ void buddy_lookup_request_set_max_results(BuddyLookupRequest *req, int ncount){
void buddy_lookup_request_free(BuddyLookupRequest *req){
if (req->key) ms_free(req->key);
if (req->results){
ms_list_for_each(req->results,(void (*)(void*))buddy_info_free);
ms_list_free(req->results);
bctbx_list_for_each(req->results,(void (*)(void*))buddy_info_free);
bctbx_list_free(req->results);
}
ms_free(req);
}

173
coreapi/sqlite3_bctbx_vfs.c Normal file → Executable file
View file

@ -28,6 +28,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif /*_WIN32_WCE*/
#ifndef _WIN32
#if !defined(__QNXNTO__)
# include <langinfo.h>
# include <locale.h>
# include <iconv.h>
# include <string.h>
#endif
#endif
/**
* Closes the file whose file descriptor is stored in the file handle p.
@ -51,32 +61,32 @@ static int sqlite3bctbx_Close(sqlite3_file *p){
/**
* Read count bytes from the open file given by p, starting at offset and puts them in
* Read count bytes from the open file given by p, starting at offset and puts them in
* the buffer pointed by buf.
* Calls bctbx_file_read.
*
*
* @param p sqlite3_file file handle pointer.
* @param buf buffer to write the read bytes to.
* @param count number of bytes to read
* @param offset file offset where to start reading
* @return SQLITE_OK if read bytes equals count,
* @return SQLITE_OK if read bytes equals count,
* SQLITE_IOERR_SHORT_READ if the number of bytes read is inferior to count
* SQLITE_IOERR_READ if an error occurred.
* SQLITE_IOERR_READ if an error occurred.
*/
static int sqlite3bctbx_Read(sqlite3_file *p, void *buf, int count, sqlite_int64 offset){
int ret;
sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*) p;
if (pFile){
ret = bctbx_file_read(pFile->pbctbx_file, buf, count, offset);
ret = bctbx_file_read(pFile->pbctbx_file, buf, count, (off_t)offset);
if( ret==count ){
return SQLITE_OK;
}
else if( ret >= 0 ){
/*fill in unread portion of buffer, as requested by sqlite3 documentation*/
memset(((uint8_t*)buf) + ret, 0, count-ret);
memset(((uint8_t*)buf) + ret, 0, count-ret);
return SQLITE_IOERR_SHORT_READ;
}else {
return SQLITE_IOERR_READ;
}
}
@ -96,7 +106,7 @@ static int sqlite3bctbx_Write(sqlite3_file *p, const void *buf, int count, sqlit
sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*) p;
int ret;
if (pFile ){
ret = bctbx_file_write(pFile->pbctbx_file, buf, count, offset);
ret = bctbx_file_write(pFile->pbctbx_file, buf, count, (off_t)offset);
if(ret > 0 ) return SQLITE_OK;
else {
return SQLITE_IOERR_WRITE;
@ -104,18 +114,18 @@ static int sqlite3bctbx_Write(sqlite3_file *p, const void *buf, int count, sqlit
}
return SQLITE_IOERR_WRITE;
}
/**
* Saves the file size associated with the file handle p into the argument pSize.
* @param p sqlite3_file file handle pointer.
* @return SQLITE_OK if read bytes equals count,
* SQLITE_IOERR_FSTAT if the file size returned is negative
* SQLITE_ERROR if an error occurred.
* @return SQLITE_OK if read bytes equals count,
* SQLITE_IOERR_FSTAT if the file size returned is negative
* SQLITE_ERROR if an error occurred.
*/
static int sqlite3bctbx_FileSize(sqlite3_file *p, sqlite_int64 *pSize){
int rc; /* Return code from fstat() call */
int64_t rc; /* Return code from fstat() call */
sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*) p;
if (pFile->pbctbx_file){
rc = bctbx_file_size(pFile->pbctbx_file);
@ -125,7 +135,7 @@ static int sqlite3bctbx_FileSize(sqlite3_file *p, sqlite_int64 *pSize){
if (pSize){
*pSize = rc;
return SQLITE_OK;
}
}
}
return SQLITE_ERROR;
@ -134,7 +144,7 @@ static int sqlite3bctbx_FileSize(sqlite3_file *p, sqlite_int64 *pSize){
/************************ PLACE HOLDER FUNCTIONS ***********************/
/** These functions were implemented to please the SQLite VFS
/** These functions were implemented to please the SQLite VFS
implementation. Some of them are just stubs, some do a very limited job. */
@ -177,7 +187,7 @@ static int sqlite3bctbx_nolockCheckReservedLock(sqlite3_file *pUnused, int *pRes
}
/**
* The lock file mechanism is not used with this VFS : locking the file
* The lock file mechanism is not used with this VFS : locking the file
* is always OK.
* @param pUnused sqlite3_file file handle pointer.
* @param unused unused
@ -209,7 +219,9 @@ static int sqlite3bctbx_nolockUnlock(sqlite3_file *pUnused, int unused){
static int sqlite3bctbx_Sync(sqlite3_file *p, int flags){
sqlite3_bctbx_file_t *pFile = (sqlite3_bctbx_file_t*)p;
#if _WIN32
return (FlushFileBuffers(pFile->pbctbx_file->fd) ? SQLITE_OK : SQLITE_IOERR_FSYNC);
int ret;
ret = FlushFileBuffers((HANDLE)_get_osfhandle(pFile->pbctbx_file->fd));
return (ret!=0 ? SQLITE_OK : SQLITE_IOERR_FSYNC);
#else
int rc = fsync(pFile->pbctbx_file->fd);
return (rc==0 ? SQLITE_OK : SQLITE_IOERR_FSYNC);
@ -218,6 +230,57 @@ static int sqlite3bctbx_Sync(sqlite3_file *p, int flags){
/************************ END OF PLACE HOLDER FUNCTIONS ***********************/
static char* ConvertFromUtf8Filename(const char* fName){
#if _WIN32
char* convertedFilename;
int nChar, nb_byte;
LPWSTR wideFilename;
nChar = MultiByteToWideChar(CP_UTF8, 0, fName, -1, NULL, 0);
if (nChar == 0) return NULL;
wideFilename = bctbx_malloc(nChar*sizeof(wideFilename[0]));
if (wideFilename == NULL) return NULL;
nChar = MultiByteToWideChar(CP_UTF8, 0, fName, -1, wideFilename, nChar);
if (nChar == 0) {
bctbx_free(wideFilename);
wideFilename = 0;
}
nb_byte = WideCharToMultiByte(CP_ACP, 0, wideFilename, -1, 0, 0, 0, 0);
if (nb_byte == 0) return NULL;
convertedFilename = bctbx_malloc(nb_byte);
if (convertedFilename == NULL) return NULL;
nb_byte = WideCharToMultiByte(CP_ACP, 0, wideFilename, -1, convertedFilename, nb_byte, 0, 0);
if (nb_byte == 0) {
bctbx_free(convertedFilename);
convertedFilename = 0;
}
bctbx_free(wideFilename);
return convertedFilename;
#else
#define MAX_PATH_SIZE 1024
char db_file_utf8[MAX_PATH_SIZE] = {'\0'};
char db_file_locale[MAX_PATH_SIZE] = "";
char *outbuf=db_file_locale, *inbuf=db_file_utf8;
size_t inbyteleft = MAX_PATH_SIZE, outbyteleft = MAX_PATH_SIZE;
iconv_t cb;
strncpy(db_file_utf8, fName, MAX_PATH_SIZE-1);
cb = iconv_open(nl_langinfo(CODESET), "UTF-8");
if(cb != (iconv_t)-1) {
int ret;
ret = iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
if(ret == -1) db_file_locale[0] = '\0';
iconv_close(cb);
}
return bctbx_strdup(db_file_locale);
#endif
}
#endif
/**
* Opens the file fName and populates the structure pointed by p
* with the necessary io_methods
@ -227,7 +290,7 @@ static int sqlite3bctbx_Sync(sqlite3_file *p, int flags){
* @param pVfs sqlite3_vfs VFS pointer.
* @param fName filename
* @param p file handle pointer
* @param flags db file access flags
* @param flags db file access flags
* @param pOutFlags flags used by SQLite
* @return SQLITE_CANTOPEN on error, SQLITE_OK on success.
*/
@ -239,7 +302,7 @@ static int sqlite3bctbx_Open(sqlite3_vfs *pVfs, const char *fName, sqlite3_file
sqlite3bctbx_Write, /* xWrite */
0, /*xTruncate*/
sqlite3bctbx_Sync,
sqlite3bctbx_FileSize,
sqlite3bctbx_FileSize,
sqlite3bctbx_nolockLock,
sqlite3bctbx_nolockUnlock,
sqlite3bctbx_nolockCheckReservedLock,
@ -249,21 +312,31 @@ static int sqlite3bctbx_Open(sqlite3_vfs *pVfs, const char *fName, sqlite3_file
};
sqlite3_bctbx_file_t * pFile = (sqlite3_bctbx_file_t*)p; /*File handle sqlite3_bctbx_file_t*/
int openFlags = 0;
char* wFname;
/*returns error if filename is empty or file handle not initialized*/
if (pFile == NULL || fName == NULL){
return SQLITE_IOERR;
}
/* Set flags to open the file with */
if( flags&SQLITE_OPEN_EXCLUSIVE ) openFlags |= O_EXCL;
if( flags&SQLITE_OPEN_CREATE ) openFlags |= O_CREAT;
if( flags&SQLITE_OPEN_READONLY ) openFlags |= O_RDONLY;
if( flags&SQLITE_OPEN_READWRITE ) openFlags |= O_RDWR;
pFile->pbctbx_file = bctbx_file_open2(bctbx_vfs_get_default(), fName, openFlags);
#if defined(_WIN32)
openFlags |= O_BINARY;
#endif
wFname = ConvertFromUtf8Filename(fName);
if (wFname != NULL) {
pFile->pbctbx_file = bctbx_file_open2(bctbx_vfs_get_default(), wFname, openFlags);
bctbx_free(wFname);
} else {
pFile->pbctbx_file = NULL;
}
if( pFile->pbctbx_file == NULL){
return SQLITE_CANTOPEN;
}
@ -301,6 +374,48 @@ sqlite3_vfs *sqlite3_bctbx_vfs_create(void){
return &bctbx_vfs;
}
/*static int sqlite3bctbx_winFullPathname(
sqlite3_vfs *pVfs, // Pointer to vfs object
const char *zRelative, // Possibly relative input path
int nFull, // Size of output buffer in bytes
char *zFull){
//LPWSTR zTemp;
//DWORD nByte;
// If this path name begins with "/X:", where "X" is any alphabetic
// character, discard the initial "/" from the pathname.
//
//if (zRelative[0] == '/' && sqlite3Isalpha(zRelative[1]) && zRelative[2] == ':'){
// zRelative++;
//}
nByte = GetFullPathNameW((LPCWSTR)zRelative, 0, 0, 0);
if (nByte == 0){
return SQLITE_CANTOPEN_FULLPATH;
}
nByte += 3;
zTemp = bctbx_malloc(nByte*sizeof(zTemp[0]));
memset(zTemp, 0, nByte*sizeof(zTemp[0]));
if (zTemp == 0){
return SQLITE_IOERR_NOMEM;
}
nByte = GetFullPathNameW((LPCWSTR)zRelative, nByte, zTemp, 0);
if (nByte == 0){
bctbx_free(zTemp);
return SQLITE_CANTOPEN_FULLPATH;
}
if (zTemp){
sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zTemp);
bctbx_free(zTemp);
return SQLITE_OK;
}
else{
return SQLITE_IOERR_NOMEM;
}
sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zRelative);
return SQLITE_OK;
}*/
void sqlite3_bctbx_vfs_register( int makeDefault){
sqlite3_vfs* pVfsToUse = sqlite3_bctbx_vfs_create();
@ -309,20 +424,21 @@ void sqlite3_bctbx_vfs_register( int makeDefault){
#else
sqlite3_vfs* pDefault = sqlite3_vfs_find("unix-none");
#endif
pVfsToUse->xAccess = pDefault->xAccess;
pVfsToUse->xCurrentTime = pDefault->xCurrentTime;
pVfsToUse->xAccess = pDefault->xAccess;
pVfsToUse->xFullPathname = pDefault->xFullPathname;
pVfsToUse->xDelete = pDefault->xDelete;
pVfsToUse->xSleep = pDefault->xSleep;
pVfsToUse->xRandomness = pDefault->xRandomness;
pVfsToUse->xGetLastError = pDefault->xGetLastError; /* Not implemented by sqlite3 :place holder */
/*Functions below should not be a problem sincve we are declaring ourselves
in version 1 */
/* used in version 2
/* used in version 2
xCurrentTimeInt64;*/
/* used in version 3
/* used in version 3
xGetSystemCall
xSetSystemCall
xNextSystemCall*/
@ -338,6 +454,3 @@ void sqlite3_bctbx_vfs_unregister(void)
sqlite3_vfs_unregister(pVfs);
}
#endif

View file

@ -73,9 +73,9 @@ struct _UpnpContext {
UpnpPortBinding *sip_tls;
UpnpPortBinding *sip_udp;
LinphoneUpnpState state;
MSList *removing_configs;
MSList *adding_configs;
MSList *pending_bindings;
bctbx_list_t *removing_configs;
bctbx_list_t *adding_configs;
bctbx_list_t *pending_bindings;
ms_mutex_t mutex;
ms_cond_t empty_cond;
@ -91,11 +91,11 @@ bool_t linphone_upnp_is_blacklisted(UpnpContext *ctx);
UpnpPortBinding *linphone_upnp_port_binding_new(void);
UpnpPortBinding *linphone_upnp_port_binding_new_with_parameters(upnp_igd_ip_protocol protocol, int local_port, int external_port);
UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(MSList *list, upnp_igd_ip_protocol protocol, int local_port, int external_port);
UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(bctbx_list_t *list, upnp_igd_ip_protocol protocol, int local_port, int external_port);
UpnpPortBinding *linphone_upnp_port_binding_copy(const UpnpPortBinding *port);
void linphone_upnp_port_binding_set_device_id(UpnpPortBinding *port, const char * device_id);
bool_t linphone_upnp_port_binding_equal(const UpnpPortBinding *port1, const UpnpPortBinding *port2);
UpnpPortBinding *linphone_upnp_port_binding_equivalent_in_list(MSList *list, const UpnpPortBinding *port);
UpnpPortBinding *linphone_upnp_port_binding_equivalent_in_list(bctbx_list_t *list, const UpnpPortBinding *port);
UpnpPortBinding *linphone_upnp_port_binding_retain(UpnpPortBinding *port);
void linphone_upnp_update_port_binding(UpnpContext *lupnp, UpnpPortBinding **port_mapping, upnp_igd_ip_protocol protocol, int port, int retry_delay);
void linphone_upnp_port_binding_log(int level, const char *msg, const UpnpPortBinding *port);
@ -104,7 +104,7 @@ void linphone_upnp_update_config(UpnpContext *lupnp);
void linphone_upnp_update_proxy(UpnpContext *lupnp, bool_t force);
// Configuration
MSList *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const char *device_id);
bctbx_list_t *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const char *device_id);
void linphone_upnp_config_add_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port);
void linphone_upnp_config_remove_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port);
@ -302,7 +302,7 @@ void linphone_upnp_igd_callback(void *cookie, upnp_igd_event event, void *arg) {
}
}
lupnp->pending_bindings = ms_list_remove(lupnp->pending_bindings, port_mapping);
lupnp->pending_bindings = bctbx_list_remove(lupnp->pending_bindings, port_mapping);
linphone_upnp_port_binding_release(port_mapping);
}
@ -413,12 +413,12 @@ void linphone_upnp_context_destroy(UpnpContext *lupnp) {
}
/* Release lists */
ms_list_for_each(lupnp->adding_configs,(void (*)(void*))linphone_upnp_port_binding_release);
lupnp->adding_configs = ms_list_free(lupnp->adding_configs);
ms_list_for_each(lupnp->removing_configs,(void (*)(void*))linphone_upnp_port_binding_release);
lupnp->removing_configs = ms_list_free(lupnp->removing_configs);
ms_list_for_each(lupnp->pending_bindings,(void (*)(void*))linphone_upnp_port_binding_release);
lupnp->pending_bindings = ms_list_free(lupnp->pending_bindings);
bctbx_list_for_each(lupnp->adding_configs,(void (*)(void*))linphone_upnp_port_binding_release);
lupnp->adding_configs = bctbx_list_free(lupnp->adding_configs);
bctbx_list_for_each(lupnp->removing_configs,(void (*)(void*))linphone_upnp_port_binding_release);
lupnp->removing_configs = bctbx_list_free(lupnp->removing_configs);
bctbx_list_for_each(lupnp->pending_bindings,(void (*)(void*))linphone_upnp_port_binding_release);
lupnp->pending_bindings = bctbx_list_free(lupnp->pending_bindings);
ms_mutex_destroy(&lupnp->mutex);
ms_cond_destroy(&lupnp->empty_cond);
@ -598,7 +598,7 @@ int linphone_upnp_context_send_add_port_binding(UpnpContext *lupnp, UpnpPortBind
} else {
linphone_upnp_port_binding_set_device_id(port, upnp_igd_get_device_id(lupnp->upnp_igd_ctxt));
mapping.cookie = linphone_upnp_port_binding_retain(port);
lupnp->pending_bindings = ms_list_append(lupnp->pending_bindings, mapping.cookie);
lupnp->pending_bindings = bctbx_list_append(lupnp->pending_bindings, mapping.cookie);
mapping.local_port = port->local_port;
mapping.local_host = port->local_addr;
@ -660,7 +660,7 @@ int linphone_upnp_context_send_remove_port_binding(UpnpContext *lupnp, UpnpPortB
} else {
linphone_upnp_port_binding_set_device_id(port, upnp_igd_get_device_id(lupnp->upnp_igd_ctxt));
mapping.cookie = linphone_upnp_port_binding_retain(port);
lupnp->pending_bindings = ms_list_append(lupnp->pending_bindings, mapping.cookie);
lupnp->pending_bindings = bctbx_list_append(lupnp->pending_bindings, mapping.cookie);
mapping.remote_port = port->external_port;
mapping.remote_host = "";
@ -861,9 +861,9 @@ static const char *linphone_core_upnp_get_charptr_null(const char *str) {
}
void linphone_upnp_update(UpnpContext *lupnp) {
MSList *global_list = NULL;
MSList *list = NULL;
MSList *item;
bctbx_list_t *global_list = NULL;
bctbx_list_t *list = NULL;
bctbx_list_t *item;
LinphoneCall *call;
UpnpPortBinding *port_mapping, *port_mapping2;
@ -874,13 +874,13 @@ void linphone_upnp_update(UpnpContext *lupnp) {
ms_message("uPnP IGD: Refresh mappings");
if(lupnp->sip_udp != NULL) {
global_list = ms_list_append(global_list, lupnp->sip_udp);
global_list = bctbx_list_append(global_list, lupnp->sip_udp);
}
if(lupnp->sip_tcp != NULL) {
global_list = ms_list_append(global_list, lupnp->sip_tcp);
global_list = bctbx_list_append(global_list, lupnp->sip_tcp);
}
if(lupnp->sip_tls != NULL) {
global_list = ms_list_append(global_list, lupnp->sip_tls);
global_list = bctbx_list_append(global_list, lupnp->sip_tls);
}
list = lupnp->lc->calls;
@ -888,16 +888,16 @@ void linphone_upnp_update(UpnpContext *lupnp) {
call = (LinphoneCall *)list->data;
if(call->upnp_session != NULL) {
if(call->upnp_session->audio->rtp != NULL) {
global_list = ms_list_append(global_list, call->upnp_session->audio->rtp);
global_list = bctbx_list_append(global_list, call->upnp_session->audio->rtp);
}
if(call->upnp_session->audio->rtcp != NULL) {
global_list = ms_list_append(global_list, call->upnp_session->audio->rtcp);
global_list = bctbx_list_append(global_list, call->upnp_session->audio->rtcp);
}
if(call->upnp_session->video->rtp != NULL) {
global_list = ms_list_append(global_list, call->upnp_session->video->rtp);
global_list = bctbx_list_append(global_list, call->upnp_session->video->rtp);
}
if(call->upnp_session->video->rtcp != NULL) {
global_list = ms_list_append(global_list, call->upnp_session->video->rtcp);
global_list = bctbx_list_append(global_list, call->upnp_session->video->rtcp);
}
}
list = list->next;
@ -914,8 +914,8 @@ void linphone_upnp_update(UpnpContext *lupnp) {
port_mapping2->state = LinphoneUpnpStateOk;
}
}
ms_list_for_each(list, (void (*)(void*))linphone_upnp_port_binding_release);
list = ms_list_free(list);
bctbx_list_for_each(list, (void (*)(void*))linphone_upnp_port_binding_release);
list = bctbx_list_free(list);
// (Re)Add removed port bindings
@ -926,7 +926,7 @@ void linphone_upnp_update(UpnpContext *lupnp) {
linphone_upnp_context_send_add_port_binding(lupnp, port_mapping, TRUE);
list = list->next;
}
global_list = ms_list_free(global_list);
global_list = bctbx_list_free(global_list);
}
void linphone_upnp_update_port_binding(UpnpContext *lupnp, UpnpPortBinding **port_mapping, upnp_igd_ip_protocol protocol, int port, int retry_delay) {
@ -973,7 +973,7 @@ void linphone_upnp_update_port_binding(UpnpContext *lupnp, UpnpPortBinding **por
void linphone_upnp_update_config(UpnpContext* lupnp) {
char key[64];
const MSList *item;
const bctbx_list_t *item;
UpnpPortBinding *port_mapping;
/* Add configs */
@ -987,8 +987,8 @@ void linphone_upnp_update_config(UpnpContext* lupnp) {
lp_config_set_string(lupnp->lc->config, UPNP_SECTION_NAME, key, "uPnP");
linphone_upnp_port_binding_log(ORTP_DEBUG, "Configuration: Added port binding", port_mapping);
}
ms_list_for_each(lupnp->adding_configs,(void (*)(void*))linphone_upnp_port_binding_release);
lupnp->adding_configs = ms_list_free(lupnp->adding_configs);
bctbx_list_for_each(lupnp->adding_configs,(void (*)(void*))linphone_upnp_port_binding_release);
lupnp->adding_configs = bctbx_list_free(lupnp->adding_configs);
/* Remove configs */
for(item = lupnp->removing_configs;item!=NULL;item=item->next) {
@ -1001,13 +1001,13 @@ void linphone_upnp_update_config(UpnpContext* lupnp) {
lp_config_set_string(lupnp->lc->config, UPNP_SECTION_NAME, key, NULL);
linphone_upnp_port_binding_log(ORTP_DEBUG, "Configuration: Removed port binding", port_mapping);
}
ms_list_for_each(lupnp->removing_configs,(void (*)(void*))linphone_upnp_port_binding_release);
lupnp->removing_configs = ms_list_free(lupnp->removing_configs);
bctbx_list_for_each(lupnp->removing_configs,(void (*)(void*))linphone_upnp_port_binding_release);
lupnp->removing_configs = bctbx_list_free(lupnp->removing_configs);
}
void linphone_upnp_update_proxy(UpnpContext* lupnp, bool_t force) {
LinphoneUpnpState ready_state;
const MSList *item;
const bctbx_list_t *item;
time_t now = (force)? (lupnp->last_ready_check + UPNP_CORE_READY_CHECK) : time(NULL);
/* Refresh registers if we are ready */
@ -1115,7 +1115,7 @@ UpnpPortBinding *linphone_upnp_port_binding_new_with_parameters(upnp_igd_ip_prot
return port_binding;
}
UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(MSList *list, upnp_igd_ip_protocol protocol, int local_port, int external_port) {
UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(bctbx_list_t *list, upnp_igd_ip_protocol protocol, int local_port, int external_port) {
UpnpPortBinding *tmp_binding;
UpnpPortBinding *end_binding;
@ -1182,7 +1182,7 @@ bool_t linphone_upnp_port_binding_equal(const UpnpPortBinding *port1, const Upnp
(port1->external_port == -1 || port2->external_port == -1 || port1->external_port == port2->external_port);
}
UpnpPortBinding *linphone_upnp_port_binding_equivalent_in_list(MSList *list, const UpnpPortBinding *port) {
UpnpPortBinding *linphone_upnp_port_binding_equivalent_in_list(bctbx_list_t *list, const UpnpPortBinding *port) {
UpnpPortBinding *port_mapping;
while(list != NULL) {
port_mapping = (UpnpPortBinding *)list->data;
@ -1293,7 +1293,7 @@ LinphoneUpnpState linphone_upnp_session_get_state(UpnpSession *session) {
struct linphone_upnp_config_list_port_bindings_struct {
struct _LpConfig *lpc;
MSList *retList;
bctbx_list_t *retList;
const char *device_id;
};
@ -1327,7 +1327,7 @@ static void linphone_upnp_config_list_port_bindings_cb(const char *entry, struct
port->protocol = protocol;
port->external_port = external_port;
port->local_port = local_port;
cookie->retList = ms_list_append(cookie->retList, port);
cookie->retList = bctbx_list_append(cookie->retList, port);
}
} else {
valid = FALSE;
@ -1337,7 +1337,7 @@ static void linphone_upnp_config_list_port_bindings_cb(const char *entry, struct
}
}
MSList *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const char *device_id) {
bctbx_list_t *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const char *device_id) {
char *formated_device_id = linphone_upnp_format_device_id(device_id);
struct linphone_upnp_config_list_port_bindings_struct cookie = {lpc, NULL, formated_device_id};
lp_config_for_each_entry(lpc, UPNP_SECTION_NAME, (void(*)(const char *, void*))linphone_upnp_config_list_port_bindings_cb, &cookie);
@ -1346,7 +1346,7 @@ MSList *linphone_upnp_config_list_port_bindings(struct _LpConfig *lpc, const cha
}
void linphone_upnp_config_add_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port) {
MSList *list;
bctbx_list_t *list;
UpnpPortBinding *list_port;
if(port->device_id == NULL) {
@ -1358,11 +1358,11 @@ void linphone_upnp_config_add_port_binding(UpnpContext *lupnp, const UpnpPortBin
while(list != NULL) {
list_port = (UpnpPortBinding *)list->data;
if(linphone_upnp_port_binding_equal(list_port, port) == TRUE) {
lupnp->removing_configs = ms_list_remove(lupnp->removing_configs, list_port);
lupnp->removing_configs = bctbx_list_remove(lupnp->removing_configs, list_port);
linphone_upnp_port_binding_release(list_port);
return;
}
list = ms_list_next(list);
list = bctbx_list_next(list);
}
list = lupnp->adding_configs;
@ -1371,15 +1371,15 @@ void linphone_upnp_config_add_port_binding(UpnpContext *lupnp, const UpnpPortBin
if(linphone_upnp_port_binding_equal(list_port, port) == TRUE) {
return;
}
list = ms_list_next(list);
list = bctbx_list_next(list);
}
list_port = linphone_upnp_port_binding_copy(port);
lupnp->adding_configs = ms_list_append(lupnp->adding_configs, list_port);
lupnp->adding_configs = bctbx_list_append(lupnp->adding_configs, list_port);
}
void linphone_upnp_config_remove_port_binding(UpnpContext *lupnp, const UpnpPortBinding *port) {
MSList *list;
bctbx_list_t *list;
UpnpPortBinding *list_port;
if(port->device_id == NULL) {
@ -1391,11 +1391,11 @@ void linphone_upnp_config_remove_port_binding(UpnpContext *lupnp, const UpnpPort
while(list != NULL) {
list_port = (UpnpPortBinding *)list->data;
if(linphone_upnp_port_binding_equal(list_port, port) == TRUE) {
lupnp->adding_configs = ms_list_remove(lupnp->adding_configs, list_port);
lupnp->adding_configs = bctbx_list_remove(lupnp->adding_configs, list_port);
linphone_upnp_port_binding_release(list_port);
return;
}
list = ms_list_next(list);
list = bctbx_list_next(list);
}
list = lupnp->removing_configs;
@ -1404,9 +1404,9 @@ void linphone_upnp_config_remove_port_binding(UpnpContext *lupnp, const UpnpPort
if(linphone_upnp_port_binding_equal(list_port, port) == TRUE) {
return;
}
list = ms_list_next(list);
list = bctbx_list_next(list);
}
list_port = linphone_upnp_port_binding_copy(port);
lupnp->removing_configs = ms_list_append(lupnp->removing_configs, list_port);
lupnp->removing_configs = bctbx_list_append(lupnp->removing_configs, list_port);
}

View file

@ -40,6 +40,12 @@ LinphoneVcard* linphone_vcard_new(void) {
return vCard;
}
static LinphoneVcard* linphone_vcard_new_from_belcard(shared_ptr<belcard::BelCard> belcard) {
LinphoneVcard* vCard = (LinphoneVcard*) ms_new0(LinphoneVcard, 1);
vCard->belCard = belcard;
return vCard;
}
void linphone_vcard_free(LinphoneVcard *vCard) {
if (!vCard) return;
@ -47,34 +53,32 @@ void linphone_vcard_free(LinphoneVcard *vCard) {
ms_free(vCard);
}
MSList* linphone_vcard_list_from_vcard4_file(const char *filename) {
MSList *result = NULL;
if (filename && ortp_file_exist(filename) == 0) {
bctbx_list_t* linphone_vcard_list_from_vcard4_file(const char *filename) {
bctbx_list_t *result = NULL;
if (filename) {
belcard::BelCardParser parser = belcard::BelCardParser::getInstance();
shared_ptr<belcard::BelCardList> belCards = parser.parseFile(filename);
if (belCards) {
for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) {
shared_ptr<belcard::BelCard> belcard = (*it);
LinphoneVcard *vCard = linphone_vcard_new();
vCard->belCard = belcard;
result = ms_list_append(result, vCard);
shared_ptr<belcard::BelCard> belCard = (*it);
LinphoneVcard *vCard = linphone_vcard_new_from_belcard(belCard);
result = bctbx_list_append(result, vCard);
}
}
}
return result;
}
MSList* linphone_vcard_list_from_vcard4_buffer(const char *buffer) {
MSList *result = NULL;
bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(const char *buffer) {
bctbx_list_t *result = NULL;
if (buffer) {
belcard::BelCardParser parser = belcard::BelCardParser::getInstance();
shared_ptr<belcard::BelCardList> belCards = parser.parse(buffer);
if (belCards) {
for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) {
shared_ptr<belcard::BelCard> belCard = (*it);
LinphoneVcard *vCard = linphone_vcard_new();
vCard->belCard = belCard;
result = ms_list_append(result, vCard);
LinphoneVcard *vCard = linphone_vcard_new_from_belcard(belCard);
result = bctbx_list_append(result, vCard);
}
}
}
@ -87,8 +91,7 @@ LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(const char *buffer) {
belcard::BelCardParser parser = belcard::BelCardParser::getInstance();
shared_ptr<belcard::BelCard> belCard = parser.parseOne(buffer);
if (belCard) {
vCard = linphone_vcard_new();
vCard->belCard = belCard;
vCard = linphone_vcard_new_from_belcard(belCard);
} else {
ms_error("Couldn't parse buffer %s", buffer);
}
@ -150,14 +153,14 @@ void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_
}
}
MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard) {
MSList *result = NULL;
bctbx_list_t* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard) {
bctbx_list_t *result = NULL;
if (!vCard) return NULL;
for (auto it = vCard->belCard->getImpp().begin(); it != vCard->belCard->getImpp().end(); ++it) {
const char *value = (*it)->getValue().c_str();
if (strncmp(value, "sip:", 4) == 0) {
result = ms_list_append(result, (char *)value);
result = bctbx_list_append(result, (char *)value);
}
}
return result;
@ -183,13 +186,13 @@ void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone)
}
}
MSList* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard) {
MSList *result = NULL;
bctbx_list_t* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard) {
bctbx_list_t *result = NULL;
if (!vCard) return NULL;
for (auto it = vCard->belCard->getPhoneNumbers().begin(); it != vCard->belCard->getPhoneNumbers().end(); ++it) {
const char *value = (*it)->getValue().c_str();
result = ms_list_append(result, (char *)value);
result = bctbx_list_append(result, (char *)value);
}
return result;
}

View file

@ -57,14 +57,14 @@ LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard);
* @param[in] file the path to the file to parse
* @return \mslist{LinphoneVcard}
*/
LINPHONE_PUBLIC MSList* linphone_vcard_list_from_vcard4_file(const char *file);
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_file(const char *file);
/**
* Uses belcard to parse the content of a buffer and returns all the vcards it contains as LinphoneVcards, or NULL if it contains none.
* @param[in] buffer the buffer to parse
* @return \mslist{LinphoneVcard}
*/
LINPHONE_PUBLIC MSList* linphone_vcard_list_from_vcard4_buffer(const char *buffer);
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(const char *buffer);
/**
* Uses belcard to parse the content of a buffer and returns one vCard if possible, or NULL otherwise.
@ -120,7 +120,7 @@ void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_
* @param[in] vCard the LinphoneVcard
* @return \mslist{const char *}
*/
LINPHONE_PUBLIC MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard);
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard);
/**
* Adds a phone number in the vCard, using the TEL property
@ -141,14 +141,14 @@ void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone)
* @param[in] vCard the LinphoneVcard
* @return \mslist{const char *}
*/
LINPHONE_PUBLIC MSList* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard);
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard);
/**
* Returns the list of SIP addresses (as string) in the vCard (all the IMPP attributes that has an URI value starting by "sip:") or NULL
* @param[in] vCard the LinphoneVcard
* @return \mslist{const char *}
*/
LINPHONE_PUBLIC MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard);
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard);
/**
* Fills the Organization field of the vCard

View file

@ -42,13 +42,13 @@ LinphoneCoreVTable *linphone_core_get_current_vtable(LinphoneCore *lc) {
}
static void cleanup_dead_vtable_refs(LinphoneCore *lc){
MSList *it,*next_it;
bctbx_list_t *it,*next_it;
for(it=lc->vtable_refs; it!=NULL; ){
VTableReference *ref=(VTableReference*)it->data;
next_it=it->next;
if (ref->valid==0){
ref->valid=0;
lc->vtable_refs=ms_list_remove_link(lc->vtable_refs, it);
lc->vtable_refs=bctbx_list_remove_link(lc->vtable_refs, it);
ms_free(ref);
}
it=next_it;
@ -56,7 +56,7 @@ static void cleanup_dead_vtable_refs(LinphoneCore *lc){
}
#define NOTIFY_IF_EXIST(function_name, ...) \
MSList* iterator; \
bctbx_list_t* iterator; \
VTableReference *ref; \
bool_t has_cb = FALSE; \
for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next)\
@ -67,7 +67,7 @@ static void cleanup_dead_vtable_refs(LinphoneCore *lc){
if (has_cb) ms_message("Linphone core [%p] notifying [%s]",lc,#function_name)
#define NOTIFY_IF_EXIST_INTERNAL(function_name, internal_val, ...) \
MSList* iterator; \
bctbx_list_t* iterator; \
VTableReference *ref; \
bool_t has_cb = FALSE; \
for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next)\
@ -99,7 +99,11 @@ void linphone_core_notify_registration_state_changed(LinphoneCore *lc, LinphoneP
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
void linphone_core_notify_show_interface(LinphoneCore *lc){
NOTIFY_IF_EXIST(show, lc);
cleanup_dead_vtable_refs(lc);
@ -149,7 +153,11 @@ void linphone_core_notify_call_log_updated(LinphoneCore *lc, LinphoneCallLog *ne
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
void linphone_core_notify_text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message){
NOTIFY_IF_EXIST(text_received, lc,room,from,message);
@ -166,7 +174,11 @@ void linphone_core_notify_message_received(LinphoneCore *lc, LinphoneChatRoom *r
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#else
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
void linphone_core_notify_file_transfer_recv(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size) {
NOTIFY_IF_EXIST(file_transfer_recv, lc,message,content,buff,size);
cleanup_dead_vtable_refs(lc);
@ -195,7 +207,7 @@ void linphone_core_notify_dtmf_received(LinphoneCore* lc, LinphoneCall *call, in
}
bool_t linphone_core_dtmf_received_has_listener(const LinphoneCore* lc) {
MSList* iterator;
bctbx_list_t* iterator;
for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next){
VTableReference *ref=(VTableReference*)iterator->data;
if (ref->valid && ref->vtable->dtmf_received)
@ -290,7 +302,7 @@ void v_table_reference_destroy(VTableReference *ref){
void _linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable, bool_t autorelease, bool_t internal) {
ms_message("Vtable [%p] registered on core [%p]",vtable, lc);
lc->vtable_refs=ms_list_append(lc->vtable_refs,v_table_reference_new(vtable, autorelease, internal));
lc->vtable_refs=bctbx_list_append(lc->vtable_refs,v_table_reference_new(vtable, autorelease, internal));
}
void linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable){
@ -298,7 +310,7 @@ void linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable){
}
void linphone_core_remove_listener(LinphoneCore *lc, const LinphoneCoreVTable *vtable) {
MSList *it;
bctbx_list_t *it;
ms_message("Vtable [%p] unregistered on core [%p]",lc,vtable);
for(it=lc->vtable_refs; it!=NULL; it=it->next){
VTableReference *ref=(VTableReference*)it->data;

129
daemon/CMakeLists.txt Normal file
View file

@ -0,0 +1,129 @@
############################################################################
# CMakeLists.txt
# Copyright (C) 2016 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
set(DAEMON_SOURCE_FILES
commands/adaptive-jitter-compensation.cc
commands/adaptive-jitter-compensation.h
commands/answer.cc
commands/answer.h
commands/audio-codec-get.cc
commands/audio-codec-get.h
commands/audio-codec-move.cc
commands/audio-codec-move.h
commands/audio-codec-set.cc
commands/audio-codec-set.h
commands/audio-codec-toggle.cc
commands/audio-codec-toggle.h
commands/audio-stream-start.cc
commands/audio-stream-start.h
commands/audio-stream-stats.cc
commands/audio-stream-stats.h
commands/audio-stream-stop.cc
commands/audio-stream-stop.h
commands/auth-infos-clear.cc
commands/auth-infos-clear.h
commands/call.cc
commands/call.h
commands/call-mute.cc
commands/call-mute.h
commands/call-pause.cc
commands/call-pause.h
commands/call-resume.cc
commands/call-resume.h
commands/call-stats.cc
commands/call-stats.h
commands/call-status.cc
commands/call-status.h
commands/call-transfer.cc
commands/call-transfer.h
commands/cn.cc
commands/cn.h
commands/conference.cc
commands/conference.h
commands/config.cc
commands/configcommand.h
commands/contact.cc
commands/contact.h
commands/dtmf.cc
commands/dtmf.h
commands/firewall-policy.cc
commands/firewall-policy.h
commands/help.cc
commands/help.h
commands/ipv6.cc
commands/ipv6.h
commands/jitterbuffer.cc
commands/jitterbuffer.h
commands/media-encryption.cc
commands/media-encryption.h
commands/msfilter-add-fmtp.cc
commands/msfilter-add-fmtp.h
commands/netsim.cc
commands/netsim.h
commands/play-wav.cc
commands/play-wav.h
commands/pop-event.cc
commands/pop-event.h
commands/port.cc
commands/port.h
commands/ptime.cc
commands/ptime.h
commands/quit.cc
commands/quit.h
commands/register.cc
commands/register.h
commands/register-status.cc
commands/register-status.h
commands/terminate.cc
commands/terminate.h
commands/unregister.cc
commands/unregister.h
commands/version.cc
commands/version.h
commands/video.cc
commands/video.h
daemon.cc
daemon.h
)
set(DAEMON_PIPETEST_SOURCE_FILES
daemon-pipetest.c
)
apply_compile_flags(DAEMON_SOURCE_FILES "CPP" "CXX")
apply_compile_flags(DAEMON_PIPETEST_SOURCE_FILES "CPP" "C")
add_executable(linphone-daemon ${DAEMON_SOURCE_FILES})
target_include_directories(linphone-daemon PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(linphone-daemon linphone ${MEDIASTREAMER2_LIBRARIES})
add_executable(linphone-daemon-pipetest ${DAEMON_PIPETEST_SOURCE_FILES})
target_link_libraries(linphone-daemon-pipetest linphone ${ORTP_LIBRARIES})
set(INSTALL_TARGETS linphone-daemon linphone-daemon-pipetest)
install(TARGETS ${INSTALL_TARGETS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)

View file

@ -1,3 +1,22 @@
/*
adaptive-jitter-compensation.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "adaptive-jitter-compensation.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
adaptive-jitter-compensation.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_ADAPTIVE_BUFFER_COMPENSATION_H_
#define COMMAND_ADAPTIVE_BUFFER_COMPENSATION_H_

View file

@ -1,3 +1,22 @@
/*
answer.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "answer.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
answer.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_ANSWER_H_
#define COMMAND_ANSWER_H_

View file

@ -1,3 +1,22 @@
/*
audio-codec-get.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "audio-codec-get.h"
using namespace std;
@ -54,7 +73,7 @@ void AudioCodecGetCommand::exec(Daemon *app, const char *args) {
}
int index = 0;
for (const MSList *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = ms_list_next(node)) {
for (const bctbx_list_t *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast<PayloadType*>(node->data);
if (list) {
ost << PayloadTypeResponse(app->getCore(), payload, index).getBody() << "\n";

View file

@ -1,3 +1,22 @@
/*
audio-codec-get.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_CODEC_GET_H_
#define COMMAND_AUDIO_CODEC_GET_H_

View file

@ -1,3 +1,22 @@
/*
audio-codec-move.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "audio-codec-move.h"
using namespace std;
@ -65,21 +84,21 @@ void AudioCodecMoveCommand::exec(Daemon *app, const char *args) {
}
int i = 0;
MSList *mslist = NULL;
for (const MSList *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = ms_list_next(node)) {
bctbx_list_t *mslist = NULL;
for (const bctbx_list_t *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast<PayloadType*>(node->data);
if (i == index) {
mslist = ms_list_append(mslist, selected_payload);
mslist = bctbx_list_append(mslist, selected_payload);
++i;
}
if (selected_payload != payload) {
mslist = ms_list_append(mslist, payload);
mslist = bctbx_list_append(mslist, payload);
++i;
}
}
if (i <= index) {
index = i;
mslist = ms_list_append(mslist, selected_payload);
mslist = bctbx_list_append(mslist, selected_payload);
}
linphone_core_set_audio_codecs(app->getCore(), mslist);

View file

@ -1,3 +1,22 @@
/*
audio-codec-move.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_CODEC_MOVE_H_
#define COMMAND_AUDIO_CODEC_MOVE_H_

View file

@ -1,3 +1,22 @@
/*
audio-codec-set.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "audio-codec-set.h"
#include "private.h"
@ -49,7 +68,7 @@ AudioCodecSetCommand::AudioCodecSetCommand() :
static PayloadType *findPayload(LinphoneCore *lc, int payload_type, int *index){
if (index) *index=0;
for (const MSList *node = linphone_core_get_audio_codecs(lc); node != NULL; node = ms_list_next(node)) {
for (const bctbx_list_t *node = linphone_core_get_audio_codecs(lc); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast<PayloadType*>(node->data);
if (index) (*index)++;
if (payload_type == linphone_core_get_payload_type_number(lc, payload)) {

View file

@ -1,3 +1,22 @@
/*
audio-codec-set.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_CODEC_SET_H_
#define COMMAND_AUDIO_CODEC_SET_H_

View file

@ -1,3 +1,22 @@
/*
audio-codec-toggle.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "audio-codec-toggle.h"
#include "audio-codec-get.h"
@ -24,7 +43,7 @@ void AudioCodecToggleCommand::exec(Daemon *app, const char *args) {
if (!parser.all()) pt = parser.getPayloadType();
int index = 0;
for (const MSList *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = ms_list_next(node)) {
for (const bctbx_list_t *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast<PayloadType*>(node->data);
if (parser.all()) {
linphone_core_enable_payload_type(app->getCore(), payload, mEnable);

View file

@ -1,3 +1,22 @@
/*
audio-codec-toggle.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_CODEC_TOGGLE_H_
#define COMMAND_AUDIO_CODEC_TOGGLE_H_

View file

@ -1,3 +1,22 @@
/*
audio-stream-start.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "audio-stream-start.h"
#include "private.h"

View file

@ -1,3 +1,22 @@
/*
audio-stream-start.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_STREAM_START_H_
#define COMMAND_AUDIO_STREAM_START_H_

View file

@ -1,3 +1,22 @@
/*
audio-stream-stats.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "audio-stream-stats.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
audio-stream-stats.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_STREAM_STATS_H_
#define COMMAND_AUDIO_STREAM_STATS_H_

View file

@ -1,3 +1,22 @@
/*
audio-stream-stop.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "audio-stream-stop.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
audio-stream-stop.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_STREAM_STOP_H_
#define COMMAND_AUDIO_STREAM_STOP_H_

View file

@ -1,3 +1,22 @@
/*
auth-infos-clear.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "auth-infos-clear.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
auth-infos-clear.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUTH_INFOS_CLEAR_H_
#define COMMAND_AUTH_INFOS_CLEAR_H_

View file

@ -1,3 +1,22 @@
/*
call-mute.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "call-mute.h"
CallMute::CallMute() :

View file

@ -1,3 +1,22 @@
/*
call-mute.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CALLMUTE_H
#define CALLMUTE_H

View file

@ -1,3 +1,22 @@
/*
call-pause.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "call-pause.h"
CallPause::CallPause() :

View file

@ -1,3 +1,22 @@
/*
call-pause.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CALLPAUSE_H
#define CALLPAUSE_H

View file

@ -1,3 +1,22 @@
/*
call-resume.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "call-resume.h"
CallResume::CallResume():

View file

@ -1,3 +1,22 @@
/*
call-resume.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CALLRESUME_H
#define CALLRESUME_H

View file

@ -1,3 +1,22 @@
/*
call-stats.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "call-stats.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
call-stats.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_CALL_STATS_H_
#define COMMAND_CALL_STATS_H_

View file

@ -1,3 +1,22 @@
/*
call-status.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "call-status.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
call-status.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_CALL_STATUS_H_
#define COMMAND_CALL_STATUS_H_

View file

@ -1,3 +1,22 @@
/*
call-transfer.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "call-transfer.h"
CallTransfer::CallTransfer() :

View file

@ -1,3 +1,22 @@
/*
call-transfer.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CALLTRANSFER_H
#define CALLTRANSFER_H

View file

@ -1,3 +1,22 @@
/*
call.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "call.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
call.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_CALL_H_
#define COMMAND_CALL_H_

View file

@ -1,3 +1,22 @@
/*
cn.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "cn.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
cn.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_CN_H_
#define COMMAND_CN_H_

View file

@ -1,3 +1,22 @@
/*
conference.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "conference.h"
Conference::Conference() :

View file

@ -1,3 +1,22 @@
/*
conference.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMANDS_CONFERENCE_H
#define COMMANDS_CONFERENCE_H

View file

@ -1,3 +1,22 @@
/*
config.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "configcommand.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
configcommand.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_CONFIG_H_
#define COMMAND_CONFIG_H_

View file

@ -1,3 +1,22 @@
/*
contact.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "contact.h"
using namespace std;

View file

@ -1,3 +1,22 @@
/*
contact.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_CONTACT_H_
#define COMMAND_CONTACT_H_

View file

@ -1,3 +1,22 @@
/*
dtmf.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "dtmf.h"
using namespace std;
@ -20,10 +39,13 @@ void DtmfCommand::exec(Daemon *app, const char *args) {
if (ist.fail()) {
app->sendResponse(Response("Missing digit parameter.", Response::Error));
} else {
digit = digit_str.at(0);
digit = digit_str.at(0);
if (isdigit(digit) || (digit == 'A') || (digit == 'B') || (digit == 'C') || (digit == 'D') || (digit == '*') || (digit == '#')) {
LinphoneCall *call = linphone_core_get_current_call(app->getCore());
linphone_core_play_dtmf(app->getCore(), digit, 100);
linphone_core_send_dtmf(app->getCore(), digit);
if (call == NULL) {
linphone_call_send_dtmf(call, digit);
}
app->sendResponse(Response());
} else {
app->sendResponse(Response("Incorrect digit parameter.", Response::Error));

View file

@ -1,3 +1,22 @@
/*
dtmf.h
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library 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 Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_DTMF_H_
#define COMMAND_DTMF_H_

Some files were not shown because too many files have changed in this diff Show more