diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec.sln b/branches/2.0/doubango/Samples/C#/IPSec/ipsec.sln new file mode 100644 index 00000000..24bb7e78 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec.sln @@ -0,0 +1,106 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ipsec_app", "ipsec_app\ipsec_app.csproj", "{9765AEFD-D72A-4FB5-B840-D1021B41DD41}" + ProjectSection(ProjectDependencies) = postProject + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + {F9B529B2-2AC2-4318-AD31-E7A9B195E204} = {F9B529B2-2AC2-4318-AD31-E7A9B195E204} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ipsec_lib", "ipsec_lib\ipsec_lib.vcproj", "{F9B529B2-2AC2-4318-AD31-E7A9B195E204}" + ProjectSection(ProjectDependencies) = postProject + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySAK", "..\..\..\tinySAK\tinySAK.vcproj", "{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "csharp", "csharp", "{0325B42D-C2ED-4313-ABB0-B317A2ADBAB9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cpp", "cpp", "{AB8B1D7B-3776-463A-92F0-6D7236B75B99}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + Static_Debug|Any CPU = Static_Debug|Any CPU + Static_Debug|Mixed Platforms = Static_Debug|Mixed Platforms + Static_Debug|Win32 = Static_Debug|Win32 + Static_Release|Any CPU = Static_Release|Any CPU + Static_Release|Mixed Platforms = Static_Release|Mixed Platforms + Static_Release|Win32 = Static_Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Debug|Win32.ActiveCfg = Debug|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Release|Any CPU.Build.0 = Release|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Release|Win32.ActiveCfg = Release|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Static_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Static_Debug|Any CPU.Build.0 = Debug|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Static_Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Static_Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Static_Debug|Win32.ActiveCfg = Debug|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Static_Release|Any CPU.ActiveCfg = Release|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Static_Release|Any CPU.Build.0 = Release|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Static_Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Static_Release|Mixed Platforms.Build.0 = Release|Any CPU + {9765AEFD-D72A-4FB5-B840-D1021B41DD41}.Static_Release|Win32.ActiveCfg = Release|Any CPU + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Debug|Win32.ActiveCfg = Debug|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Debug|Win32.Build.0 = Debug|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Release|Any CPU.ActiveCfg = Release|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Release|Mixed Platforms.Build.0 = Release|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Release|Win32.ActiveCfg = Release|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Release|Win32.Build.0 = Release|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Static_Debug|Any CPU.ActiveCfg = Debug|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Static_Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Static_Debug|Mixed Platforms.Build.0 = Debug|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Static_Debug|Win32.Build.0 = Debug|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Static_Release|Any CPU.ActiveCfg = Release|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Static_Release|Mixed Platforms.ActiveCfg = Release|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Static_Release|Mixed Platforms.Build.0 = Release|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Static_Release|Win32.ActiveCfg = Release|Win32 + {F9B529B2-2AC2-4318-AD31-E7A9B195E204}.Static_Release|Win32.Build.0 = Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Win32.ActiveCfg = Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Win32.Build.0 = Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Any CPU.ActiveCfg = Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Mixed Platforms.Build.0 = Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Win32.ActiveCfg = Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Win32.Build.0 = Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Debug|Any CPU.ActiveCfg = Static_Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Debug|Mixed Platforms.ActiveCfg = Static_Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Debug|Mixed Platforms.Build.0 = Static_Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Debug|Win32.ActiveCfg = Static_Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Debug|Win32.Build.0 = Static_Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Release|Any CPU.ActiveCfg = Static_Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Release|Mixed Platforms.ActiveCfg = Static_Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Release|Mixed Platforms.Build.0 = Static_Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Release|Win32.ActiveCfg = Static_Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Release|Win32.Build.0 = Static_Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {9765AEFD-D72A-4FB5-B840-D1021B41DD41} = {0325B42D-C2ED-4313-ABB0-B317A2ADBAB9} + {F9B529B2-2AC2-4318-AD31-E7A9B195E204} = {AB8B1D7B-3776-463A-92F0-6D7236B75B99} + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {AB8B1D7B-3776-463A-92F0-6D7236B75B99} + EndGlobalSection +EndGlobal diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_app/Program.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_app/Program.cs new file mode 100644 index 00000000..39503c50 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_app/Program.cs @@ -0,0 +1,84 @@ +/* Copyright (C) 2010-2014 Mamadou DIOP +* Copyright (C) 2011-2014 Doubango Telecom +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using org.doubango.ipsecWRAP; +using System.Diagnostics; +using err = org.doubango.ipsecWRAP.tipsec_error_t; +using System.Runtime.InteropServices; +namespace ipsec +{ + class Program + { + static tipsec_ipproto_t __ipproto = tipsec_ipproto_t.tipsec_ipproto_udp; + static bool __use_ipv6 = false; + static tipsec_mode_t __mode = tipsec_mode_t.tipsec_mode_trans; + static tipsec_ealg_t __ealg = tipsec_ealg_t.tipsec_ealg_des_ede3_cbc; + static tipsec_alg_t __alg = tipsec_alg_t.tipsec_alg_hmac_md5_96; + static tipsec_proto_t __proto = tipsec_proto_t.tipsec_proto_ah; + + static String __addr_local = "0.0.0.0"; + static String __addr_remote = "192.168.0.34"; + static ushort __port_local_out = 5062; // PORT_UC + static ushort __port_local_in = 5064; // PORT_US + static ushort __port_remote_out = 5066; // PORT_PC + static ushort __port_remote_in = 5068; // PORT_PS + static UInt32 __spi_remote_out = 3333; // SPI_PC + static UInt32 __spi_remote_in = 4444; // SPI_PS + static UInt64 __lifetime = 1800; /* always set it to the maximum value. (Not possible to update the value after REGISTER 200OK. ) */ + + static String __key_ik = "1234567890123456"; + static String __key_ck = "1234567890121234"; + + static void Main(string[] args) + { + /* Create the context */ + IPSecCtx ipsecCtx = new IPSecCtx(__ipproto, __use_ipv6, __mode, __ealg, __alg, __proto); + + /* Set local */ + Debug.Assert(ipsecCtx.setLocal(__addr_local, __addr_remote, __port_local_out, __port_local_in) == err.tipsec_error_success); + + /* Dump SPIs created by the OS after calling set_local() */ + Console.WriteLine("SPI-UC={0}, SPI-US={1}", ipsecCtx.getSpiUC(), ipsecCtx.getSpiUS()); + + /* Set remote */ + Debug.Assert(ipsecCtx.setRemote(__spi_remote_out, __spi_remote_in, __port_remote_out, __port_remote_in, __lifetime) == err.tipsec_error_success); + + /* Set Integrity (IK) and Confidentiality (CK) keys */ + IntPtr keyIK = Marshal.StringToHGlobalAnsi(__key_ik); + IntPtr keyCK = Marshal.StringToHGlobalAnsi(__key_ck); + Debug.Assert(ipsecCtx.setKeys(keyIK, keyCK) == err.tipsec_error_success); + Marshal.FreeHGlobal(keyIK); + Marshal.FreeHGlobal(keyCK); + + /* Start (Setup) the SAs */ + Debug.Assert(ipsecCtx.start() == err.tipsec_error_success); + + Console.WriteLine("!!! IPSec SAs started (Press any key to stop) !!!"); + + Console.ReadLine(); + + ipsecCtx.Dispose(); // Not required. GC will collect it when no refCount reach zero. + + Console.ReadLine(); + } + } +} diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_app/Properties/AssemblyInfo.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_app/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..675ed37a --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_app/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ipsec")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ipsec")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("28faf159-2a2b-47ff-9a32-a7acf9c6ec66")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_app/ipsec_app.csproj b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_app/ipsec_app.csproj new file mode 100644 index 00000000..7cad1e0f --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_app/ipsec_app.csproj @@ -0,0 +1,136 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {9765AEFD-D72A-4FB5-B840-D1021B41DD41} + Exe + Properties + ipsec_app + ipsec_app + v3.5 + 512 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + ..\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + IPSecCtx.cs + + + ipsec_lib.cs + + + ipsec_libPINVOKE.cs + + + tipsec_alg_t.cs + + + tipsec_ealg_t.cs + + + tipsec_error_t.cs + + + tipsec_ipproto_t.cs + + + tipsec_mode_t.cs + + + tipsec_proto_t.cs + + + tipsec_state_t.cs + + + + + + + False + .NET Framework Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + false + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + \ No newline at end of file diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/IPSecCtx.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/IPSecCtx.cs new file mode 100644 index 00000000..ccf94e2c --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/IPSecCtx.cs @@ -0,0 +1,94 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace org.doubango.ipsecWRAP { + +using System; +using System.Runtime.InteropServices; + +public class IPSecCtx : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal IPSecCtx(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(IPSecCtx obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~IPSecCtx() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + ipsec_libPINVOKE.delete_IPSecCtx(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + GC.SuppressFinalize(this); + } + } + + public IPSecCtx(tipsec_ipproto_t ipproto, bool use_ipv6, tipsec_mode_t mode, tipsec_ealg_t ealg, tipsec_alg_t alg, tipsec_proto_t protocol) : this(ipsec_libPINVOKE.new_IPSecCtx((int)ipproto, use_ipv6, (int)mode, (int)ealg, (int)alg, (int)protocol), true) { + } + + public tipsec_error_t start() { + tipsec_error_t ret = (tipsec_error_t)ipsec_libPINVOKE.IPSecCtx_start(swigCPtr); + return ret; + } + + public tipsec_error_t setLocal(string addr_local, string addr_remote, ushort port_uc, ushort port_us) { + tipsec_error_t ret = (tipsec_error_t)ipsec_libPINVOKE.IPSecCtx_setLocal(swigCPtr, addr_local, addr_remote, port_uc, port_us); + return ret; + } + + public tipsec_error_t setKeys(IntPtr ik, IntPtr ck) { + tipsec_error_t ret = (tipsec_error_t)ipsec_libPINVOKE.IPSecCtx_setKeys(swigCPtr, ik, ck); + return ret; + } + + public tipsec_error_t setRemote(uint spi_pc, uint spi_ps, ushort port_pc, ushort port_ps, ulong lifetime) { + tipsec_error_t ret = (tipsec_error_t)ipsec_libPINVOKE.IPSecCtx_setRemote(swigCPtr, spi_pc, spi_ps, port_pc, port_ps, lifetime); + return ret; + } + + public tipsec_error_t stop() { + tipsec_error_t ret = (tipsec_error_t)ipsec_libPINVOKE.IPSecCtx_stop(swigCPtr); + return ret; + } + + public uint getSpiUC() { + uint ret = ipsec_libPINVOKE.IPSecCtx_getSpiUC(swigCPtr); + return ret; + } + + public uint getSpiUS() { + uint ret = ipsec_libPINVOKE.IPSecCtx_getSpiUS(swigCPtr); + return ret; + } + + public uint getSpiPC() { + uint ret = ipsec_libPINVOKE.IPSecCtx_getSpiPC(swigCPtr); + return ret; + } + + public uint getSpiPS() { + uint ret = ipsec_libPINVOKE.IPSecCtx_getSpiPS(swigCPtr); + return ret; + } + +} + +} diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/IPSecCtx.cxx b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/IPSecCtx.cxx new file mode 100644 index 00000000..f7b79254 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/IPSecCtx.cxx @@ -0,0 +1,95 @@ +/* Copyright (C) 2010-2014 Mamadou DIOP +* Copyright (C) 2011-2014 Doubango Telecom +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +*/ +#include "IPSecCtx.h" +#include "tsk_debug.h" + +#include + +bool IPSecCtx::sInitialized = false; +extern "C" const tipsec_plugin_def_t *plugin_win_ipsec_vista_plugin_def_t; + +IPSecCtx::IPSecCtx(tipsec_ipproto_t ipproto, + bool use_ipv6, + tipsec_mode_t mode, + tipsec_ealg_t ealg, + tipsec_alg_t alg, + tipsec_proto_t protocol) +: m_pCtx(NULL) +{ + tipsec_ctx_t* pCtx = NULL; + if (!IPSecCtx::sInitialized) + { + assert (tipsec_plugin_register_static(plugin_win_ipsec_vista_plugin_def_t) == 0); + IPSecCtx::sInitialized = true; + } + assert (tipsec_ctx_create(ipproto, use_ipv6, mode, ealg, alg, protocol, &m_pCtx) == 0 && m_pCtx != NULL); +} + +IPSecCtx::~IPSecCtx() +{ + TSK_OBJECT_SAFE_FREE(m_pCtx); +} + +tipsec_error_t IPSecCtx::start() +{ + return tipsec_ctx_start(m_pCtx); +} + +tipsec_error_t IPSecCtx::setLocal(const char* addr_local, const char* addr_remote, tipsec_port_t port_uc, tipsec_port_t port_us) +{ + return tipsec_ctx_set_local(m_pCtx, addr_local, addr_remote, port_uc, port_us); +} + +tipsec_error_t IPSecCtx::setKeys(const tipsec_key_t* ik, const tipsec_key_t* ck) +{ + return tipsec_ctx_set_keys(m_pCtx, ik, ck); +} + +tipsec_error_t IPSecCtx::setRemote(tipsec_spi_t spi_pc, tipsec_spi_t spi_ps, tipsec_port_t port_pc, tipsec_port_t port_ps, tipsec_lifetime_t lifetime) +{ + return tipsec_ctx_set_remote(m_pCtx, spi_pc, spi_ps, port_pc, port_ps, lifetime); +} + +tipsec_error_t IPSecCtx::stop() +{ + return tipsec_ctx_stop(m_pCtx); +} + +tipsec_spi_t IPSecCtx::getSpiUC() +{ + return m_pCtx->spi_uc; +} + +tipsec_spi_t IPSecCtx::getSpiUS() +{ + return m_pCtx->spi_us; +} + +tipsec_spi_t IPSecCtx::getSpiPC() +{ + return m_pCtx->spi_pc; +} + +tipsec_spi_t IPSecCtx::getSpiPS() +{ + return m_pCtx->spi_ps; +} + + + diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/IPSecCtx.h b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/IPSecCtx.h new file mode 100644 index 00000000..0e7d0ef0 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/IPSecCtx.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2010-2014 Mamadou DIOP +* Copyright (C) 2011-2014 Doubango Telecom +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +*/ +#ifndef IPSEC_CTX_H +#define IPSEC_CTX_H + +#include "tipsec.h" + +class IPSecCtx +{ +public: + IPSecCtx(tipsec_ipproto_t ipproto, + bool use_ipv6, + tipsec_mode_t mode, + tipsec_ealg_t ealg, + tipsec_alg_t alg, + tipsec_proto_t protocol); + virtual ~IPSecCtx(); + tipsec_error_t start(); + tipsec_error_t setLocal(const char* addr_local, const char* addr_remote, tipsec_port_t port_uc, tipsec_port_t port_us); + tipsec_error_t setKeys(const tipsec_key_t* ik, const tipsec_key_t* ck); + tipsec_error_t setRemote(tipsec_spi_t spi_pc, tipsec_spi_t spi_ps, tipsec_port_t port_pc, tipsec_port_t port_ps, tipsec_lifetime_t lifetime); + tipsec_error_t stop(); + + tipsec_spi_t getSpiUC(); + tipsec_spi_t getSpiUS(); + tipsec_spi_t getSpiPC(); + tipsec_spi_t getSpiPS(); + +private: + static bool sInitialized; + tipsec_ctx_t* m_pCtx; +}; + +#endif /* IPSEC_CTX_H */ diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.cxx b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.cxx new file mode 100644 index 00000000..f60c5a7a --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.cxx @@ -0,0 +1,512 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#define SWIGCSHARP +#define SWIG_DIRECTORS + + +#ifdef __cplusplus +/* SwigValueWrapper is described in swig.swg */ +template class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); + SwigValueWrapper(const SwigValueWrapper& rhs); +public: + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +#include +#include +#include + + +/* Support for throwing C# exceptions from C/C++. There are two types: + * Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */ +typedef enum { + SWIG_CSharpApplicationException, + SWIG_CSharpArithmeticException, + SWIG_CSharpDivideByZeroException, + SWIG_CSharpIndexOutOfRangeException, + SWIG_CSharpInvalidCastException, + SWIG_CSharpInvalidOperationException, + SWIG_CSharpIOException, + SWIG_CSharpNullReferenceException, + SWIG_CSharpOutOfMemoryException, + SWIG_CSharpOverflowException, + SWIG_CSharpSystemException +} SWIG_CSharpExceptionCodes; + +typedef enum { + SWIG_CSharpArgumentException, + SWIG_CSharpArgumentNullException, + SWIG_CSharpArgumentOutOfRangeException +} SWIG_CSharpExceptionArgumentCodes; + +typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *); +typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *); + +typedef struct { + SWIG_CSharpExceptionCodes code; + SWIG_CSharpExceptionCallback_t callback; +} SWIG_CSharpException_t; + +typedef struct { + SWIG_CSharpExceptionArgumentCodes code; + SWIG_CSharpExceptionArgumentCallback_t callback; +} SWIG_CSharpExceptionArgument_t; + +static SWIG_CSharpException_t SWIG_csharp_exceptions[] = { + { SWIG_CSharpApplicationException, NULL }, + { SWIG_CSharpArithmeticException, NULL }, + { SWIG_CSharpDivideByZeroException, NULL }, + { SWIG_CSharpIndexOutOfRangeException, NULL }, + { SWIG_CSharpInvalidCastException, NULL }, + { SWIG_CSharpInvalidOperationException, NULL }, + { SWIG_CSharpIOException, NULL }, + { SWIG_CSharpNullReferenceException, NULL }, + { SWIG_CSharpOutOfMemoryException, NULL }, + { SWIG_CSharpOverflowException, NULL }, + { SWIG_CSharpSystemException, NULL } +}; + +static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = { + { SWIG_CSharpArgumentException, NULL }, + { SWIG_CSharpArgumentNullException, NULL }, + { SWIG_CSharpArgumentOutOfRangeException, NULL } +}; + +static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) { + SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback; + if ((size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) { + callback = SWIG_csharp_exceptions[code].callback; + } + callback(msg); +} + +static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) { + SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback; + if ((size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) { + callback = SWIG_csharp_exceptions_argument[code].callback; + } + callback(msg, param_name); +} + + +#ifdef __cplusplus +extern "C" +#endif +SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_ipsec_lib( + SWIG_CSharpExceptionCallback_t applicationCallback, + SWIG_CSharpExceptionCallback_t arithmeticCallback, + SWIG_CSharpExceptionCallback_t divideByZeroCallback, + SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback, + SWIG_CSharpExceptionCallback_t invalidCastCallback, + SWIG_CSharpExceptionCallback_t invalidOperationCallback, + SWIG_CSharpExceptionCallback_t ioCallback, + SWIG_CSharpExceptionCallback_t nullReferenceCallback, + SWIG_CSharpExceptionCallback_t outOfMemoryCallback, + SWIG_CSharpExceptionCallback_t overflowCallback, + SWIG_CSharpExceptionCallback_t systemCallback) { + SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback; + SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback; + SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback; + SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback; + SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback; + SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback; + SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback; + SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback; + SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback; + SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback; + SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback; +} + +#ifdef __cplusplus +extern "C" +#endif +SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_ipsec_lib( + SWIG_CSharpExceptionArgumentCallback_t argumentCallback, + SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback, + SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) { + SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback; + SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback; + SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback; +} + + +/* Callback for returning strings to C# without leaking memory */ +typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *); +static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL; + + +#ifdef __cplusplus +extern "C" +#endif +SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ipsec_lib(SWIG_CSharpStringHelperCallback callback) { + SWIG_csharp_string_callback = callback; +} + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else + +/* ----------------------------------------------------------------------------- + * director.swg + * + * This file contains support for director classes so that C# proxy + * methods can be called from C++. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus + +#if defined(DEBUG_DIRECTOR_OWNED) +#include +#endif +#include + +namespace Swig { + /* Director base class - not currently used in C# directors */ + class Director { + }; + + /* Base class for director exceptions */ + class DirectorException { + protected: + std::string swig_msg; + + public: + DirectorException(const char* msg) : swig_msg(msg) { + } + DirectorException(const std::string &msg) : swig_msg(msg) { + } + const std::string& what() const { + return swig_msg; + } + virtual ~DirectorException() { + } + }; + + /* Pure virtual method exception */ + class DirectorPureVirtualException : public Swig::DirectorException { + public: + DirectorPureVirtualException(const char* msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) { + } + }; +} + +#endif /* __cplusplus */ + + + +#include // Use the C99 official header + + +#include "IPSecCtx.h" + + + +/* --------------------------------------------------- + * C++ director class methods + * --------------------------------------------------- */ + +#include "ipsecWRAP.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_IPSecCtx(int jarg1, unsigned int jarg2, int jarg3, int jarg4, int jarg5, int jarg6) { + void * jresult ; + tipsec_ipproto_t arg1 ; + bool arg2 ; + tipsec_mode_t arg3 ; + tipsec_ealg_t arg4 ; + tipsec_alg_t arg5 ; + tipsec_proto_t arg6 ; + IPSecCtx *result = 0 ; + + arg1 = (tipsec_ipproto_t)jarg1; + arg2 = jarg2 ? true : false; + arg3 = (tipsec_mode_t)jarg3; + arg4 = (tipsec_ealg_t)jarg4; + arg5 = (tipsec_alg_t)jarg5; + arg6 = (tipsec_proto_t)jarg6; + result = (IPSecCtx *)new IPSecCtx(arg1,arg2,arg3,arg4,arg5,arg6); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_IPSecCtx(void * jarg1) { + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + + arg1 = (IPSecCtx *)jarg1; + delete arg1; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_start(void * jarg1) { + int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_error_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_error_t)(arg1)->start(); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setLocal(void * jarg1, char * jarg2, char * jarg3, unsigned short jarg4, unsigned short jarg5) { + int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + tipsec_port_t arg4 ; + tipsec_port_t arg5 ; + tipsec_error_t result; + + arg1 = (IPSecCtx *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (tipsec_port_t)jarg4; + arg5 = (tipsec_port_t)jarg5; + result = (tipsec_error_t)(arg1)->setLocal((char const *)arg2,(char const *)arg3,arg4,arg5); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setKeys(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + void *arg2 = (void *) 0 ; + tipsec_key_t *arg3 = (tipsec_key_t *) 0 ; + tipsec_error_t result; + + arg1 = (IPSecCtx *)jarg1; + arg2 = jarg2; + arg3 = jarg3; + result = (tipsec_error_t)(arg1)->setKeys((void const *)arg2,(tipsec_key_t const *)arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setRemote(void * jarg1, unsigned int jarg2, unsigned int jarg3, unsigned short jarg4, unsigned short jarg5, unsigned long long jarg6) { + int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_spi_t arg2 ; + tipsec_spi_t arg3 ; + tipsec_port_t arg4 ; + tipsec_port_t arg5 ; + tipsec_lifetime_t arg6 ; + tipsec_error_t result; + + arg1 = (IPSecCtx *)jarg1; + arg2 = (tipsec_spi_t)jarg2; + arg3 = (tipsec_spi_t)jarg3; + arg4 = (tipsec_port_t)jarg4; + arg5 = (tipsec_port_t)jarg5; + arg6 = (tipsec_lifetime_t)jarg6; + result = (tipsec_error_t)(arg1)->setRemote(arg2,arg3,arg4,arg5,arg6); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_stop(void * jarg1) { + int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_error_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_error_t)(arg1)->stop(); + jresult = result; + return jresult; +} + + +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUC(void * jarg1) { + unsigned int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_spi_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_spi_t)(arg1)->getSpiUC(); + jresult = result; + return jresult; +} + + +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUS(void * jarg1) { + unsigned int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_spi_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_spi_t)(arg1)->getSpiUS(); + jresult = result; + return jresult; +} + + +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPC(void * jarg1) { + unsigned int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_spi_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_spi_t)(arg1)->getSpiPC(); + jresult = result; + return jresult; +} + + +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPS(void * jarg1) { + unsigned int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_spi_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_spi_t)(arg1)->getSpiPS(); + jresult = result; + return jresult; +} + + +#ifdef __cplusplus +} +#endif + diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.h b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.h new file mode 100644 index 00000000..49aa0fee --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.h @@ -0,0 +1,15 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#ifndef SWIG_ipsec_lib_WRAP_H_ +#define SWIG_ipsec_lib_WRAP_H_ + + +#endif diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsec_lib.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsec_lib.cs new file mode 100644 index 00000000..702aea01 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsec_lib.cs @@ -0,0 +1,17 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace org.doubango.ipsecWRAP { + +using System; +using System.Runtime.InteropServices; + +public class ipsec_lib { +} + +} diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsec_lib.vcproj b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsec_lib.vcproj new file mode 100644 index 00000000..f89be7be --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsec_lib.vcproj @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsec_libPINVOKE.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsec_libPINVOKE.cs new file mode 100644 index 00000000..075d822a --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/ipsec_libPINVOKE.cs @@ -0,0 +1,226 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace org.doubango.ipsecWRAP { + +using System; +using System.Runtime.InteropServices; + +class ipsec_libPINVOKE { + + protected class SWIGExceptionHelper { + + public delegate void ExceptionDelegate(string message); + public delegate void ExceptionArgumentDelegate(string message, string paramName); + + static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException); + static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException); + static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException); + static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException); + static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException); + static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException); + static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException); + static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException); + static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException); + static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException); + static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException); + + static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException); + static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException); + static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException); + + [DllImport("ipsec_lib", EntryPoint="SWIGRegisterExceptionCallbacks_ipsec_lib")] + public static extern void SWIGRegisterExceptionCallbacks_ipsec_lib( + ExceptionDelegate applicationDelegate, + ExceptionDelegate arithmeticDelegate, + ExceptionDelegate divideByZeroDelegate, + ExceptionDelegate indexOutOfRangeDelegate, + ExceptionDelegate invalidCastDelegate, + ExceptionDelegate invalidOperationDelegate, + ExceptionDelegate ioDelegate, + ExceptionDelegate nullReferenceDelegate, + ExceptionDelegate outOfMemoryDelegate, + ExceptionDelegate overflowDelegate, + ExceptionDelegate systemExceptionDelegate); + + [DllImport("ipsec_lib", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_ipsec_lib")] + public static extern void SWIGRegisterExceptionCallbacksArgument_ipsec_lib( + ExceptionArgumentDelegate argumentDelegate, + ExceptionArgumentDelegate argumentNullDelegate, + ExceptionArgumentDelegate argumentOutOfRangeDelegate); + + static void SetPendingApplicationException(string message) { + SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingArithmeticException(string message) { + SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingDivideByZeroException(string message) { + SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingIndexOutOfRangeException(string message) { + SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingInvalidCastException(string message) { + SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingInvalidOperationException(string message) { + SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingIOException(string message) { + SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingNullReferenceException(string message) { + SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingOutOfMemoryException(string message) { + SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingOverflowException(string message) { + SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingSystemException(string message) { + SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve())); + } + + static void SetPendingArgumentException(string message, string paramName) { + SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve())); + } + static void SetPendingArgumentNullException(string message, string paramName) { + Exception e = SWIGPendingException.Retrieve(); + if (e != null) message = message + " Inner Exception: " + e.Message; + SWIGPendingException.Set(new System.ArgumentNullException(paramName, message)); + } + static void SetPendingArgumentOutOfRangeException(string message, string paramName) { + Exception e = SWIGPendingException.Retrieve(); + if (e != null) message = message + " Inner Exception: " + e.Message; + SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message)); + } + + static SWIGExceptionHelper() { + SWIGRegisterExceptionCallbacks_ipsec_lib( + applicationDelegate, + arithmeticDelegate, + divideByZeroDelegate, + indexOutOfRangeDelegate, + invalidCastDelegate, + invalidOperationDelegate, + ioDelegate, + nullReferenceDelegate, + outOfMemoryDelegate, + overflowDelegate, + systemDelegate); + + SWIGRegisterExceptionCallbacksArgument_ipsec_lib( + argumentDelegate, + argumentNullDelegate, + argumentOutOfRangeDelegate); + } + } + + protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper(); + + public class SWIGPendingException { + [ThreadStatic] + private static Exception pendingException = null; + private static int numExceptionsPending = 0; + + public static bool Pending { + get { + bool pending = false; + if (numExceptionsPending > 0) + if (pendingException != null) + pending = true; + return pending; + } + } + + public static void Set(Exception e) { + if (pendingException != null) + throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e); + pendingException = e; + lock(typeof(ipsec_libPINVOKE)) { + numExceptionsPending++; + } + } + + public static Exception Retrieve() { + Exception e = null; + if (numExceptionsPending > 0) { + if (pendingException != null) { + e = pendingException; + pendingException = null; + lock(typeof(ipsec_libPINVOKE)) { + numExceptionsPending--; + } + } + } + return e; + } + } + + + protected class SWIGStringHelper { + + public delegate string SWIGStringDelegate(string message); + static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString); + + [DllImport("ipsec_lib", EntryPoint="SWIGRegisterStringCallback_ipsec_lib")] + public static extern void SWIGRegisterStringCallback_ipsec_lib(SWIGStringDelegate stringDelegate); + + static string CreateString(string cString) { + return cString; + } + + static SWIGStringHelper() { + SWIGRegisterStringCallback_ipsec_lib(stringDelegate); + } + } + + static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper(); + + + static ipsec_libPINVOKE() { + } + + + [DllImport("ipsec_lib", EntryPoint="CSharp_new_IPSecCtx")] + public static extern IntPtr new_IPSecCtx(int jarg1, bool jarg2, int jarg3, int jarg4, int jarg5, int jarg6); + + [DllImport("ipsec_lib", EntryPoint="CSharp_delete_IPSecCtx")] + public static extern void delete_IPSecCtx(HandleRef jarg1); + + [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_start")] + public static extern int IPSecCtx_start(HandleRef jarg1); + + [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_setLocal")] + public static extern int IPSecCtx_setLocal(HandleRef jarg1, string jarg2, string jarg3, ushort jarg4, ushort jarg5); + + [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_setKeys")] + public static extern int IPSecCtx_setKeys(HandleRef jarg1, IntPtr jarg2, IntPtr jarg3); + + [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_setRemote")] + public static extern int IPSecCtx_setRemote(HandleRef jarg1, uint jarg2, uint jarg3, ushort jarg4, ushort jarg5, ulong jarg6); + + [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_stop")] + public static extern int IPSecCtx_stop(HandleRef jarg1); + + [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiUC")] + public static extern uint IPSecCtx_getSpiUC(HandleRef jarg1); + + [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiUS")] + public static extern uint IPSecCtx_getSpiUS(HandleRef jarg1); + + [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiPC")] + public static extern uint IPSecCtx_getSpiPC(HandleRef jarg1); + + [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiPS")] + public static extern uint IPSecCtx_getSpiPS(HandleRef jarg1); +} + +} diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/swig.i b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/swig.i new file mode 100644 index 00000000..83defeb3 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/swig.i @@ -0,0 +1,133 @@ +%module ipsec_lib +%module(directors="1") ipsec_lib + +%include "enums.swg" +%include + +%define %cs_marshal_array(TYPE, CSTYPE) +%typemap(ctype) TYPE[] "void*" +%typemap(imtype, +inattributes="[MarshalAs(UnmanagedType.LPArray)]") TYPE[] "CSTYPE[]" +%typemap(cstype) TYPE[] "CSTYPE[]" +%typemap(in) TYPE[] %{ $1 = (TYPE*)$input; %} +%typemap(csin) TYPE[] "$csinput" +%enddef + +// Mapping void* as IntPtr +%typemap(ctype) void * "void *" +%typemap(imtype) void * "IntPtr" +%typemap(cstype) void * "IntPtr" +%typemap(csin) void * "$csinput" +%typemap(in) void * %{ $1 = $input; %} +%typemap(out) void * %{ $result = $1; %} +%typemap(csout) void * { return $imcall; } +%typemap(csdirectorin) void * "$iminput" + +%{ +#include "IPSecCtx.h" +%} + +%nodefaultctor; +%include "IPSecCtx.h" +%clearnodefaultctor; + + +/**@def tipsec_lifetime_t +*/ +/**@def tipsec_spi_t +*/ +/**@def tipsec_port_t +*/ +/**@def tipsec_key_t +*/ +typedef uint64_t tipsec_lifetime_t; +typedef uint32_t tipsec_spi_t; +typedef uint16_t tipsec_port_t; +typedef void tipsec_key_t; + +/**@ingroup tipsec_common_group + * List of IPSec modes. +**/ +typedef enum tipsec_mode_e { + //! IPSec transport mode. + tipsec_mode_trans, + //! IPSec tunneling mode. + tipsec_mode_tun +} +tipsec_mode_t; + +/** List of supported IPSec protocols. +**/ +typedef enum tipsec_proto_e { + //! AH protocol ("ah"). + tipsec_proto_ah = (0x01 << 0), + //! ESP protocol ("esp"). + tipsec_proto_esp = (0x01 << 0), + //! Both AH and ESP protocols ("ah/esp"). + tipsec_proto_both = (tipsec_proto_ah | tipsec_proto_esp) +} +tipsec_proto_t; + +/**List of supported Internet protocols for IPSec. +**/ +typedef enum tipsec_ipproto_e { + //! UDP. + tipsec_ipproto_udp, + //! TCP. + tipsec_ipproto_tcp, + //! ICMP. + tipsec_ipproto_icmp +} +tipsec_ipproto_t; + +/**List of IPSec IPSec algorithms. +**/ +typedef enum tipsec_alg_e { + //! "hmac-md5-96" algorithm. + tipsec_alg_hmac_md5_96, + //! "hmac-sha-1-96" algorithm. + tipsec_alg_hmac_sha_1_96 +} +tipsec_alg_t; + +/**List of supported IPSec encryption algorithms. +**/ +typedef enum tipsec_ealg_e { + //! "des-ede3-cbc" encryption algorithm. + tipsec_ealg_des_ede3_cbc, + //! "aes" encryption algorithm. + tipsec_ealg_aes, + //! "null" encryption algorithm. + tipsec_ealg_null +} +tipsec_ealg_t; + +/** List of IPSec states. +**/ +typedef enum tipsec_state_e { + //! The default state. At this state no SA is created. It's the first and default state. + tipsec_state_initial, + //! Partial state. At this state only inbound SAs (with their SPIs) have been created. + tipsec_state_inbound, + //! Full state. At this state both inbound and outbound SAs have been create. It's the final state. + tipsec_state_full, + //! All SAs are in active mode. + tipsec_state_active +} +tipsec_state_t; + +/** List of supported IPSec errors +*/ +typedef enum tipsec_error_e { + tipsec_error_success = 0, /**< Success */ + tipsec_error_invalid_param, /**< Invalid parameter */ + tipsec_error_invalid_state, /**< Invalid state */ + tipsec_error_access_violation, /**< Access violation */ + tipsec_error_permission_denied, /**< Permission denied */ + tipsec_error_outofmemory, /**< Out of memory */ + tipsec_error_outofbound, /**< Out of bound */ + tipsec_error_notfound, /**< Not found */ + tipsec_error_notimplemented, /**< Not implemented */ + tipsec_error_sys, /**< System error */ +} +tipsec_error_t; diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/swig.sh b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/swig.sh new file mode 100644 index 00000000..1cf6fa5b --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/swig.sh @@ -0,0 +1 @@ +swig -c++ -csharp -namespace org.doubango.ipsecWRAP -outdir . -o ./ipsecWRAP.cxx ./swig.i \ No newline at end of file diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_alg_t.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_alg_t.cs new file mode 100644 index 00000000..4baf76b5 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_alg_t.cs @@ -0,0 +1,16 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace org.doubango.ipsecWRAP { + +public enum tipsec_alg_t { + tipsec_alg_hmac_md5_96, + tipsec_alg_hmac_sha_1_96 +} + +} diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_ealg_t.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_ealg_t.cs new file mode 100644 index 00000000..7dcb7cf6 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_ealg_t.cs @@ -0,0 +1,17 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace org.doubango.ipsecWRAP { + +public enum tipsec_ealg_t { + tipsec_ealg_des_ede3_cbc, + tipsec_ealg_aes, + tipsec_ealg_null +} + +} diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_error_t.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_error_t.cs new file mode 100644 index 00000000..b5f5a5e3 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_error_t.cs @@ -0,0 +1,24 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace org.doubango.ipsecWRAP { + +public enum tipsec_error_t { + tipsec_error_success = 0, + tipsec_error_invalid_param, + tipsec_error_invalid_state, + tipsec_error_access_violation, + tipsec_error_permission_denied, + tipsec_error_outofmemory, + tipsec_error_outofbound, + tipsec_error_notfound, + tipsec_error_notimplemented, + tipsec_error_sys +} + +} diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_ipproto_t.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_ipproto_t.cs new file mode 100644 index 00000000..88a8c492 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_ipproto_t.cs @@ -0,0 +1,17 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace org.doubango.ipsecWRAP { + +public enum tipsec_ipproto_t { + tipsec_ipproto_udp, + tipsec_ipproto_tcp, + tipsec_ipproto_icmp +} + +} diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_mode_t.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_mode_t.cs new file mode 100644 index 00000000..86af5ff2 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_mode_t.cs @@ -0,0 +1,16 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace org.doubango.ipsecWRAP { + +public enum tipsec_mode_t { + tipsec_mode_trans, + tipsec_mode_tun +} + +} diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_proto_t.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_proto_t.cs new file mode 100644 index 00000000..6455e9f4 --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_proto_t.cs @@ -0,0 +1,17 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace org.doubango.ipsecWRAP { + +public enum tipsec_proto_t { + tipsec_proto_ah = (0x01 << 0), + tipsec_proto_esp = (0x01 << 0), + tipsec_proto_both = (tipsec_proto_ah|tipsec_proto_esp) +} + +} diff --git a/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_state_t.cs b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_state_t.cs new file mode 100644 index 00000000..fcdf598f --- /dev/null +++ b/branches/2.0/doubango/Samples/C#/IPSec/ipsec_lib/tipsec_state_t.cs @@ -0,0 +1,18 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.9 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace org.doubango.ipsecWRAP { + +public enum tipsec_state_t { + tipsec_state_initial, + tipsec_state_inbound, + tipsec_state_full, + tipsec_state_active +} + +} diff --git a/branches/2.0/doubango/bindings/_common/SipStack.cxx b/branches/2.0/doubango/bindings/_common/SipStack.cxx index 7ba98084..917bb937 100644 --- a/branches/2.0/doubango/bindings/_common/SipStack.cxx +++ b/branches/2.0/doubango/bindings/_common/SipStack.cxx @@ -463,6 +463,11 @@ bool SipStack::isCodecSupported(tdav_codec_id_t codec_id) return tdav_codec_is_supported(codec_id) ? true : false; } +bool SipStack::isIPSecSupported() +{ + return tdav_ipsec_is_supported() ? true : false; +} + static int stack_callback(const tsip_event_t *sipevent) { int ret = 0; diff --git a/branches/2.0/doubango/bindings/_common/SipStack.h b/branches/2.0/doubango/bindings/_common/SipStack.h index cb62f7f7..5b7b47cd 100644 --- a/branches/2.0/doubango/bindings/_common/SipStack.h +++ b/branches/2.0/doubango/bindings/_common/SipStack.h @@ -96,6 +96,7 @@ public: /* API functions */ static bool setCodecPriority(tdav_codec_id_t codec_id, int priority); static bool setCodecPriority_2(int codec, int priority);// For stupid languages static bool isCodecSupported(tdav_codec_id_t codec_id); + static bool isIPSecSupported(); public: /* Public helper function */ #if !defined(SWIG) diff --git a/branches/2.0/doubango/bindings/csharp/MediaSessionMgr.cs b/branches/2.0/doubango/bindings/csharp/MediaSessionMgr.cs index 0e0c514b..3ad1c220 100644 --- a/branches/2.0/doubango/bindings/csharp/MediaSessionMgr.cs +++ b/branches/2.0/doubango/bindings/csharp/MediaSessionMgr.cs @@ -429,6 +429,11 @@ public class MediaSessionMgr : IDisposable { return ret; } + public static bool defaultsSetMaxFds(int max_fds) { + bool ret = tinyWRAPPINVOKE.MediaSessionMgr_defaultsSetMaxFds(max_fds); + return ret; + } + } } diff --git a/branches/2.0/doubango/bindings/csharp/SipStack.cs b/branches/2.0/doubango/bindings/csharp/SipStack.cs index f46e4ea0..9e3b7aef 100644 --- a/branches/2.0/doubango/bindings/csharp/SipStack.cs +++ b/branches/2.0/doubango/bindings/csharp/SipStack.cs @@ -228,6 +228,11 @@ public class SipStack : SafeObject { return ret; } + public bool setMaxFDs(uint max_fds) { + bool ret = tinyWRAPPINVOKE.SipStack_setMaxFDs(swigCPtr, max_fds); + return ret; + } + public string getLocalIPnPort(string protocol, out ushort OUTPUT) { string ret = tinyWRAPPINVOKE.SipStack_getLocalIPnPort(swigCPtr, protocol, out OUTPUT); return ret; @@ -281,6 +286,11 @@ public class SipStack : SafeObject { return ret; } + public static bool isIPSecSupported() { + bool ret = tinyWRAPPINVOKE.SipStack_isIPSecSupported(); + return ret; + } + } } diff --git a/branches/2.0/doubango/bindings/csharp/tinyWRAPPINVOKE.cs b/branches/2.0/doubango/bindings/csharp/tinyWRAPPINVOKE.cs index d7d93405..16872838 100644 --- a/branches/2.0/doubango/bindings/csharp/tinyWRAPPINVOKE.cs +++ b/branches/2.0/doubango/bindings/csharp/tinyWRAPPINVOKE.cs @@ -522,6 +522,9 @@ class tinyWRAPPINVOKE { [DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsSetOpusMaxPlaybackRate")] public static extern bool MediaSessionMgr_defaultsSetOpusMaxPlaybackRate(uint jarg1); + [DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsSetMaxFds")] + public static extern bool MediaSessionMgr_defaultsSetMaxFds(int jarg1); + [DllImport("tinyWRAP", EntryPoint="CSharp_delete_MediaContent")] public static extern void delete_MediaContent(HandleRef jarg1); @@ -1719,6 +1722,9 @@ class tinyWRAPPINVOKE { [DllImport("tinyWRAP", EntryPoint="CSharp_SipStack_dnsSrv")] public static extern string SipStack_dnsSrv(HandleRef jarg1, string jarg2, out ushort jarg3); + [DllImport("tinyWRAP", EntryPoint="CSharp_SipStack_setMaxFDs")] + public static extern bool SipStack_setMaxFDs(HandleRef jarg1, uint jarg2); + [DllImport("tinyWRAP", EntryPoint="CSharp_SipStack_getLocalIPnPort")] public static extern string SipStack_getLocalIPnPort(HandleRef jarg1, string jarg2, out ushort jarg3); @@ -1752,6 +1758,9 @@ class tinyWRAPPINVOKE { [DllImport("tinyWRAP", EntryPoint="CSharp_SipStack_isCodecSupported")] public static extern bool SipStack_isCodecSupported(int jarg1); + [DllImport("tinyWRAP", EntryPoint="CSharp_SipStack_isIPSecSupported")] + public static extern bool SipStack_isIPSecSupported(); + [DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_transport_error_get")] public static extern int tsip_event_code_dialog_transport_error_get(); diff --git a/branches/2.0/doubango/bindings/csharp/tinyWRAP_wrap.cxx b/branches/2.0/doubango/bindings/csharp/tinyWRAP_wrap.cxx index 6134dd2f..18f4dc15 100644 --- a/branches/2.0/doubango/bindings/csharp/tinyWRAP_wrap.cxx +++ b/branches/2.0/doubango/bindings/csharp/tinyWRAP_wrap.cxx @@ -2538,6 +2538,18 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsSetOpusMaxPla } +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsSetMaxFds(int jarg1) { + unsigned int jresult ; + int32_t arg1 ; + bool result; + + arg1 = (int32_t)jarg1; + result = (bool)MediaSessionMgr::defaultsSetMaxFds(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_delete_MediaContent(void * jarg1) { MediaContent *arg1 = (MediaContent *) 0 ; @@ -7729,6 +7741,20 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SipStack_dnsSrv(void * jarg1, char * jarg2, } +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipStack_setMaxFDs(void * jarg1, unsigned int jarg2) { + unsigned int jresult ; + SipStack *arg1 = (SipStack *) 0 ; + unsigned int arg2 ; + bool result; + + arg1 = (SipStack *)jarg1; + arg2 = (unsigned int)jarg2; + result = (bool)(arg1)->setMaxFDs(arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SipStack_getLocalIPnPort(void * jarg1, char * jarg2, unsigned short * jarg3) { char * jresult ; SipStack *arg1 = (SipStack *) 0 ; @@ -7859,6 +7885,16 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipStack_isCodecSupported(int jarg1) } +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipStack_isIPSecSupported() { + unsigned int jresult ; + bool result; + + result = (bool)SipStack::isIPSecSupported(); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_transport_error_get() { int jresult ; int result; diff --git a/branches/2.0/doubango/bindings/java/MediaSessionMgr.java b/branches/2.0/doubango/bindings/java/MediaSessionMgr.java index 08843588..3baad80c 100644 --- a/branches/2.0/doubango/bindings/java/MediaSessionMgr.java +++ b/branches/2.0/doubango/bindings/java/MediaSessionMgr.java @@ -346,4 +346,8 @@ public class MediaSessionMgr { return tinyWRAPJNI.MediaSessionMgr_defaultsSetOpusMaxPlaybackRate(opus_maxplaybackrate); } + public static boolean defaultsSetMaxFds(int max_fds) { + return tinyWRAPJNI.MediaSessionMgr_defaultsSetMaxFds(max_fds); + } + } diff --git a/branches/2.0/doubango/bindings/java/SipStack.java b/branches/2.0/doubango/bindings/java/SipStack.java index f6b319d5..54c6baaf 100644 --- a/branches/2.0/doubango/bindings/java/SipStack.java +++ b/branches/2.0/doubango/bindings/java/SipStack.java @@ -187,6 +187,10 @@ public class SipStack extends SafeObject { return tinyWRAPJNI.SipStack_dnsSrv(swigCPtr, this, service, OUTPUT); } + public boolean setMaxFDs(long max_fds) { + return tinyWRAPJNI.SipStack_setMaxFDs(swigCPtr, this, max_fds); + } + public String getLocalIPnPort(String protocol, int[] OUTPUT) { return tinyWRAPJNI.SipStack_getLocalIPnPort(swigCPtr, this, protocol, OUTPUT); } @@ -231,4 +235,8 @@ public class SipStack extends SafeObject { return tinyWRAPJNI.SipStack_isCodecSupported(codec_id.swigValue()); } + public static boolean isIPSecSupported() { + return tinyWRAPJNI.SipStack_isIPSecSupported(); + } + } diff --git a/branches/2.0/doubango/bindings/java/android/MediaSessionMgr.java b/branches/2.0/doubango/bindings/java/android/MediaSessionMgr.java index 08843588..3baad80c 100644 --- a/branches/2.0/doubango/bindings/java/android/MediaSessionMgr.java +++ b/branches/2.0/doubango/bindings/java/android/MediaSessionMgr.java @@ -346,4 +346,8 @@ public class MediaSessionMgr { return tinyWRAPJNI.MediaSessionMgr_defaultsSetOpusMaxPlaybackRate(opus_maxplaybackrate); } + public static boolean defaultsSetMaxFds(int max_fds) { + return tinyWRAPJNI.MediaSessionMgr_defaultsSetMaxFds(max_fds); + } + } diff --git a/branches/2.0/doubango/bindings/java/android/SipStack.java b/branches/2.0/doubango/bindings/java/android/SipStack.java index f6b319d5..54c6baaf 100644 --- a/branches/2.0/doubango/bindings/java/android/SipStack.java +++ b/branches/2.0/doubango/bindings/java/android/SipStack.java @@ -187,6 +187,10 @@ public class SipStack extends SafeObject { return tinyWRAPJNI.SipStack_dnsSrv(swigCPtr, this, service, OUTPUT); } + public boolean setMaxFDs(long max_fds) { + return tinyWRAPJNI.SipStack_setMaxFDs(swigCPtr, this, max_fds); + } + public String getLocalIPnPort(String protocol, int[] OUTPUT) { return tinyWRAPJNI.SipStack_getLocalIPnPort(swigCPtr, this, protocol, OUTPUT); } @@ -231,4 +235,8 @@ public class SipStack extends SafeObject { return tinyWRAPJNI.SipStack_isCodecSupported(codec_id.swigValue()); } + public static boolean isIPSecSupported() { + return tinyWRAPJNI.SipStack_isIPSecSupported(); + } + } diff --git a/branches/2.0/doubango/bindings/java/android/tinyWRAPJNI.java b/branches/2.0/doubango/bindings/java/android/tinyWRAPJNI.java index 35f63c2d..d2e80a99 100644 --- a/branches/2.0/doubango/bindings/java/android/tinyWRAPJNI.java +++ b/branches/2.0/doubango/bindings/java/android/tinyWRAPJNI.java @@ -121,6 +121,7 @@ public class tinyWRAPJNI { public final static native boolean MediaSessionMgr_defaultsSetAvpfTail(long jarg1, long jarg2); public final static native boolean MediaSessionMgr_defaultsSetOpusMaxCaptureRate(long jarg1); public final static native boolean MediaSessionMgr_defaultsSetOpusMaxPlaybackRate(long jarg1); + public final static native boolean MediaSessionMgr_defaultsSetMaxFds(int jarg1); public final static native void delete_MediaContent(long jarg1); public final static native String MediaContent_getType(long jarg1, MediaContent jarg1_); public final static native long MediaContent_getDataLength(long jarg1, MediaContent jarg1_); @@ -527,6 +528,7 @@ public class tinyWRAPJNI { public final static native String SipStack_dnsENUM(long jarg1, SipStack jarg1_, String jarg2, String jarg3, String jarg4); public final static native String SipStack_dnsNaptrSrv(long jarg1, SipStack jarg1_, String jarg2, String jarg3, int[] jarg4); public final static native String SipStack_dnsSrv(long jarg1, SipStack jarg1_, String jarg2, int[] jarg3); + public final static native boolean SipStack_setMaxFDs(long jarg1, SipStack jarg1_, long jarg2); public final static native String SipStack_getLocalIPnPort(long jarg1, SipStack jarg1_, String jarg2, int[] jarg3); public final static native String SipStack_getPreferredIdentity(long jarg1, SipStack jarg1_); public final static native boolean SipStack_isValid(long jarg1, SipStack jarg1_); @@ -538,6 +540,7 @@ public class tinyWRAPJNI { public final static native boolean SipStack_setCodecPriority(int jarg1, int jarg2); public final static native boolean SipStack_setCodecPriority_2(int jarg1, int jarg2); public final static native boolean SipStack_isCodecSupported(int jarg1); + public final static native boolean SipStack_isIPSecSupported(); public final static native long new_XcapSelector(long jarg1, XcapStack jarg1_); public final static native void delete_XcapSelector(long jarg1); public final static native long XcapSelector_setAUID(long jarg1, XcapSelector jarg1_, String jarg2); diff --git a/branches/2.0/doubango/bindings/java/android/tinyWRAP_wrap.cxx b/branches/2.0/doubango/bindings/java/android/tinyWRAP_wrap.cxx index 333c1ebb..5d982fc3 100644 --- a/branches/2.0/doubango/bindings/java/android/tinyWRAP_wrap.cxx +++ b/branches/2.0/doubango/bindings/java/android/tinyWRAP_wrap.cxx @@ -3732,6 +3732,20 @@ SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionM } +SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetMaxFds(JNIEnv *jenv, jclass jcls, jint jarg1) { + jboolean jresult = 0 ; + int32_t arg1 ; + bool result; + + (void)jenv; + (void)jcls; + arg1 = (int32_t)jarg1; + result = (bool)MediaSessionMgr::defaultsSetMaxFds(arg1); + jresult = (jboolean)result; + return jresult; +} + + SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_delete_1MediaContent(JNIEnv *jenv, jclass jcls, jlong jarg1) { MediaContent *arg1 = (MediaContent *) 0 ; @@ -11011,6 +11025,23 @@ SWIGEXPORT jstring JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1dnsS } +SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1setMaxFDs(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + jboolean jresult = 0 ; + SipStack *arg1 = (SipStack *) 0 ; + unsigned int arg2 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(SipStack **)&jarg1; + arg2 = (unsigned int)jarg2; + result = (bool)(arg1)->setMaxFDs(arg2); + jresult = (jboolean)result; + return jresult; +} + + SWIGEXPORT jstring JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1getLocalIPnPort(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jintArray jarg3) { jstring jresult = 0 ; SipStack *arg1 = (SipStack *) 0 ; @@ -11189,6 +11220,18 @@ SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1isC } +SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1isIPSecSupported(JNIEnv *jenv, jclass jcls) { + jboolean jresult = 0 ; + bool result; + + (void)jenv; + (void)jcls; + result = (bool)SipStack::isIPSecSupported(); + jresult = (jboolean)result; + return jresult; +} + + SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_new_1XcapSelector(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; XcapStack *arg1 = (XcapStack *) 0 ; diff --git a/branches/2.0/doubango/bindings/java/tinyWRAPJNI.java b/branches/2.0/doubango/bindings/java/tinyWRAPJNI.java index 35f63c2d..d2e80a99 100644 --- a/branches/2.0/doubango/bindings/java/tinyWRAPJNI.java +++ b/branches/2.0/doubango/bindings/java/tinyWRAPJNI.java @@ -121,6 +121,7 @@ public class tinyWRAPJNI { public final static native boolean MediaSessionMgr_defaultsSetAvpfTail(long jarg1, long jarg2); public final static native boolean MediaSessionMgr_defaultsSetOpusMaxCaptureRate(long jarg1); public final static native boolean MediaSessionMgr_defaultsSetOpusMaxPlaybackRate(long jarg1); + public final static native boolean MediaSessionMgr_defaultsSetMaxFds(int jarg1); public final static native void delete_MediaContent(long jarg1); public final static native String MediaContent_getType(long jarg1, MediaContent jarg1_); public final static native long MediaContent_getDataLength(long jarg1, MediaContent jarg1_); @@ -527,6 +528,7 @@ public class tinyWRAPJNI { public final static native String SipStack_dnsENUM(long jarg1, SipStack jarg1_, String jarg2, String jarg3, String jarg4); public final static native String SipStack_dnsNaptrSrv(long jarg1, SipStack jarg1_, String jarg2, String jarg3, int[] jarg4); public final static native String SipStack_dnsSrv(long jarg1, SipStack jarg1_, String jarg2, int[] jarg3); + public final static native boolean SipStack_setMaxFDs(long jarg1, SipStack jarg1_, long jarg2); public final static native String SipStack_getLocalIPnPort(long jarg1, SipStack jarg1_, String jarg2, int[] jarg3); public final static native String SipStack_getPreferredIdentity(long jarg1, SipStack jarg1_); public final static native boolean SipStack_isValid(long jarg1, SipStack jarg1_); @@ -538,6 +540,7 @@ public class tinyWRAPJNI { public final static native boolean SipStack_setCodecPriority(int jarg1, int jarg2); public final static native boolean SipStack_setCodecPriority_2(int jarg1, int jarg2); public final static native boolean SipStack_isCodecSupported(int jarg1); + public final static native boolean SipStack_isIPSecSupported(); public final static native long new_XcapSelector(long jarg1, XcapStack jarg1_); public final static native void delete_XcapSelector(long jarg1); public final static native long XcapSelector_setAUID(long jarg1, XcapSelector jarg1_, String jarg2); diff --git a/branches/2.0/doubango/bindings/java/tinyWRAP_wrap.cxx b/branches/2.0/doubango/bindings/java/tinyWRAP_wrap.cxx index 61a86fc0..0256c8b3 100644 --- a/branches/2.0/doubango/bindings/java/tinyWRAP_wrap.cxx +++ b/branches/2.0/doubango/bindings/java/tinyWRAP_wrap.cxx @@ -3732,6 +3732,20 @@ SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionM } +SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetMaxFds(JNIEnv *jenv, jclass jcls, jint jarg1) { + jboolean jresult = 0 ; + int32_t arg1 ; + bool result; + + (void)jenv; + (void)jcls; + arg1 = (int32_t)jarg1; + result = (bool)MediaSessionMgr::defaultsSetMaxFds(arg1); + jresult = (jboolean)result; + return jresult; +} + + SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_delete_1MediaContent(JNIEnv *jenv, jclass jcls, jlong jarg1) { MediaContent *arg1 = (MediaContent *) 0 ; @@ -11011,6 +11025,23 @@ SWIGEXPORT jstring JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1dnsS } +SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1setMaxFDs(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + jboolean jresult = 0 ; + SipStack *arg1 = (SipStack *) 0 ; + unsigned int arg2 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(SipStack **)&jarg1; + arg2 = (unsigned int)jarg2; + result = (bool)(arg1)->setMaxFDs(arg2); + jresult = (jboolean)result; + return jresult; +} + + SWIGEXPORT jstring JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1getLocalIPnPort(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jintArray jarg3) { jstring jresult = 0 ; SipStack *arg1 = (SipStack *) 0 ; @@ -11189,6 +11220,18 @@ SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1isC } +SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipStack_1isIPSecSupported(JNIEnv *jenv, jclass jcls) { + jboolean jresult = 0 ; + bool result; + + (void)jenv; + (void)jcls; + result = (bool)SipStack::isIPSecSupported(); + jresult = (jboolean)result; + return jresult; +} + + SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_new_1XcapSelector(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; XcapStack *arg1 = (XcapStack *) 0 ; diff --git a/branches/2.0/doubango/bindings/perl/tinyWRAP.pm b/branches/2.0/doubango/bindings/perl/tinyWRAP.pm index 50d03334..20f4d27d 100644 --- a/branches/2.0/doubango/bindings/perl/tinyWRAP.pm +++ b/branches/2.0/doubango/bindings/perl/tinyWRAP.pm @@ -306,6 +306,7 @@ sub DESTROY { *defaultsSetAvpfTail = *tinyWRAPc::MediaSessionMgr_defaultsSetAvpfTail; *defaultsSetOpusMaxCaptureRate = *tinyWRAPc::MediaSessionMgr_defaultsSetOpusMaxCaptureRate; *defaultsSetOpusMaxPlaybackRate = *tinyWRAPc::MediaSessionMgr_defaultsSetOpusMaxPlaybackRate; +*defaultsSetMaxFds = *tinyWRAPc::MediaSessionMgr_defaultsSetMaxFds; sub DISOWN { my $self = shift; my $ptr = tied(%$self); @@ -1976,6 +1977,7 @@ sub DESTROY { *dnsENUM = *tinyWRAPc::SipStack_dnsENUM; *dnsNaptrSrv = *tinyWRAPc::SipStack_dnsNaptrSrv; *dnsSrv = *tinyWRAPc::SipStack_dnsSrv; +*setMaxFDs = *tinyWRAPc::SipStack_setMaxFDs; *getLocalIPnPort = *tinyWRAPc::SipStack_getLocalIPnPort; *getPreferredIdentity = *tinyWRAPc::SipStack_getPreferredIdentity; *isValid = *tinyWRAPc::SipStack_isValid; @@ -1987,6 +1989,7 @@ sub DESTROY { *setCodecPriority = *tinyWRAPc::SipStack_setCodecPriority; *setCodecPriority_2 = *tinyWRAPc::SipStack_setCodecPriority_2; *isCodecSupported = *tinyWRAPc::SipStack_isCodecSupported; +*isIPSecSupported = *tinyWRAPc::SipStack_isIPSecSupported; sub DISOWN { my $self = shift; my $ptr = tied(%$self); diff --git a/branches/2.0/doubango/bindings/perl/tinyWRAP_wrap.cxx b/branches/2.0/doubango/bindings/perl/tinyWRAP_wrap.cxx index d41642f6..4a3fad1b 100644 --- a/branches/2.0/doubango/bindings/perl/tinyWRAP_wrap.cxx +++ b/branches/2.0/doubango/bindings/perl/tinyWRAP_wrap.cxx @@ -5795,6 +5795,34 @@ XS(_wrap_MediaSessionMgr_defaultsSetOpusMaxPlaybackRate) { } +XS(_wrap_MediaSessionMgr_defaultsSetMaxFds) { + { + int32_t arg1 ; + int val1 ; + int ecode1 = 0 ; + int argvi = 0; + bool result; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: MediaSessionMgr_defaultsSetMaxFds(max_fds);"); + } + ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "MediaSessionMgr_defaultsSetMaxFds" "', argument " "1"" of type '" "int32_t""'"); + } + arg1 = static_cast< int32_t >(val1); + result = (bool)MediaSessionMgr::defaultsSetMaxFds(arg1); + ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + XS(_wrap_delete_MediaContent) { { MediaContent *arg1 = (MediaContent *) 0 ; @@ -23227,6 +23255,44 @@ XS(_wrap_SipStack_dnsSrv) { } +XS(_wrap_SipStack_setMaxFDs) { + { + SipStack *arg1 = (SipStack *) 0 ; + unsigned int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned int val2 ; + int ecode2 = 0 ; + int argvi = 0; + bool result; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: SipStack_setMaxFDs(self,max_fds);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SipStack, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SipStack_setMaxFDs" "', argument " "1"" of type '" "SipStack *""'"); + } + arg1 = reinterpret_cast< SipStack * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SipStack_setMaxFDs" "', argument " "2"" of type '" "unsigned int""'"); + } + arg2 = static_cast< unsigned int >(val2); + result = (bool)(arg1)->setMaxFDs(arg2); + ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; + + + XSRETURN(argvi); + fail: + + + SWIG_croak_null(); + } +} + + XS(_wrap_SipStack_getLocalIPnPort) { { SipStack *arg1 = (SipStack *) 0 ; @@ -23558,6 +23624,24 @@ XS(_wrap_SipStack_isCodecSupported) { } +XS(_wrap_SipStack_isIPSecSupported) { + { + int argvi = 0; + bool result; + dXSARGS; + + if ((items < 0) || (items > 0)) { + SWIG_croak("Usage: SipStack_isIPSecSupported();"); + } + result = (bool)SipStack::isIPSecSupported(); + ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; + XSRETURN(argvi); + fail: + SWIG_croak_null(); + } +} + + XS(_wrap_new_XcapSelector) { { XcapStack *arg1 = (XcapStack *) 0 ; @@ -27594,6 +27678,7 @@ static swig_command_info swig_commands[] = { {"tinyWRAPc::MediaSessionMgr_defaultsSetAvpfTail", _wrap_MediaSessionMgr_defaultsSetAvpfTail}, {"tinyWRAPc::MediaSessionMgr_defaultsSetOpusMaxCaptureRate", _wrap_MediaSessionMgr_defaultsSetOpusMaxCaptureRate}, {"tinyWRAPc::MediaSessionMgr_defaultsSetOpusMaxPlaybackRate", _wrap_MediaSessionMgr_defaultsSetOpusMaxPlaybackRate}, +{"tinyWRAPc::MediaSessionMgr_defaultsSetMaxFds", _wrap_MediaSessionMgr_defaultsSetMaxFds}, {"tinyWRAPc::delete_MediaContent", _wrap_delete_MediaContent}, {"tinyWRAPc::MediaContent_getType", _wrap_MediaContent_getType}, {"tinyWRAPc::MediaContent_getDataLength", _wrap_MediaContent_getDataLength}, @@ -27894,6 +27979,7 @@ static swig_command_info swig_commands[] = { {"tinyWRAPc::SipStack_dnsENUM", _wrap_SipStack_dnsENUM}, {"tinyWRAPc::SipStack_dnsNaptrSrv", _wrap_SipStack_dnsNaptrSrv}, {"tinyWRAPc::SipStack_dnsSrv", _wrap_SipStack_dnsSrv}, +{"tinyWRAPc::SipStack_setMaxFDs", _wrap_SipStack_setMaxFDs}, {"tinyWRAPc::SipStack_getLocalIPnPort", _wrap_SipStack_getLocalIPnPort}, {"tinyWRAPc::SipStack_getPreferredIdentity", _wrap_SipStack_getPreferredIdentity}, {"tinyWRAPc::SipStack_isValid", _wrap_SipStack_isValid}, @@ -27905,6 +27991,7 @@ static swig_command_info swig_commands[] = { {"tinyWRAPc::SipStack_setCodecPriority", _wrap_SipStack_setCodecPriority}, {"tinyWRAPc::SipStack_setCodecPriority_2", _wrap_SipStack_setCodecPriority_2}, {"tinyWRAPc::SipStack_isCodecSupported", _wrap_SipStack_isCodecSupported}, +{"tinyWRAPc::SipStack_isIPSecSupported", _wrap_SipStack_isIPSecSupported}, {"tinyWRAPc::new_XcapSelector", _wrap_new_XcapSelector}, {"tinyWRAPc::delete_XcapSelector", _wrap_delete_XcapSelector}, {"tinyWRAPc::XcapSelector_setAUID", _wrap_XcapSelector_setAUID}, diff --git a/branches/2.0/doubango/bindings/python/tinyWRAP.py b/branches/2.0/doubango/bindings/python/tinyWRAP.py index 670db2c9..e7da86ca 100644 --- a/branches/2.0/doubango/bindings/python/tinyWRAP.py +++ b/branches/2.0/doubango/bindings/python/tinyWRAP.py @@ -319,6 +319,8 @@ class MediaSessionMgr(_object): if _newclass:defaultsSetOpusMaxCaptureRate = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetOpusMaxCaptureRate) __swig_getmethods__["defaultsSetOpusMaxPlaybackRate"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetOpusMaxPlaybackRate if _newclass:defaultsSetOpusMaxPlaybackRate = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetOpusMaxPlaybackRate) + __swig_getmethods__["defaultsSetMaxFds"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetMaxFds + if _newclass:defaultsSetMaxFds = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetMaxFds) MediaSessionMgr_swigregister = _tinyWRAP.MediaSessionMgr_swigregister MediaSessionMgr_swigregister(MediaSessionMgr) @@ -582,6 +584,10 @@ def MediaSessionMgr_defaultsSetOpusMaxPlaybackRate(*args): return _tinyWRAP.MediaSessionMgr_defaultsSetOpusMaxPlaybackRate(*args) MediaSessionMgr_defaultsSetOpusMaxPlaybackRate = _tinyWRAP.MediaSessionMgr_defaultsSetOpusMaxPlaybackRate +def MediaSessionMgr_defaultsSetMaxFds(*args): + return _tinyWRAP.MediaSessionMgr_defaultsSetMaxFds(*args) +MediaSessionMgr_defaultsSetMaxFds = _tinyWRAP.MediaSessionMgr_defaultsSetMaxFds + class MediaContent(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, MediaContent, name, value) @@ -1543,6 +1549,7 @@ class SipStack(SafeObject): def dnsENUM(self, *args): return _tinyWRAP.SipStack_dnsENUM(self, *args) def dnsNaptrSrv(self, *args): return _tinyWRAP.SipStack_dnsNaptrSrv(self, *args) def dnsSrv(self, *args): return _tinyWRAP.SipStack_dnsSrv(self, *args) + def setMaxFDs(self, *args): return _tinyWRAP.SipStack_setMaxFDs(self, *args) def getLocalIPnPort(self, *args): return _tinyWRAP.SipStack_getLocalIPnPort(self, *args) def getPreferredIdentity(self): return _tinyWRAP.SipStack_getPreferredIdentity(self) def isValid(self): return _tinyWRAP.SipStack_isValid(self) @@ -1561,6 +1568,8 @@ class SipStack(SafeObject): if _newclass:setCodecPriority_2 = staticmethod(_tinyWRAP.SipStack_setCodecPriority_2) __swig_getmethods__["isCodecSupported"] = lambda x: _tinyWRAP.SipStack_isCodecSupported if _newclass:isCodecSupported = staticmethod(_tinyWRAP.SipStack_isCodecSupported) + __swig_getmethods__["isIPSecSupported"] = lambda x: _tinyWRAP.SipStack_isIPSecSupported + if _newclass:isIPSecSupported = staticmethod(_tinyWRAP.SipStack_isIPSecSupported) SipStack_swigregister = _tinyWRAP.SipStack_swigregister SipStack_swigregister(SipStack) @@ -1592,6 +1601,10 @@ def SipStack_isCodecSupported(*args): return _tinyWRAP.SipStack_isCodecSupported(*args) SipStack_isCodecSupported = _tinyWRAP.SipStack_isCodecSupported +def SipStack_isIPSecSupported(): + return _tinyWRAP.SipStack_isIPSecSupported() +SipStack_isIPSecSupported = _tinyWRAP.SipStack_isIPSecSupported + tsip_stack_mode_ua = _tinyWRAP.tsip_stack_mode_ua tsip_stack_mode_p2p = _tinyWRAP.tsip_stack_mode_p2p tsip_stack_mode_mediaproxy = _tinyWRAP.tsip_stack_mode_mediaproxy diff --git a/branches/2.0/doubango/bindings/python/tinyWRAP_wrap.cxx b/branches/2.0/doubango/bindings/python/tinyWRAP_wrap.cxx index 8974c2c3..8c3bd14b 100644 --- a/branches/2.0/doubango/bindings/python/tinyWRAP_wrap.cxx +++ b/branches/2.0/doubango/bindings/python/tinyWRAP_wrap.cxx @@ -8399,6 +8399,28 @@ fail: } +SWIGINTERN PyObject *_wrap_MediaSessionMgr_defaultsSetMaxFds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int32_t arg1 ; + int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:MediaSessionMgr_defaultsSetMaxFds",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "MediaSessionMgr_defaultsSetMaxFds" "', argument " "1"" of type '" "int32_t""'"); + } + arg1 = static_cast< int32_t >(val1); + result = (bool)MediaSessionMgr::defaultsSetMaxFds(arg1); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *MediaSessionMgr_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; @@ -22576,6 +22598,37 @@ fail: } +SWIGINTERN PyObject *_wrap_SipStack_setMaxFDs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SipStack *arg1 = (SipStack *) 0 ; + unsigned int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OO:SipStack_setMaxFDs",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SipStack, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SipStack_setMaxFDs" "', argument " "1"" of type '" "SipStack *""'"); + } + arg1 = reinterpret_cast< SipStack * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SipStack_setMaxFDs" "', argument " "2"" of type '" "unsigned int""'"); + } + arg2 = static_cast< unsigned int >(val2); + result = (bool)(arg1)->setMaxFDs(arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_SipStack_getLocalIPnPort(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; SipStack *arg1 = (SipStack *) 0 ; @@ -22840,6 +22893,19 @@ fail: } +SWIGINTERN PyObject *_wrap_SipStack_isIPSecSupported(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + bool result; + + if (!PyArg_ParseTuple(args,(char *)":SipStack_isIPSecSupported")) SWIG_fail; + result = (bool)SipStack::isIPSecSupported(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *SipStack_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; @@ -25998,6 +26064,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"MediaSessionMgr_defaultsSetAvpfTail", _wrap_MediaSessionMgr_defaultsSetAvpfTail, METH_VARARGS, NULL}, { (char *)"MediaSessionMgr_defaultsSetOpusMaxCaptureRate", _wrap_MediaSessionMgr_defaultsSetOpusMaxCaptureRate, METH_VARARGS, NULL}, { (char *)"MediaSessionMgr_defaultsSetOpusMaxPlaybackRate", _wrap_MediaSessionMgr_defaultsSetOpusMaxPlaybackRate, METH_VARARGS, NULL}, + { (char *)"MediaSessionMgr_defaultsSetMaxFds", _wrap_MediaSessionMgr_defaultsSetMaxFds, METH_VARARGS, NULL}, { (char *)"MediaSessionMgr_swigregister", MediaSessionMgr_swigregister, METH_VARARGS, NULL}, { (char *)"delete_MediaContent", _wrap_delete_MediaContent, METH_VARARGS, NULL}, { (char *)"MediaContent_getType", _wrap_MediaContent_getType, METH_VARARGS, NULL}, @@ -26347,6 +26414,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"SipStack_dnsENUM", _wrap_SipStack_dnsENUM, METH_VARARGS, NULL}, { (char *)"SipStack_dnsNaptrSrv", _wrap_SipStack_dnsNaptrSrv, METH_VARARGS, NULL}, { (char *)"SipStack_dnsSrv", _wrap_SipStack_dnsSrv, METH_VARARGS, NULL}, + { (char *)"SipStack_setMaxFDs", _wrap_SipStack_setMaxFDs, METH_VARARGS, NULL}, { (char *)"SipStack_getLocalIPnPort", _wrap_SipStack_getLocalIPnPort, METH_VARARGS, NULL}, { (char *)"SipStack_getPreferredIdentity", _wrap_SipStack_getPreferredIdentity, METH_VARARGS, NULL}, { (char *)"SipStack_isValid", _wrap_SipStack_isValid, METH_VARARGS, NULL}, @@ -26358,6 +26426,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"SipStack_setCodecPriority", _wrap_SipStack_setCodecPriority, METH_VARARGS, NULL}, { (char *)"SipStack_setCodecPriority_2", _wrap_SipStack_setCodecPriority_2, METH_VARARGS, NULL}, { (char *)"SipStack_isCodecSupported", _wrap_SipStack_isCodecSupported, METH_VARARGS, NULL}, + { (char *)"SipStack_isIPSecSupported", _wrap_SipStack_isIPSecSupported, METH_VARARGS, NULL}, { (char *)"SipStack_swigregister", SipStack_swigregister, METH_VARARGS, NULL}, { (char *)"new_XcapSelector", _wrap_new_XcapSelector, METH_VARARGS, NULL}, { (char *)"delete_XcapSelector", _wrap_delete_XcapSelector, METH_VARARGS, NULL}, diff --git a/branches/2.0/doubango/bindings/version.rc b/branches/2.0/doubango/bindings/version.rc index d84cff17..32627455 100644 --- a/branches/2.0/doubango/bindings/version.rc +++ b/branches/2.0/doubango/bindings/version.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,972 - PRODUCTVERSION 2,0,0,972 + FILEVERSION 2,0,0,1001 + PRODUCTVERSION 2,0,0,1001 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -71,12 +71,12 @@ BEGIN BEGIN VALUE "CompanyName", "Doubango telecom" VALUE "FileDescription", "Doubango IMS Framework" - VALUE "FileVersion", "2.0.0.972" + VALUE "FileVersion", "2.0.0.1001" VALUE "InternalName", "tinywrap.dll" VALUE "LegalCopyright", "(c) 2010-2013 Doubango Telecom. All rights reserved." VALUE "OriginalFilename", "tinywrap.dll" VALUE "ProductName", "Doubango IMS Framework" - VALUE "ProductVersion", "2.0.0.972" + VALUE "ProductVersion", "2.0.0.1001" END END BLOCK "VarFileInfo" diff --git a/branches/2.0/doubango/plugins/pluginCUDA/version.rc b/branches/2.0/doubango/plugins/pluginCUDA/version.rc index e566e0b3..39970951 100644 --- a/branches/2.0/doubango/plugins/pluginCUDA/version.rc +++ b/branches/2.0/doubango/plugins/pluginCUDA/version.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,972 - PRODUCTVERSION 2,0,0,972 + FILEVERSION 2,0,0,1001 + PRODUCTVERSION 2,0,0,1001 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -71,12 +71,12 @@ BEGIN BEGIN VALUE "CompanyName", "Doubango Telecom" VALUE "FileDescription", "Doubango IMS Framework NVIDIA CUDA Plugin" - VALUE "FileVersion", "2.0.0.972" + VALUE "FileVersion", "2.0.0.1001" VALUE "InternalName", "pluginCUDA.dll" VALUE "LegalCopyright", "(c) 2010-2013 Doubango Telecom. All rights reserved." VALUE "OriginalFilename", "pluginCUDA.dll" VALUE "ProductName", "Doubango IMS Framework NVIDIA CUDA Plugin" - VALUE "ProductVersion", "2.0.0.972" + VALUE "ProductVersion", "2.0.0.1001" END END BLOCK "VarFileInfo" diff --git a/branches/2.0/doubango/plugins/pluginDirectShow/version.rc b/branches/2.0/doubango/plugins/pluginDirectShow/version.rc index 6ef5a348..a3591e3e 100644 --- a/branches/2.0/doubango/plugins/pluginDirectShow/version.rc +++ b/branches/2.0/doubango/plugins/pluginDirectShow/version.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,972 - PRODUCTVERSION 2,0,0,972 + FILEVERSION 2,0,0,1001 + PRODUCTVERSION 2,0,0,1001 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -71,12 +71,12 @@ BEGIN BEGIN VALUE "CompanyName", "Doubango Telecom" VALUE "FileDescription", "Doubango IMS Framework DirectShow Plugin" - VALUE "FileVersion", "2.0.0.972" + VALUE "FileVersion", "2.0.0.1001" VALUE "InternalName", "pluginDirectShow.dll" VALUE "LegalCopyright", "(c) 2010-2013 Doubango Telecom. All rights reserved." VALUE "OriginalFilename", "pluginDirectShow.dll" VALUE "ProductName", "Doubango IMS Framework DirectShow Plugin" - VALUE "ProductVersion", "2.0.0.972" + VALUE "ProductVersion", "2.0.0.1001" END END BLOCK "VarFileInfo" diff --git a/branches/2.0/doubango/plugins/pluginWASAPI/version.rc b/branches/2.0/doubango/plugins/pluginWASAPI/version.rc index f22f1cfe..d88a4d76 100644 --- a/branches/2.0/doubango/plugins/pluginWASAPI/version.rc +++ b/branches/2.0/doubango/plugins/pluginWASAPI/version.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,972 - PRODUCTVERSION 2,0,0,972 + FILEVERSION 2,0,0,1001 + PRODUCTVERSION 2,0,0,1001 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -71,12 +71,12 @@ BEGIN BEGIN VALUE "CompanyName", "Doubango Telecom" VALUE "FileDescription", "Doubango IMS Framework WASAPI Plugin" - VALUE "FileVersion", "2.0.0.972" + VALUE "FileVersion", "2.0.0.1001" VALUE "InternalName", "pluginWASAPI.dll" VALUE "LegalCopyright", "(c) 2010-2013 Doubango Telecom. All rights reserved." VALUE "OriginalFilename", "pluginWASAPI.dll" VALUE "ProductName", "Doubango IMS Framework WASAPI Plugin" - VALUE "ProductVersion", "2.0.0.972" + VALUE "ProductVersion", "2.0.0.1001" END END BLOCK "VarFileInfo" diff --git a/branches/2.0/doubango/plugins/pluginWinAudioDSP/version.rc b/branches/2.0/doubango/plugins/pluginWinAudioDSP/version.rc index f39a903f..ce8f67f6 100644 --- a/branches/2.0/doubango/plugins/pluginWinAudioDSP/version.rc +++ b/branches/2.0/doubango/plugins/pluginWinAudioDSP/version.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,972 - PRODUCTVERSION 2,0,0,972 + FILEVERSION 2,0,0,1001 + PRODUCTVERSION 2,0,0,1001 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -71,12 +71,12 @@ BEGIN BEGIN VALUE "CompanyName", "Doubango Telecom" VALUE "FileDescription", "Doubango IMS Framework Windows Audio DSP" - VALUE "FileVersion", "2.0.0.972" + VALUE "FileVersion", "2.0.0.1001" VALUE "InternalName", "pluginWinAudioDSP.dll" VALUE "LegalCopyright", "(c) 2010-2013 Doubango Telecom. All rights reserved." VALUE "OriginalFilename", "pluginWinAudioDSP.dll" VALUE "ProductName", "Doubango IMS Framework Windows Audio DSP" - VALUE "ProductVersion", "2.0.0.972" + VALUE "ProductVersion", "2.0.0.1001" END END BLOCK "VarFileInfo" diff --git a/branches/2.0/doubango/plugins/pluginWinIPSecVista/AStyle.sh b/branches/2.0/doubango/plugins/pluginWinIPSecVista/AStyle.sh new file mode 100644 index 00000000..e736f476 --- /dev/null +++ b/branches/2.0/doubango/plugins/pluginWinIPSecVista/AStyle.sh @@ -0,0 +1 @@ +AStyle.exe --style=k/r --lineend=linux --mode=c --add-brackets --break-closing-brackets --recursive "*.c" "*.h" \ No newline at end of file diff --git a/branches/2.0/doubango/plugins/pluginWinIPSecVista/dllmain_ipsec_vista.c b/branches/2.0/doubango/plugins/pluginWinIPSecVista/dllmain_ipsec_vista.c new file mode 100644 index 00000000..d61752ea --- /dev/null +++ b/branches/2.0/doubango/plugins/pluginWinIPSecVista/dllmain_ipsec_vista.c @@ -0,0 +1,100 @@ +/* Copyright (C) 2013-2014 Mamadou DIOP +* Copyright (C) 2013-2014 Doubango Telecom +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +*/ +#include "plugin_win_ipsec_vista_config.h" + +#include "tipsec.h" +#include "tsk_plugin.h" +#include "tsk_debug.h" + +#include + +extern const tipsec_plugin_def_t *plugin_win_ipsec_vista_plugin_def_t; + +PLUGIN_WIN_IPSEC_VISTA_BEGIN_DECLS /* BEGIN */ +PLUGIN_WIN_IPSEC_VISTA_API int __plugin_get_def_count(); +PLUGIN_WIN_IPSEC_VISTA_API tsk_plugin_def_type_t __plugin_get_def_type_at(int index); +PLUGIN_WIN_IPSEC_VISTA_API tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index); +PLUGIN_WIN_IPSEC_VISTA_API tsk_plugin_def_ptr_const_t __plugin_get_def_at(int index); +PLUGIN_WIN_IPSEC_VISTA_END_DECLS /* END */ + +typedef enum PLUGIN_INDEX_E { + PLUGIN_INDEX_WFP, // Windows Filtering platform + + PLUGIN_INDEX_COUNT +} +PLUGIN_INDEX_T; + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) { + case DLL_PROCESS_ATTACH: + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + + +int __plugin_get_def_count() +{ + return PLUGIN_INDEX_COUNT; +} + +tsk_plugin_def_type_t __plugin_get_def_type_at(int index) +{ + switch(index) { + case PLUGIN_INDEX_WFP: { + return tsk_plugin_def_type_ipsec; + } + } + TSK_DEBUG_ERROR("No plugin at index %d", index); + return tsk_plugin_def_type_none; +} + +tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index) +{ + switch(index) { + case PLUGIN_INDEX_WFP: { + return tsk_plugin_def_media_type_all; + } + } + + TSK_DEBUG_ERROR("No plugin at index %d", index); + return tsk_plugin_def_media_type_none; +} + +tsk_plugin_def_ptr_const_t __plugin_get_def_at(int index) +{ + switch(index) { + case PLUGIN_INDEX_WFP: { + return plugin_win_ipsec_vista_plugin_def_t; + } + } + + TSK_DEBUG_ERROR("No plugin at index %d", index); + return tsk_null; +} diff --git a/branches/2.0/doubango/plugins/pluginWinIPSecVista/pluginWinIPSecVista.vcproj b/branches/2.0/doubango/plugins/pluginWinIPSecVista/pluginWinIPSecVista.vcproj new file mode 100644 index 00000000..99223740 --- /dev/null +++ b/branches/2.0/doubango/plugins/pluginWinIPSecVista/pluginWinIPSecVista.vcproj @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/2.0/doubango/plugins/pluginWinIPSecVista/plugin_win_ipsec_vista.c b/branches/2.0/doubango/plugins/pluginWinIPSecVista/plugin_win_ipsec_vista.c new file mode 100644 index 00000000..decb3fc9 --- /dev/null +++ b/branches/2.0/doubango/plugins/pluginWinIPSecVista/plugin_win_ipsec_vista.c @@ -0,0 +1,636 @@ +/* Copyright (C) 2013-2014 Mamadou DIOP +* Copyright (C) 2013-2014 Doubango Telecom +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +*/ +#include "plugin_win_ipsec_vista_config.h" + +#include "tipsec.h" /* From tinyIPSec project. Requires linking against "tinyIPSec.lib" */ + +#include "tsk_memory.h" +#include "tsk_object.h" +#include "tsk_debug.h" + +#include +#include + +#if defined(_MSC_VER) +# pragma comment(lib, "Fwpuclnt.lib") +#endif + +typedef FWP_BYTE_BLOB* PFWP_BYTE_BLOB; + +/* as WFP do not provide null encryption I define my own*/ +static const IPSEC_CIPHER_TRANSFORM_ID0 IPSEC_CIPHER_TRANSFORM_ID_NULL_NULL= { + (IPSEC_CIPHER_TYPE)NULL, + (IPSEC_CIPHER_TYPE)NULL +}; + +#define TINYIPSEC_FILTER_NAME TEXT("Doubango Telecom tinyIPSec (Windows Vista)") +#define TINYIPSEC_PROVIDER_KEY NULL + +#define TINYIPSEC_SA_NUM_ENTRIES_TO_REQUEST 20 +#define TINYIPSEC_SA_MAX_LIFETIME 172799 + +#define TINYIPSEC_VISTA_GET_ALGO(algo) (algo == tipsec_alg_hmac_md5_96) ? IPSEC_AUTH_TRANSFORM_ID_HMAC_MD5_96 : IPSEC_AUTH_TRANSFORM_ID_HMAC_SHA_1_96 +#define TINYIPSEC_VISTA_GET_EALGO(ealg) (ealg == tipsec_ealg_des_ede3_cbc) ? IPSEC_CIPHER_TRANSFORM_ID_CBC_3DES : ( (ealg == tipsec_ealg_aes) ? IPSEC_CIPHER_TRANSFORM_ID_AES_128 : IPSEC_CIPHER_TRANSFORM_ID_NULL_NULL ) +#define TINYIPSEC_VISTA_GET_MODE(mode) (mode == tipsec_mode_tun) ? IPSEC_TRAFFIC_TYPE_TUNNEL : IPSEC_TRAFFIC_TYPE_TRANSPORT +#define TINYIPSEC_VISTA_GET_IPPROTO(ipproto) (ipproto == tipsec_ipproto_tcp) ? IPPROTO_TCP : IPPROTO_UDP +#define TINYIPSEC_VISTA_GET_IPVER(ipv6) (ipv6) ? FWP_IP_VERSION_V6 : FWP_IP_VERSION_V4 +#define TINYIPSEC_VISTA_GET_PROTO(proto) (proto == tipsec_proto_ah) ? IPSEC_TRANSFORM_AH : ( (proto == tipsec_proto_esp) ? IPSEC_TRANSFORM_ESP_AUTH : IPSEC_TRANSFORM_ESP_AUTH_AND_CIPHER ); + +typedef struct plugin_win_ipsec_vista_ctx_s { + TIPSEC_DECLARE_CTX; + + tipsec_ctx_t* pc_base; + UINT64 saId_us; + UINT64 saId_uc; + + HANDLE engine; +} +plugin_win_ipsec_vista_ctx_t; + +static int _vista_createLocalSA(__in const plugin_win_ipsec_vista_ctx_t* p_ctx, __in tipsec_port_t local_port, __out tipsec_spi_t *spi, UINT64 *saId); +static int _vista_boundSA(__in const plugin_win_ipsec_vista_ctx_t* p_ctx, __in UINT64 local_saId, __in tipsec_spi_t remote_spi, __in BOOLEAN toInbound); + +static int _vista_flushAll(const plugin_win_ipsec_vista_ctx_t* p_ctx); +static void _vista_deleteSaContextAndFilters(__in HANDLE engine, __in UINT64 inFilterId, __in UINT64 outFilterId, __in UINT64 saId); + +// +// Plugin implementation +// + +static tipsec_error_t _plugin_win_ipsec_vista_ctx_init(tipsec_ctx_t* _p_ctx) +{ + plugin_win_ipsec_vista_ctx_t* p_ctx = (plugin_win_ipsec_vista_ctx_t*)_p_ctx; + DWORD code; + + if (p_ctx->pc_base->initialized) { + TSK_DEBUG_ERROR("Already initialized"); + return tipsec_error_invalid_state; + } + + /* Open engine */ + if ((code = FwpmEngineOpen0(NULL, RPC_C_AUTHN_WINNT, NULL, NULL, &p_ctx->engine))) { + p_ctx->pc_base->initialized = tsk_false; + TSK_DEBUG_ERROR("FwpmEngineOpen0 failed with error code [%x].", code); + return tipsec_error_sys; + } + else { + p_ctx->pc_base->initialized = tsk_true; + p_ctx->pc_base->state = tipsec_state_initial; + return tipsec_error_success; + } +} + +static tipsec_error_t _plugin_win_ipsec_vista_ctx_set_local(tipsec_ctx_t* _p_ctx, const char* addr_local, const char* addr_remote, tipsec_port_t port_uc, tipsec_port_t port_us) +{ + plugin_win_ipsec_vista_ctx_t* p_ctx = (plugin_win_ipsec_vista_ctx_t*)_p_ctx; + int ret; + + _p_ctx->addr_local = tsk_realloc(_p_ctx->addr_local, _p_ctx->use_ipv6 ? 16 : 4); + if (!_p_ctx->addr_local) { + return tipsec_error_outofmemory; + } + _p_ctx->addr_remote = tsk_realloc(_p_ctx->addr_remote, _p_ctx->use_ipv6 ? 16 : 4); + if (!_p_ctx->addr_remote) { + return tipsec_error_outofmemory; + } + + /* Set local IP */ + if (_p_ctx->use_ipv6) { + if ((ret = inet_pton(AF_INET6, addr_local, _p_ctx->addr_local)) != 1 ) { + TSK_DEBUG_ERROR("inet_pton(%s) have failed with error code [%x].", addr_local, ret); + return tipsec_error_sys; + } + if ((ret = inet_pton(AF_INET6, addr_remote, _p_ctx->addr_remote)) != 1 ) { + TSK_DEBUG_ERROR("inet_pton(%s) have failed with error code [%x].", addr_remote, ret); + return tipsec_error_sys; + } + } + else { + if ((ret = inet_pton(AF_INET, addr_local, _p_ctx->addr_local)) != 1 ) { + TSK_DEBUG_ERROR("inet_pton(%s) have failed with error code [%x].", addr_local, ret); + return tipsec_error_sys; + } + else { + *((UINT32*)_p_ctx->addr_local) = ntohl(*((UINT32*)_p_ctx->addr_local)); + } + if ((ret = inet_pton(AF_INET, addr_remote, _p_ctx->addr_remote)) != 1 ) { + TSK_DEBUG_ERROR("inet_pton(%s) have failed with error code [%x].", addr_remote, ret); + return tipsec_error_sys; + } + else { + *((UINT32*)_p_ctx->addr_remote) = ntohl(*((UINT32*)_p_ctx->addr_remote)); + } + } + + /* Set ports */ + _p_ctx->port_uc = port_uc; + _p_ctx->port_us = port_us; + + // Create SA1: (UC -> PS) + if ((ret = _vista_createLocalSA(p_ctx, _p_ctx->port_uc, &_p_ctx->spi_uc, &p_ctx->saId_uc))) { + return tipsec_error_sys; + } + + // Create SA2: (US <-PC) + if ((ret = _vista_createLocalSA(p_ctx, _p_ctx->port_us, &_p_ctx->spi_us, &p_ctx->saId_us))) { + return tipsec_error_sys; + } + + _p_ctx->state = tipsec_state_inbound; + + return tipsec_error_success; +} + +static tipsec_error_t _plugin_win_ipsec_vista_ctx_set_remote(tipsec_ctx_t* _p_ctx, tipsec_spi_t spi_pc, tipsec_spi_t spi_ps, tipsec_port_t port_pc, tipsec_port_t port_ps, tipsec_lifetime_t lifetime) +{ + plugin_win_ipsec_vista_ctx_t* p_ctx = (plugin_win_ipsec_vista_ctx_t*)_p_ctx; + + /* Set Lifetime */ + _p_ctx->lifetime = lifetime; + + /* Set ports */ + _p_ctx->port_ps = port_ps; + _p_ctx->port_pc = port_pc; + + /* Set SPIs */ + _p_ctx->spi_ps = spi_ps; + _p_ctx->spi_pc = spi_pc; + + _p_ctx->state = tipsec_state_full; + + return tipsec_error_success; +} + +static tipsec_error_t _plugin_win_ipsec_vista_ctx_set_keys(tipsec_ctx_t* _p_ctx, const tipsec_key_t* ik, const tipsec_key_t* ck) +{ + plugin_win_ipsec_vista_ctx_t* p_ctx = (plugin_win_ipsec_vista_ctx_t*)_p_ctx; + PFWP_BYTE_BLOB _ik, _ck; + + /* Compute ik and ck */ + _p_ctx->ik = tsk_realloc(_p_ctx->ik, sizeof(FWP_BYTE_BLOB)); + if (!_p_ctx->ik) { + return tipsec_error_outofmemory; + } + _ik = (PFWP_BYTE_BLOB)_p_ctx->ik; + _p_ctx->ck = tsk_realloc(_p_ctx->ck, sizeof(FWP_BYTE_BLOB)); + if (!_p_ctx->ck) { + return tipsec_error_outofmemory; + } + _ck = (PFWP_BYTE_BLOB)_p_ctx->ck; + + _ik->data = tsk_calloc(1, TIPSEC_IK_LEN); + if (!_ik->data) { + return tipsec_error_outofmemory; + } + memcpy(_ik->data, ik, TIPSEC_KEY_LEN); + _ik->size = TIPSEC_KEY_LEN; + + _ck->data = tsk_calloc(1, TIPSEC_CK_LEN); + if (!_ck->data) { + return tipsec_error_outofmemory; + } + memcpy(_ck->data, ck, TIPSEC_KEY_LEN); + _ck->size = TIPSEC_KEY_LEN; + + return tipsec_error_success; +} + +static tipsec_error_t _plugin_win_ipsec_vista_ctx_start(tipsec_ctx_t* _p_ctx) +{ + plugin_win_ipsec_vista_ctx_t* p_ctx = (plugin_win_ipsec_vista_ctx_t*)_p_ctx; + int ret; + + /* VERY IMPORTANT: The SA context functions must be called in a specific order: + (http://msdn.microsoft.com/en-us/library/bb540652(VS.85).aspx). + + IPsecSaContextCreate0 + IPsecSaContextGetSpi0 + IPsecSaContextAddInbound0 + IPsecSaContextAddOutbound0 + */ + + /* US <- PC */ + if ((ret = _vista_boundSA(p_ctx, p_ctx->saId_us, _p_ctx->spi_us, TRUE))) { + TSK_DEBUG_ERROR("Failed to setup [US <- PC] SA. Error code = %d", ret); + return tipsec_error_sys; + } + /* UC <- PS */ + if ((ret = _vista_boundSA(p_ctx, p_ctx->saId_uc, _p_ctx->spi_uc, TRUE))) { + TSK_DEBUG_ERROR("Failed to setup [UC <- PS] SA. Error code = %d", ret); + return tipsec_error_sys; + } + + /* UC -> PS */ + if ((ret = _vista_boundSA(p_ctx, p_ctx->saId_uc, _p_ctx->spi_ps, FALSE))) { + TSK_DEBUG_ERROR("Failed to setup [UC -> PS] SA. Error code = %d", ret); + return tipsec_error_sys; + } + /* US -> PC */ + if ((ret = _vista_boundSA(p_ctx, p_ctx->saId_us, _p_ctx->spi_pc, FALSE))) { + TSK_DEBUG_ERROR("Failed to setup [US -> PC] SA. Error code = %d", ret); + return tipsec_error_sys; + } + + _p_ctx->state = tipsec_state_active; + _p_ctx->started = 1; + + return tipsec_error_success; +} + +static tipsec_error_t _plugin_win_ipsec_vista_ctx_stop(tipsec_ctx_t* _p_ctx) +{ + plugin_win_ipsec_vista_ctx_t* p_ctx = (plugin_win_ipsec_vista_ctx_t*)_p_ctx; + tipsec_error_t err = tipsec_error_success; + + //if (!_p_ctx->started) { + // return tipsec_error_success; + //} + + /* Flush (delete) all SAs associated to tinyIPSEC */ + _vista_flushAll(p_ctx); + + _p_ctx->started = 0; + _p_ctx->state = tipsec_state_initial; + + return tipsec_error_success; +} + +// +// Private functions +// +static int _vista_createLocalSA(__in const plugin_win_ipsec_vista_ctx_t* p_ctx, __in tipsec_port_t local_port, __out tipsec_spi_t *spi, UINT64 *saId) +{ + DWORD result = NO_ERROR; + UINT64 tmpInFilterId = 0, tmpOutFilterId = 0, tmpSaId = 0; + FWPM_FILTER0 filter; + IPSEC_TRAFFIC0 outTraffic; + IPSEC_GETSPI0 getSpi; + int ret = -1; + FWPM_FILTER_CONDITION0 conds[4]; + + *spi = 0; + *saId = 0; + + conds[0].fieldKey = FWPM_CONDITION_IP_LOCAL_ADDRESS; + conds[0].matchType = FWP_MATCH_EQUAL; + conds[1].fieldKey = FWPM_CONDITION_IP_REMOTE_ADDRESS; + conds[1].matchType = FWP_MATCH_EQUAL; + if (p_ctx->pc_base->use_ipv6) { + conds[0].conditionValue.type = FWP_BYTE_ARRAY16_TYPE; + conds[0].conditionValue.byteArray16 = (FWP_BYTE_ARRAY16*)p_ctx->pc_base->addr_local; + conds[1].conditionValue.type = FWP_BYTE_ARRAY16_TYPE; + conds[1].conditionValue.byteArray16 = (FWP_BYTE_ARRAY16*)p_ctx->pc_base->addr_remote; + } + else { + conds[0].conditionValue.type = FWP_UINT32; + conds[0].conditionValue.uint32 = *((UINT32*)p_ctx->pc_base->addr_local); + conds[1].conditionValue.type = FWP_UINT32; + conds[1].conditionValue.uint32 = *((UINT32*)p_ctx->pc_base->addr_remote); + } + + conds[2].fieldKey = FWPM_CONDITION_IP_LOCAL_PORT; + conds[2].matchType = FWP_MATCH_EQUAL; + conds[2].conditionValue.type = FWP_UINT16; + conds[2].conditionValue.uint16 = local_port; + + conds[3].fieldKey = FWPM_CONDITION_IP_PROTOCOL; + conds[3].matchType = FWP_MATCH_EQUAL; + conds[3].conditionValue.type = FWP_UINT8; + conds[3].conditionValue.uint16 = TINYIPSEC_VISTA_GET_IPPROTO(p_ctx->pc_base->ipproto); + + // Fill in the common fields shared by both filters. + memset(&filter, 0, sizeof(filter)); + // For MUI compatibility, object names should be indirect strings. See + // SHLoadIndirectString for details. + filter.displayData.name = (PWSTR)TINYIPSEC_FILTER_NAME; + // Link all objects to our provider. When multiple providers are installed + // on a computer, this makes it easy to determine who added what. + filter.providerKey = (GUID*)TINYIPSEC_PROVIDER_KEY; + filter.numFilterConditions = 4; + filter.filterCondition = conds; + filter.action.type = FWP_ACTION_CALLOUT_TERMINATING; + filter.flags = FWPM_FILTER_FLAG_NONE; + //filter.weight.type = FWP_EMPTY; + + // Add the inbound filter. + filter.layerKey = (p_ctx->pc_base->use_ipv6) ? FWPM_LAYER_INBOUND_TRANSPORT_V6 : FWPM_LAYER_INBOUND_TRANSPORT_V4; + if (p_ctx->pc_base->mode == tipsec_mode_tun) { + filter.action.calloutKey = (p_ctx->pc_base->use_ipv6) ? FWPM_CALLOUT_IPSEC_INBOUND_TUNNEL_V6 : FWPM_CALLOUT_IPSEC_INBOUND_TUNNEL_V4; + } + else { + filter.action.calloutKey = (p_ctx->pc_base->use_ipv6) ? FWPM_CALLOUT_IPSEC_INBOUND_TRANSPORT_V6 : FWPM_CALLOUT_IPSEC_INBOUND_TRANSPORT_V4; + } + if ((result = FwpmFilterAdd0(p_ctx->engine, &filter, NULL, &tmpInFilterId)) != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("FwpmFilterAdd0 (inbound) failed with error code [%x]", result); + goto CLEANUP; + } + + // Add the outbound filter. + filter.layerKey = (p_ctx->pc_base->use_ipv6) ? FWPM_LAYER_OUTBOUND_TRANSPORT_V6 : FWPM_LAYER_OUTBOUND_TRANSPORT_V4; + if (p_ctx->pc_base->mode == tipsec_mode_tun) { + filter.action.calloutKey = (p_ctx->pc_base->use_ipv6) ? FWPM_CALLOUT_IPSEC_OUTBOUND_TUNNEL_V6 : FWPM_CALLOUT_IPSEC_OUTBOUND_TUNNEL_V4; + } + else { + filter.action.calloutKey = (p_ctx->pc_base->use_ipv6) ? FWPM_CALLOUT_IPSEC_OUTBOUND_TRANSPORT_V6 : FWPM_CALLOUT_IPSEC_OUTBOUND_TRANSPORT_V4; + } + if ((result = FwpmFilterAdd0(p_ctx->engine, &filter, NULL, &tmpOutFilterId)) != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("FwpmFilterAdd0(outbound) failed with error code [%x]", result); + goto CLEANUP; + } + + // Create the SA context using the outbound traffic descriptor. + memset(&outTraffic, 0, sizeof(outTraffic)); + outTraffic.ipVersion = TINYIPSEC_VISTA_GET_IPVER(p_ctx->pc_base->use_ipv6); + if (p_ctx->pc_base->use_ipv6) { + memcpy(outTraffic.localV6Address, p_ctx->pc_base->addr_local, 16); + memcpy(outTraffic.remoteV6Address, p_ctx->pc_base->addr_remote, 16); + } + else { + outTraffic.localV4Address = *((UINT32*)p_ctx->pc_base->addr_local); + outTraffic.remoteV4Address = *((UINT32*)p_ctx->pc_base->addr_remote); + } + outTraffic.trafficType = TINYIPSEC_VISTA_GET_MODE(p_ctx->pc_base->mode); + outTraffic.ipsecFilterId = tmpOutFilterId; + if ((result = IPsecSaContextCreate0(p_ctx->engine, &outTraffic, NULL, &tmpSaId)) != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("IPsecSaContextCreate0 failed with error code [%x]", result); + goto CLEANUP; + } + + // Get the inbound SPI using the inbound traffic descriptor. + memset(&getSpi, 0, sizeof(getSpi)); + getSpi.inboundIpsecTraffic.ipVersion = TINYIPSEC_VISTA_GET_IPVER(p_ctx->pc_base->use_ipv6); + if (p_ctx->pc_base->use_ipv6) { + memcpy(getSpi.inboundIpsecTraffic.localV6Address, p_ctx->pc_base->addr_local, 16); + memcpy(getSpi.inboundIpsecTraffic.remoteV6Address, p_ctx->pc_base->addr_remote, 16); + } + else { + getSpi.inboundIpsecTraffic.localV4Address = *((UINT32*)p_ctx->pc_base->addr_local); + getSpi.inboundIpsecTraffic.remoteV4Address = *((UINT32*)p_ctx->pc_base->addr_remote); + } + getSpi.inboundIpsecTraffic.trafficType = TINYIPSEC_VISTA_GET_MODE(p_ctx->pc_base->mode); + getSpi.inboundIpsecTraffic.ipsecFilterId = tmpInFilterId; + getSpi.ipVersion = TINYIPSEC_VISTA_GET_IPVER(p_ctx->pc_base->use_ipv6); + if ((result = IPsecSaContextGetSpi0(p_ctx->engine, tmpSaId, &getSpi, spi))) { + TSK_DEBUG_ERROR("IPsecSaContextGetSpi0 failed with error code [%x]", result); + goto CLEANUP; + } + + //// Return the various LUIDs to the caller, so he can clean up. + //*inFilterId = tmpInFilterId; + //*outFilterId = tmpOutFilterId; + *saId = tmpSaId; + +CLEANUP: + if (result != NO_ERROR) { + _vista_deleteSaContextAndFilters(p_ctx->engine, tmpInFilterId, tmpOutFilterId, tmpSaId); + } + else { + ret = 0; + } + + return ret; +} + +static int _vista_boundSA(__in const plugin_win_ipsec_vista_ctx_t* p_ctx, __in UINT64 local_saId, __in tipsec_spi_t remote_spi, __in BOOLEAN toInbound) +{ + UINT32 i=0, j=0; + DWORD result = NO_ERROR; + IPSEC_SA0 sa; + IPSEC_SA_BUNDLE0 bundle; + IPSEC_SA_AUTH_INFORMATION0 authInfo; + PFWP_BYTE_BLOB ik = (PFWP_BYTE_BLOB)p_ctx->pc_base->ik; + PFWP_BYTE_BLOB ck = (PFWP_BYTE_BLOB)p_ctx->pc_base->ck; + + memset(&sa, 0, sizeof(sa)); + sa.spi = remote_spi; + sa.saTransformType = TINYIPSEC_VISTA_GET_PROTO(p_ctx->pc_base->protocol); + + + // + // Keys padding + // + if (p_ctx->pc_base->alg == tipsec_alg_hmac_sha_1_96) { + if (ik->size < TIPSEC_IK_LEN) { + for(i = ik->size; i < TIPSEC_KEY_LEN; i++) { + ik->data[i] = 0x00; /* Already done by "tsk_calloc" but ... */ + } + ik->size = TIPSEC_IK_LEN; + } + } + if (p_ctx->pc_base->ealg == tipsec_ealg_des_ede3_cbc) { + if (ck->size < TIPSEC_CK_LEN) { + for (i = ck->size; idata[i] = ck->data[j++]; + } + ck->size = TIPSEC_CK_LEN; + } + } + + // + // In all case create Authentication info + // + memset(&authInfo, 0, sizeof(authInfo)); + authInfo.authTransform.authTransformId = TINYIPSEC_VISTA_GET_ALGO(p_ctx->pc_base->alg); + authInfo.authKey = *ik; + + if ( sa.saTransformType == IPSEC_TRANSFORM_AH ) { + sa.ahInformation = &authInfo; + } + else if ( sa.saTransformType == IPSEC_TRANSFORM_ESP_AUTH ) { + sa.espAuthInformation = &authInfo; + } + else if ( sa.saTransformType == IPSEC_TRANSFORM_ESP_AUTH_AND_CIPHER ) { + IPSEC_SA_CIPHER_INFORMATION0 cipherInfo; + IPSEC_SA_AUTH_AND_CIPHER_INFORMATION0 cipherAuthInfo; + + memset(&cipherInfo, 0, sizeof(cipherInfo)); + cipherInfo.cipherTransform.cipherTransformId = TINYIPSEC_VISTA_GET_EALGO(p_ctx->pc_base->ealg); + cipherInfo.cipherKey = *ck; + + memset(&cipherAuthInfo, 0, sizeof(cipherAuthInfo)); + cipherAuthInfo.saAuthInformation = authInfo; + cipherAuthInfo.saCipherInformation = cipherInfo; + + sa.espAuthAndCipherInformation = &cipherAuthInfo; + } + + memset(&bundle, 0, sizeof(bundle)); + bundle.numSAs = 1; + bundle.saList = &sa; + bundle.ipVersion = TINYIPSEC_VISTA_GET_IPVER(p_ctx->pc_base->use_ipv6); + bundle.lifetime.lifetimeSeconds = (UINT32)((p_ctx->pc_base->lifetime > TINYIPSEC_SA_MAX_LIFETIME) ? TINYIPSEC_SA_MAX_LIFETIME : p_ctx->pc_base->lifetime); + + /* From remote to local (inbound) ? */ + if (toInbound) { + if((result = IPsecSaContextAddInbound0(p_ctx->engine, local_saId, &bundle)) != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("IPsecSaContextAddInbound0 failed with error code [%x]", result); + goto CLEANUP; + } + } + else { + if ((result = IPsecSaContextAddOutbound0(p_ctx->engine, local_saId, &bundle)) != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("IPsecSaContextAddOutbound0 failed with error code [%x]", result); + goto CLEANUP; + } + } + +CLEANUP: + return (result == ERROR_SUCCESS) ? 0 : -1; +} + +static int _vista_flushAll(const plugin_win_ipsec_vista_ctx_t* p_ctx) +{ + UINT32 i; + int ret = -1; + + if (p_ctx && p_ctx->engine) { + HANDLE enumHandle = NULL; + IPSEC_SA_DETAILS0** entries = NULL; + UINT32 numEntriesReturned = 0; + DWORD result; + + if ((result = IPsecSaCreateEnumHandle0(p_ctx->engine, NULL, &enumHandle)) != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("IPsecSaCreateEnumHandle0 failed with error code [%x].", result); + goto CLEANUP; + } + + if ((result = IPsecSaEnum0(p_ctx->engine, enumHandle, TINYIPSEC_SA_NUM_ENTRIES_TO_REQUEST, &entries, &numEntriesReturned)) != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("IPsecSaEnum0 failed with error code [%x].", result); + goto CLEANUP; + } + + for (i = 0; itransportFilter->displayData.name, TINYIPSEC_FILTER_NAME)) { + if ((result = FwpmFilterDeleteById0(p_ctx->engine, entry->transportFilter->filterId)) != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("FwpmFilterDeleteById0 failed with error code [%x].", result); + goto CLEANUP; + } + } + } + + if ((result = IPsecSaDestroyEnumHandle0(p_ctx->engine, enumHandle)) != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("IPsecSaDestroyEnumHandle0 failed with error code [%x].", result); + goto CLEANUP; + } + + TSK_DEBUG_INFO("All SAs have been flushed."); + ret = 0; + +CLEANUP: + if (entries) { + FwpmFreeMemory0((void**)entries); + } + } + + return ret; +} + +static void _vista_deleteSaContextAndFilters(__in HANDLE engine, __in UINT64 inFilterId, __in UINT64 outFilterId, __in UINT64 saId) +{ + DWORD result; + + // Allow the LUIDs to be zero, so we can use this function to cleanup + // partial results. + if (saId != 0) { + result = IPsecSaContextDeleteById0(engine, saId); + if (result != ERROR_SUCCESS) { + // There's not much we can do if delete fails, so continue trying to + // clean up the remaining objects. + TSK_DEBUG_ERROR("IPsecSaContextDeleteById0 = 0x%08X\n", result); + } + } + if (outFilterId != 0) { + result = FwpmFilterDeleteById0(engine, outFilterId); + if (result != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("FwpmFilterDeleteById0 = 0x%08X\n", result); + } + } + if (inFilterId != 0) { + result = FwpmFilterDeleteById0(engine, inFilterId); + if (result != ERROR_SUCCESS) { + TSK_DEBUG_ERROR("FwpmFilterDeleteById0 = 0x%08X\n", result); + } + } +} + +// +// Windows Vista IPSec Plugin definition +// + +/* constructor */ +static tsk_object_t* _plugin_win_ipsec_vista_ctx_ctor(tsk_object_t * self, va_list * app) +{ + plugin_win_ipsec_vista_ctx_t *p_ctx = (plugin_win_ipsec_vista_ctx_t *)self; + if (p_ctx) { + p_ctx->pc_base = TIPSEC_CTX(p_ctx); + } + return self; +} +/* destructor */ +static tsk_object_t* _plugin_win_ipsec_vista_ctx_dtor(tsk_object_t * self) +{ + plugin_win_ipsec_vista_ctx_t *p_ctx = (plugin_win_ipsec_vista_ctx_t *)self; + if (p_ctx) { + DWORD code; + + if (p_ctx->pc_base->started) { + tipsec_ctx_stop(p_ctx->pc_base); + } + + /* Close engine */ + if (p_ctx->engine) { + if ((code = FwpmEngineClose0(p_ctx->engine))) { + TSK_DEBUG_ERROR("FwpmEngineClose0 failed with error code [%x].", code); + } + } + + TSK_FREE(p_ctx->pc_base->addr_local); + TSK_FREE(p_ctx->pc_base->addr_remote); + + TSK_FREE(p_ctx->pc_base->ik); + TSK_FREE(p_ctx->pc_base->ck); + + TSK_DEBUG_INFO("*** Windows Vista IPSec plugin (Windows Filtering Platform) context destroyed ***"); + } + + return self; +} +/* object definition */ +static const tsk_object_def_t plugin_win_ipsec_vista_ctx_def_s = { + sizeof(plugin_win_ipsec_vista_ctx_t), + _plugin_win_ipsec_vista_ctx_ctor, + _plugin_win_ipsec_vista_ctx_dtor, + tsk_null, +}; +/* plugin definition*/ +static const tipsec_plugin_def_t plugin_win_ipsec_vista_plugin_def_s = { + &plugin_win_ipsec_vista_ctx_def_s, + + tipsec_impl_type_vista, + "Windows Vista IPSec (Windows Filtering Platform)", + + _plugin_win_ipsec_vista_ctx_init, + _plugin_win_ipsec_vista_ctx_set_local, + _plugin_win_ipsec_vista_ctx_set_remote, + _plugin_win_ipsec_vista_ctx_set_keys, + _plugin_win_ipsec_vista_ctx_start, + _plugin_win_ipsec_vista_ctx_stop, +}; +const tipsec_plugin_def_t *plugin_win_ipsec_vista_plugin_def_t = &plugin_win_ipsec_vista_plugin_def_s; diff --git a/branches/2.0/doubango/plugins/pluginWinIPSecVista/plugin_win_ipsec_vista_config.h b/branches/2.0/doubango/plugins/pluginWinIPSecVista/plugin_win_ipsec_vista_config.h new file mode 100644 index 00000000..61bc8221 --- /dev/null +++ b/branches/2.0/doubango/plugins/pluginWinIPSecVista/plugin_win_ipsec_vista_config.h @@ -0,0 +1,75 @@ +/* Copyright (C) 2013-2014 Mamadou DIOP +* Copyright (C) 2013-2014 Doubango Telecom +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +*/ +#ifndef PLUGIN_WIN_IPSEC_VISTA_CONFIG_H +#define PLUGIN_WIN_IPSEC_VISTA_CONFIG_H + +#ifdef __SYMBIAN32__ +#undef _WIN32 /* Because of WINSCW */ +#endif + + +// Windows (XP/Vista/7/CE and Windows Mobile) macro definition +#if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE) +# define PLUGIN_WIN_IPSEC_VISTA_UNDER_WINDOWS 1 +# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP || WINAPI_FAMILY == WINAPI_FAMILY_APP) +# define PLUGIN_WIN_IPSEC_VISTA_UNDER_WINDOWS_RT 1 +# endif +#endif + +#if (PLUGIN_WIN_IPSEC_VISTA_UNDER_WINDOWS || defined(__SYMBIAN32__)) && defined(PLUGIN_WIN_IPSEC_VISTA_EXPORTS) +# define PLUGIN_WIN_IPSEC_VISTA_API __declspec(dllexport) +# define PLUGIN_WIN_IPSEC_VISTA_GEXTERN extern __declspec(dllexport) +#elif (PLUGIN_WIN_IPSEC_VISTA_UNDER_WINDOWS || defined(__SYMBIAN32__)) && !defined(PLUGIN_WIN_IPSEC_VISTA_IMPORTS_IGNORE) +# define PLUGIN_WIN_IPSEC_VISTA_API __declspec(dllimport) +# define PLUGIN_WIN_IPSEC_VISTA_GEXTERN __declspec(dllimport) +#else +# define PLUGIN_WIN_IPSEC_VISTA_API +# define PLUGIN_WIN_IPSEC_VISTA_GEXTERN extern +#endif + +// x86 +#if defined(__x86_64__) || defined(__x86__) || defined(__i386__) +# define PLUGIN_WIN_IPSEC_VISTA_UNDER_X86 1 +#endif + +// Guards against C++ name mangling +#ifdef __cplusplus +# define PLUGIN_WIN_IPSEC_VISTA_BEGIN_DECLS extern "C" { +# define PLUGIN_WIN_IPSEC_VISTA_END_DECLS } +#else +# define PLUGIN_WIN_IPSEC_VISTA_BEGIN_DECLS +# define PLUGIN_WIN_IPSEC_VISTA_END_DECLS +#endif + +#ifdef _MSC_VER +# define inline __inline +# define _CRT_SECURE_NO_WARNINGS +# define _ALLOW_KEYWORD_MACROS +#endif + +#include +#ifdef __SYMBIAN32__ +#include +#endif + +#if HAVE_CONFIG_H +#include +#endif + +#endif // PLUGIN_WIN_IPSEC_VISTA_CONFIG_H diff --git a/branches/2.0/doubango/plugins/pluginWinIPSecVista/version.rc b/branches/2.0/doubango/plugins/pluginWinIPSecVista/version.rc new file mode 100644 index 00000000..3e395154 --- /dev/null +++ b/branches/2.0/doubango/plugins/pluginWinIPSecVista/version.rc @@ -0,0 +1,102 @@ +// Microsoft Visual C++ generated resource script. +// +// #include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,0,0,1001 + PRODUCTVERSION 2,0,0,1001 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Doubango Telecom" + VALUE "FileDescription", "Doubango IMS Framework IPSec implementaion for Windows Vista and later" + VALUE "FileVersion", "2.0.0.1001" + VALUE "InternalName", "pluginMF.dll" + VALUE "LegalCopyright", "(c) 2010-2013 Doubango Telecom. All rights reserved." + VALUE "OriginalFilename", "pluginWinIPSecVista.dll" + VALUE "ProductName", "Doubango IMS Framework IPSec implementaion" + VALUE "ProductVersion", "2.0.0.1001" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/branches/2.0/doubango/plugins/pluginWinMF/version.rc b/branches/2.0/doubango/plugins/pluginWinMF/version.rc index 8c6c3917..bee80893 100644 --- a/branches/2.0/doubango/plugins/pluginWinMF/version.rc +++ b/branches/2.0/doubango/plugins/pluginWinMF/version.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,972 - PRODUCTVERSION 2,0,0,972 + FILEVERSION 2,0,0,1001 + PRODUCTVERSION 2,0,0,1001 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -71,12 +71,12 @@ BEGIN BEGIN VALUE "CompanyName", "Doubango Telecom" VALUE "FileDescription", "Doubango IMS Framework Media Foundation Plugin" - VALUE "FileVersion", "2.0.0.972" + VALUE "FileVersion", "2.0.0.1001" VALUE "InternalName", "pluginMF.dll" VALUE "LegalCopyright", "(c) 2010-2013 Doubango Telecom. All rights reserved." VALUE "OriginalFilename", "pluginMF.dll" VALUE "ProductName", "Doubango IMS Framework Foundation Plugin" - VALUE "ProductVersion", "2.0.0.972" + VALUE "ProductVersion", "2.0.0.1001" END END BLOCK "VarFileInfo" diff --git a/branches/2.0/doubango/thirdparties/win32/tools/AStyle.exe b/branches/2.0/doubango/thirdparties/win32/tools/AStyle.exe new file mode 100644 index 00000000..a0080494 Binary files /dev/null and b/branches/2.0/doubango/thirdparties/win32/tools/AStyle.exe differ diff --git a/branches/2.0/doubango/tinyDAV/Makefile.am b/branches/2.0/doubango/tinyDAV/Makefile.am index 3303a44d..f96c1142 100644 --- a/branches/2.0/doubango/tinyDAV/Makefile.am +++ b/branches/2.0/doubango/tinyDAV/Makefile.am @@ -5,10 +5,12 @@ libtinyDAV_la_LIBADD = \ ../tinySDP/libtinySDP.la\ ../tinyRTP/libtinyRTP.la\ ../tinyMEDIA/libtinyMEDIA.la\ - ../tinyMSRP/libtinyMSRP.la + ../tinyMSRP/libtinyMSRP.la\ + ../tinyIPSec/libtinyIPSec.la libtinyDAV_la_CPPFLAGS = -I../tinySAK/src\ -I../tinyNET/src\ + -I../tinyIPSec/src\ -I../tinySDP/include\ -I../tinyRTP/include\ -I../tinyMEDIA/include\ diff --git a/branches/2.0/doubango/tinyDAV/droid-makefile b/branches/2.0/doubango/tinyDAV/droid-makefile index d68e074b..75c2aa23 100644 --- a/branches/2.0/doubango/tinyDAV/droid-makefile +++ b/branches/2.0/doubango/tinyDAV/droid-makefile @@ -169,13 +169,13 @@ endif CFLAGS := $(CFLAGS_LIB) -I$(THIRDPARTIES_INC) -I$(THIRDPARTIES_INC_COMMON) $(ILBC_CFLAGS) $(LIBGSM_CFLAGS) \ $(FFMPEG_CFLAGS) $(LIBYUV_CFLAGS) $(VPX_CFLAGS) $(SPEEX_CFLAGS) $(SPEEX_DSP_CFLAGS) $(WEBRTC_CFLAGS) $(OPUS_CFLAGS) $(OPENCORE_AMR_CFLAGS) $(BV16_CFLAGS) $(G729_CFLAGS) \ $(LIBSRTP_CFLAGS) \ - -I../tinySAK/src -I../tinyNET/src -I../tinySDP/include -I../tinyRTP/include -I../tinyMEDIA/include -I../tinyMSRP/include -I./include \ + -I../tinySAK/src -I../tinyNET/src -I../tinyIPSec/src -I../tinySDP/include -I../tinyRTP/include -I../tinyMEDIA/include -I../tinyMSRP/include -I./include \ -DJB_HISTORY_SIZE=500 LDFLAGS := $(LDFLAGS_LIB) -L$(THIRDPARTIES_LIB) -L$(THIRDPARTIES_MARCH_LIB) \ $(FFMPEG_LDFLAGS) $(LIBYUV_LDFLAGS) $(VPX_LDFLAGS) $(SPEEX_LDFLAGS) $(SPEEX_DSP_LDFLAGS) $(WEBRTC_LDFLAGS) $(OPUS_LDFLAGS) $(OPENCORE_AMR_LDFLAGS) $(ILBC_LDFLAGS) $(LIBGSM_LDFLAGS) $(BV16_LDFLAGS) $(G729_LDFLAGS) \ $(LIBSRTP_LDFLAGS) \ - -ltinySAK_$(MARCH) -ltinyNET_$(MARCH) -ltinySDP_$(MARCH) -ltinyRTP_$(MARCH) -ltinyMEDIA_$(MARCH) -ltinyMSRP_$(MARCH) -lm -lgcc + -ltinySAK_$(MARCH) -ltinyNET_$(MARCH) -ltinyIPSec_$(MARCH) -ltinySDP_$(MARCH) -ltinyRTP_$(MARCH) -ltinyMEDIA_$(MARCH) -ltinyMSRP_$(MARCH) -lm -lgcc all: $(APP) diff --git a/branches/2.0/doubango/tinyDAV/include/tinydav/tdav.h b/branches/2.0/doubango/tinyDAV/include/tinydav/tdav.h index ccd607ec..8318771e 100644 --- a/branches/2.0/doubango/tinyDAV/include/tinydav/tdav.h +++ b/branches/2.0/doubango/tinyDAV/include/tinydav/tdav.h @@ -88,6 +88,7 @@ TINYDAV_API int tdav_codec_set_priority(tdav_codec_id_t codec_id, int priority); TINYDAV_API int tdav_set_codecs(tdav_codec_id_t codecs); TINYDAV_API tsk_bool_t tdav_codec_is_supported(tdav_codec_id_t codec); TINYDAV_API tsk_bool_t tdav_codec_is_enabled(tdav_codec_id_t codec); +TINYDAV_API tsk_bool_t tdav_ipsec_is_supported(); TINYDAV_API int tdav_deinit(); TDAV_END_DECLS diff --git a/branches/2.0/doubango/tinyDAV/src/tdav.c b/branches/2.0/doubango/tinyDAV/src/tdav.c index 30e36f8d..d084cbce 100644 --- a/branches/2.0/doubango/tinyDAV/src/tdav.c +++ b/branches/2.0/doubango/tinyDAV/src/tdav.c @@ -29,6 +29,7 @@ #include "tinydav/tdav.h" static tsk_bool_t __b_initialized = tsk_false; +static tsk_bool_t __b_ipsec_supported = tsk_false; static const struct tmedia_codec_plugin_def_s* __codec_plugins_all[0xFF] = { tsk_null }; // list of all codecs BEFORE filtering static const tsk_size_t __codec_plugins_all_count = sizeof(__codec_plugins_all)/sizeof(__codec_plugins_all[0]); @@ -48,12 +49,16 @@ static const tsk_size_t __codec_plugins_all_count = sizeof(__codec_plugins_all)/ static struct tsk_plugin_s* __dll_plugin_mf = tsk_null; /* Media Foundation and WASAPI : Windows [7 - 8] */ static struct tsk_plugin_s* __dll_plugin_cuda = tsk_null; /* Media Foundation and WASAPI : Windows [XP - 8] */ static struct tsk_plugin_s* __dll_plugin_audio_dsp = tsk_null; /* Audio DSP, Resampler, AEC, NS, AGC...: Windows [Vista - 8] */ + static struct tsk_plugin_s* __dll_plugin_ipsec_wfp = tsk_null; /* IPSec implementation using WFP (Windows Filtering platform): Windows [Vista - 8] */ # endif /* TDAV_UNDER_WINDOWS */ #endif -// Media Contents, ... +// Media Contents, plugins defintion... #include "tinymedia.h" +// IPSec +#include "tipsec.h" + // Converters #include "tinymedia/tmedia_converter_video.h" // Converters @@ -207,6 +212,15 @@ int tdav_init() plugins_count += tmedia_plugin_register(__dll_plugin_audio_dsp, tsk_plugin_def_type_all, tsk_plugin_def_media_type_all); } } + /* IPSec implementation using Windows Filtering Platform (WFP) */ + if(tdav_win32_is_winvista_or_later()){ + tsk_sprintf(&full_path, "%s/pluginWinIPSecVista.dll", tdav_get_current_directory_const()); + if(tsk_plugin_file_exist(full_path) && (tipsec_plugin_register_file(full_path, &__dll_plugin_ipsec_wfp) == 0)){ + plugins_count += 1; // at least one + __b_ipsec_supported = tsk_true; + } + } + TSK_FREE(full_path); TSK_DEBUG_INFO("Windows stand-alone plugins loaded = %u", plugins_count); } @@ -495,6 +509,15 @@ tsk_bool_t tdav_codec_is_enabled(tdav_codec_id_t codec) return tmedia_codec_plugin_is_registered_2((tmedia_codec_id_t)codec); } +/** +* Checks whether a IPSec is supported. +* @return @ref tsk_true if supported and @tsk_false otherwise. +*/ +tsk_bool_t tdav_ipsec_is_supported() +{ + return __b_ipsec_supported; +} + int tdav_deinit() { int ret = 0; @@ -611,6 +634,7 @@ int tdav_deinit() TSK_OBJECT_SAFE_FREE(__dll_plugin_mf); TSK_OBJECT_SAFE_FREE(__dll_plugin_dshow); TSK_OBJECT_SAFE_FREE(__dll_plugin_audio_dsp); + TSK_OBJECT_SAFE_FREE(__dll_plugin_ipsec_wfp); } #endif diff --git a/branches/2.0/doubango/tinyDAV/tinyDAV.sln b/branches/2.0/doubango/tinyDAV/tinyDAV.sln index 8a4d157c..27dec8a0 100644 --- a/branches/2.0/doubango/tinyDAV/tinyDAV.sln +++ b/branches/2.0/doubango/tinyDAV/tinyDAV.sln @@ -15,8 +15,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcproj", EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyRTP", "..\tinyRTP\tinyRTP.vcproj", "{99B7D02F-8C70-4B45-AF3C-92313C3CEE15}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyDSHOW", "..\tinyDSHOW\tinyDSHOW.vcproj", "{0CCC02F1-4233-424F-AD5E-A021456E6E8D}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyMSRP", "..\tinyMSRP\tinyMSRP.vcproj", "{AA46AF16-9678-4054-8E48-98DC21ECEC82}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyHTTP", "..\tinyHTTP\tinyHTTP.vcproj", "{B3E45009-C7C3-4090-837C-2D30C9058443}" @@ -133,18 +131,6 @@ Global {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Release|Win32.ActiveCfg = Release|Win32 {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Release|Win32.Build.0 = Release|Win32 {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Debug|Win32.ActiveCfg = Debug|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Debug|Win32.Build.0 = Debug|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Release|Win32.ActiveCfg = Release|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Release|Win32.Build.0 = Release|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Static_Debug|Win32.Build.0 = Debug|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Static_Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Static_Release|Win32.ActiveCfg = Release|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Static_Release|Win32.Build.0 = Release|Win32 - {0CCC02F1-4233-424F-AD5E-A021456E6E8D}.Static_Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32 {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Debug|Win32.ActiveCfg = Debug|Win32 {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Debug|Win32.Build.0 = Debug|Win32 {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32 diff --git a/branches/2.0/doubango/tinyDAV/tinyDAV.vcproj b/branches/2.0/doubango/tinyDAV/tinyDAV.vcproj index b65e36af..5f94e334 100644 --- a/branches/2.0/doubango/tinyDAV/tinyDAV.vcproj +++ b/branches/2.0/doubango/tinyDAV/tinyDAV.vcproj @@ -41,7 +41,7 @@